X
X
xxxfdd2020-12-15 20:58:46
Python
xxxfdd, 2020-12-15 20:58:46

How to send a message through a bot to a group?

I need to make it so that I can send messages to the group through the bot here is the code
Here is the code

TOKEN = '1366833368'  # полученный у @BotFather
bot = telebot.TeleBot(TOKEN)


@bot.message_handler(commands=['start'])
def start(message):
    print(message.chat.id)


GROUP_ID = -1001410  # Ваш ID группы



# Выдаём Read-only за определённые фразы
@bot.message_handler(content_types=['text'])
def set_ro(message):
    bot.send_message(message.id(-100141037), 'Какоето сообщение')

print('ЖИВОЙ')
bot.polling()

I'm trying to send a message to a group by group id but nothing comes out please help

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
MagaSim, 2020-12-16
@MagaSim

The bot should be added to the group if I'm not mistaken. You may need to give it administrator rights. In the father_bot settings, it seems that you still need to set permission to work with groups
bot.send_message(group_id, message.text)
. It can help, but it’s also worth google how to send messages to a group

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question