Untitled
unknown
plain_text
2 years ago
1.8 kB
4
Indexable
#include <Windows.h> #include <WinINet.h> #include <iostream> int main() { std::string token = "TOKEN"; // Botunuzun Discord API token'ını buraya yazın std::string filePath = "C:\\path\\to\\file.ext"; // İletmek istediğiniz dosyanın tam yolunu buraya yazın std::string uploadURL = "https://discord.com/api/v10/channels/CHANNEL_ID/messages"; // Hedef kanalın URL'sini buraya yazın HINTERNET hInternet = InternetOpenA("MyApp", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0); if (hInternet) { HINTERNET hConnect = InternetOpenUrlA(hInternet, uploadURL.c_str(), NULL, 0, INTERNET_FLAG_RELOAD, 0); if (hConnect) { std::ifstream file(filePath, std::ios::binary); if (file) { file.seekg(0, std::ios::end); std::streampos fileSize = file.tellg(); file.seekg(0, std::ios::beg); std::vector<char> fileContents(fileSize); file.read(fileContents.data(), fileSize); std::string authorizationHeader = "Authorization: Bot " + token; std::string contentTypeHeader = "Content-Type: application/octet-stream"; std::string headers = authorizationHeader + "\r\n" + contentTypeHeader + "\r\n"; std::string requestData(fileContents.begin(), fileContents.end()); HttpSendRequestA(hConnect, headers.c_str(), headers.size(), const_cast<char*>(requestData.c_str()), requestData.size()); file.close(); } else { std::cerr << "Dosya açılamadı: " << filePath << std::endl; } InternetCloseHandle(hConnect); } InternetCloseHandle(hInternet); } return 0; }
Editor is loading...