yagop / node-telegram-bot-api

Telegram Bot API for NodeJS
MIT License
8.45k stars 1.53k forks source link

Telegram Bot API v5.3 Support #886

Closed danielperez9430 closed 3 years ago

danielperez9430 commented 3 years ago
  1. Support Bot API v5.3: (@danielperez9430)

    • Add method deleteMyCommands()
    • Add method banChatMember()
    • Add method getChatMemberCount()

    New Test:

    • deleteMyCommands
    • banChatMember
    • getChatMemberCount

    Deprecated:

    • Method kickChatMember()
    • Method getChatMembersCount()

Description

Add support to Telegram Bot API v5.3

References

danielperez9430 commented 3 years ago

Use Examples:

deleteMyCommands()

bot.onText(/^\/rcommands/, (msg) => {
  var chatId = msg.chat.id;

  bot.deleteMyCommands().then(function (info) {
    bot.sendMessage(chatId, "All commands remove: " + info);
  });

});

banChatMember()

bot.onText(/^\/ban/, (msg) => {
  var chatId = msg.chat.id;
  var replyId = msg.reply_to_message.from.id;

  bot.banChatMember(chatId, replyId).then(function (result) {
    bot.sendMessage(chatId, "User Banned: " + result)
  });

});

getChatMembersCount()

bot.onText(/^\/count/, (msg) => {

  var chatId = msg.chat.id;

  bot.getChatMembersCount(chatId)
    .then(data => {
      bot.sendMessage(chatId, data + " member/s in this chat");
    });

});