Reputation: 118
My code:
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)
Error:
AttributeError: 'TeleBot' object has no attribute 'getChatMembersCount'
How to use 'getChatMembersCount'?
P. S. I use https://github.com/eternnoir/pyTelegramBotAPI
Upvotes: 1
Views: 2778
Reputation: 370
#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)
Upvotes: 1
Reputation: 10782
It is called get_chat_members_count
(direct link to implementation).
From 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.
Upvotes: 2