#include <amxmodx>
#include <curl>
#define PLUGIN "Telegram send message"
#define AUTHOR "BeasT"
#define VERSION "1.0"
#define MESSAGE "тест"
#define CHAT_ID ""
#define TOKEN ""
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
register_concmd("vksend", "send");
}
public OnExecComplete(Handle:curl, CURLcode:code, const response[], any:eventType)
curl_close(curl)
public send()
{
new szFullMessage[200]
formatex(szFullMessage, charsmax(szFullMessage), "https://api.telegram.org/bot%s/sendMessage?chat_id=%s&text=%s", TOKEN, CHAT_ID, MESSAGE)
new Handle:curl = curl_init()
curl_setopt_string(curl, CURLOPT_URL, szFullMessage)
curl_setopt_cell(curl, CURLOPT_PORT, 443)
curl_setopt_cell(curl, CURLOPT_RETURNTRANSFER, 1)
if(curl_thread_exec(curl, "OnExecComplete", 0) != CURLE_OK) {
log_amx("[cURL] Query send failed");
}
else {
log_amx("[cURL] Query sended successfully");
}
}