From 8a07c89fa87bac28eb81675f28b25962b267eab3 Mon Sep 17 00:00:00 2001 From: SyS Date: Sun, 19 Mar 2023 19:15:23 +0530 Subject: [PATCH] update examples --- README.md | 32 ++++++++++++++++---------------- pawn-examples/basic-bot/main.pwn | 32 ++++++++++++++++---------------- 2 files changed, 32 insertions(+), 32 deletions(-) diff --git a/README.md b/README.md index ae76755..21eb960 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,7 @@ new TGBot:g_bot; main() { //Store bot token in SAMP_TG_BOT environment variable and connect from it - g_bot = TGConnectFromEnv("SAMP_TG_BOT"); + g_bot = TG_ConnectFromEnv("SAMP_TG_BOT"); if(g_bot != INVALID_BOT_ID) { printf("bot connected successfully!"); } else { @@ -57,7 +57,7 @@ main() { } } -public OnTGMessage(TGBot:bot,TGUser:fromid,TGMessage:messageid) { +public OnTGMessage(TGBot:bot,TGUser:fromid[],TGMessage:messageid) { if(g_bot != bot){ return 1; @@ -69,51 +69,51 @@ public OnTGMessage(TGBot:bot,TGUser:fromid,TGMessage:messageid) { chatname[56], server_msg[128]; - TGCacheGetMessage(message); - TGCacheGetUserName(username); - TGCacheGetChatName(chatname); + TG_CacheGetMessage(message); + TG_CacheGetUserName(username); + TG_CacheGetChatName(chatname); - format(server_msg,128,"[%s] %s(%d): %s",chatname,username,_:fromid,message); + format(server_msg,128,"[%s] %s(%s): %s",chatname,username,_:fromid,message); SendClientMessageToAll(-1,server_msg); return 1; } -public OnTGUserJoined(TGBot:bot,TGUser:userid) { +public OnTGUserJoined(TGBot:bot,TGUser:userid[]) { new TGChatId:chatid[12], username[24], chatname[56], server_msg[128]; - TGCacheGetUserName(username); - TGCacheGetChatId(chatid); - TGCacheGetChatName(chatname); + TG_CacheGetUserName(username); + TG_CacheGetChatId(chatid); + TG_CacheGetChatName(chatname); format(server_msg,128,"User %s(%d) joined %s(%s)",username,_:userid,chatname,_:chatid); SendClientMessageToAll(-1,server_msg); return 1; } -public OnTGUserLeft(TGBot:bot,TGUser:userid) { +public OnTGUserLeft(TGBot:bot,TGUser:userid[]) { new TGChatId:chatid[12], username[24], chatname[56], server_msg[128]; - TGCacheGetUserName(username); - TGCacheGetChatId(chatid); - TGCacheGetChatName(chatname); + TG_CacheGetUserName(username); + TG_CacheGetChatID(chatid); + TG_CacheGetChatName(chatname); - format(server_msg,128,"User %s(%d) left %s(%s)",username,_:userid,chatname,_:chatid); + format(server_msg,128,"User %s(%s) left %s(%s)",username,_:userid,chatname,_:chatid); SendClientMessageToAll(-1,server_msg); return 1; } CMD:sendtgmessage(playerid,params[]) { - TGSendMessage(g_bot,CHAT_ID,params); + TG_SendMessage(g_bot,CHAT_ID,params); return 1; } ``` \ No newline at end of file diff --git a/pawn-examples/basic-bot/main.pwn b/pawn-examples/basic-bot/main.pwn index 5059e12..efd701c 100644 --- a/pawn-examples/basic-bot/main.pwn +++ b/pawn-examples/basic-bot/main.pwn @@ -7,7 +7,7 @@ new TGBot:g_bot; main() { - g_bot = TGConnectFromEnv("SAMP_TG_BOT"); + g_bot = TG_ConnectFromEnv("SAMP_TG_BOT"); if(g_bot != INVALID_BOT_ID) { printf("bot connected successfully!"); } else { @@ -15,7 +15,7 @@ main() { } } -public OnTGMessage(TGBot:bot,TGUser:fromid,TGMessage:messageid) { +public OnTGMessage(TGBot:bot,TGUser:fromid[],TGMessage:messageid) { if(g_bot != bot){ return 1; @@ -27,11 +27,11 @@ public OnTGMessage(TGBot:bot,TGUser:fromid,TGMessage:messageid) { chatname[56], server_msg[128]; - TGCacheGetMessage(message); - TGCacheGetUserName(username); - TGCacheGetChatName(chatname); + TG_CacheGetMessage(message); + TG_CacheGetUserName(username); + TG_CacheGetChatName(chatname); - format(server_msg,128,"[%s] %s(%d): %s",chatname,username,_:fromid,message); + format(server_msg,128,"[%s] %s(%s): %s",chatname,username,_:fromid,message); print(server_msg); SendClientMessageToAll(-1,server_msg); @@ -39,18 +39,18 @@ public OnTGMessage(TGBot:bot,TGUser:fromid,TGMessage:messageid) { } -public OnTGUserJoined(TGBot:bot,TGUser:userid) { +public OnTGUserJoined(TGBot:bot,TGUser:userid[]) { new TGChatId:chatid[12], username[24], chatname[56], server_msg[128]; - TGCacheGetUserName(username); - TGCacheGetChatId(chatid); - TGCacheGetChatName(chatname); + TG_CacheGetUserName(username); + TG_CacheGetChatId(chatid); + TG_CacheGetChatName(chatname); - format(server_msg,128,"User %s(%d) joined %s(%s)",username,_:userid,chatname,_:chatid); + format(server_msg,128,"User %s(%s) joined %s(%s)",username,_:userid,chatname,_:chatid); print(server_msg); SendClientMessageToAll(-1,server_msg); return 1; @@ -63,17 +63,17 @@ public OnTGUserLeft(TGBot:bot,TGUser:userid) { chatname[56], server_msg[128]; - TGCacheGetUserName(username); - TGCacheGetChatId(chatid); - TGCacheGetChatName(chatname); + TG_CacheGetUserName(username); + TG_CacheGetChatId(chatid); + TG_CacheGetChatName(chatname); - format(server_msg,128,"User %s(%d) left %s(%s)",username,_:userid,chatname,_:chatid); + format(server_msg,128,"User %s(%s) left %s(%s)",username,_:userid,chatname,_:chatid); print(server_msg); SendClientMessageToAll(-1,server_msg); return 1; } CMD:sendtgmessage(playerid,params[]) { - TGSendMessage(g_bot,CHAT_ID,params); + TG_SendMessage(g_bot,CHAT_ID,params); return 1; } \ No newline at end of file