getChatMembersCount 远程机器人
getChatMembersCount telebot
我的代码:
import telebot
bot = telebot.TeleBot(constants.token)
@bot.message_handler(commands=['roll'])
def handle_command(message):
roll = random.randint(1, 100)
bot.send_message(message.chat.id, roll)
bot.getChatMembersCount()
bot.polling(none_stop=True, interval=0)
错误:
AttributeError: 'TeleBot' object has no attribute
'getChatMembersCount'
如何使用'getChatMembersCount'?
叫做get_chat_members_count
(direct link to implementation).
来自 https://github.com/eternnoir/pyTelegramBotAPI/ :
Methods
All API methods are located in the TeleBot class. They are renamed to follow common Python naming conventions. E.g. getMe is renamed to get_me and sendMessage to send_message.
#Send a text from bot to channel by forward
@bot.message_handler(func=lambda message: True)
def main(message):
if message.forward_from_chat:
apiuz=message.forward_from_chat
count = bot.get_chat_members_count(apiuz.id)
bot.send_message(chat_id, count)
我的代码:
import telebot
bot = telebot.TeleBot(constants.token)
@bot.message_handler(commands=['roll'])
def handle_command(message):
roll = random.randint(1, 100)
bot.send_message(message.chat.id, roll)
bot.getChatMembersCount()
bot.polling(none_stop=True, interval=0)
错误:
AttributeError: 'TeleBot' object has no attribute 'getChatMembersCount'
如何使用'getChatMembersCount'?
叫做get_chat_members_count
(direct link to implementation).
来自 https://github.com/eternnoir/pyTelegramBotAPI/ :
Methods
All API methods are located in the TeleBot class. They are renamed to follow common Python naming conventions. E.g. getMe is renamed to get_me and sendMessage to send_message.
#Send a text from bot to channel by forward
@bot.message_handler(func=lambda message: True)
def main(message):
if message.forward_from_chat:
apiuz=message.forward_from_chat
count = bot.get_chat_members_count(apiuz.id)
bot.send_message(chat_id, count)