TGEditMessage - Sreyas-Sreelal/tgconnector GitHub Wiki

TGEditMessage

  • Description

    Edits a specified message in a chat sent by the bot itself.

  • Parameters

    • TGBot:bot - bot instance id
    • TGChatId:chatid[] - chat id to which message to be edited
    • TGMessage:messageid - id of message to be edited
    • text[] - new message
    • TGParseMode:parse_mode - (optional) parse the message in specified format before editing
  • Example

    new TGBot:bot = TGConnect("your_bot_token_here");
    new TGChatId:chatid[] = "562896556";
    
    TGSendMessage(
    	g_bot,
    	chatid,
    	"`markdown text` ***bold*** _italic_ 123",
    	.parse_mode=MARKDOWN,
    	.callback="SendingMessage"
    );
    
    forward SendingMessage(TGBot:bot,TGMessage:messageid);
    public SendingMessage(TGBot:bot,TGMessage:messageid) {
    	new TGChatId:chatid[12];
    	TGCacheGetChatId(chatid);
    	TGEditMessage(bot,chatid,messageid,"***edited message***",.parse_mode=MARKDOWN);
    	return 1;
    }
    
  • Notes

    Bot can only edit it's own message