Q
Q
QwEEzeR2021-10-11 17:23:26
Python
QwEEzeR, 2021-10-11 17:23:26

The bot does not send a message to telegram, there are no errors in the code, why does it not work?

import telebot

token = "токен"
bot = telebot.TeleBot(token)

bot.send_message(ид,'mq')

print('mqmqmqmq')

It seems that everything is installed, but the bot still does not send a message. There are no errors when running the code, and it displays my text, which is indicated in the last line. Here is my pip list

certifi 2021.10.8
charset-normalizer 2.0.6
idna 3.2
pip 21.2.4
pyTelegramBotAPI 4.1.1
requests 2.26.0
setuptools 57.4.0
telebot 0.0.4
urllib3 1.26.7

Answer the question

In order to leave comments, you need to log in

4 answer(s)
S
soremix, 2021-10-11
@QwEEzeR

Delete the extra telebot
pip uninstall telebot
And fix the token. Polling is useless

A
alexbprofit, 2021-10-11
@alexbprofit

bot.polling()

T
tatsuki1, 2021-10-11
@tatsuki1

import telebot
from telebot import types

token = "ваш токен"
bot = telebot.TeleBot(token)

@bot.message_handler(content_types=['text'])
def test(message):
    bot.send_message(message.chat.id, 'mq')

print('mqmqmqmq')

P
Python Newbie, 2021-10-11
@Levman5

At the very end of the code writebot.polling()

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question