Skip to content
This repository has been archived by the owner on Jul 29, 2021. It is now read-only.

wopox1337/AMXX_TelegramBotAPI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

Telegram BOT API wrapper library for AMXModX plugins.

Requirments:

Include file API: TelegramBotAPI.inc

  • Create telegram bot: LINK
  • Get bot_token: LINK
  • Get chat_id: LINK

Usage example:

#include <amxmodx>
#include <TelegramBotAPI>

new const BOT_TOKEN[] = " ENTER YOU KEY HERE ";

// Chats ID configuration.
new const CHATS[][] = {
    "207444577"
    ,"-1001431316463"
};

new g_botID;

public plugin_init() {
    register_plugin("[Example plugin] Send server startup to TG", "1.0.0", "Sergey Shorokhov");
}

public TG_BotAPI_Initialized() {
    TG_RegisterBot(BOT_TOKEN, "BotRegistred");
}

public BotRegistred(const botID, const botName[]) {
    g_botID = botID;
    for(new i; i < sizeof CHATS; i++) {
        TG_BotAddSubscription(botID, CHATS[i], "BotSubscriptionAdded");
    }
}

public BotSubscriptionAdded(const subscriptionID, const botID, const chatID[], const chatTitle[], const chatType[]) {
    
}

public OnConfigsExecuted() {
    if(!TG_BotAPI_Allowed())
        return;

    TG_BotSendMessageALL(g_botID, "[Server startup] - TG_BotSendMessageALL");
    //TG_BotSendMessage(g_botID, "-1001431316463", "[Server startup] - TG_BotSendMessage");
}

Releases

No releases published

Packages

No packages published

Languages