K
K
Kredao Games2021-12-20 13:11:30
Python
Kredao Games, 2021-12-20 13:11:30

Telegram bot not working, why?

Hello everyone
, I have a problem. When creating the first Telegram bot in python, I ran into one problem, my bot did NOT react to anything

pip list

certifi 2021.10.8
charset-normalizer 2.0.9
idna 3.3
pip 21.3.1
pyTelegramBotAPI 4.2.2
requests 2.26.0
setuptools 58.1. 0
urllib3 1.26.7

code
import telebot;
from telebot import types

TOKEN = '5004045280:AAHH9q5bg5H4CI7chlaJJC7mQAl8LZgcpd0'
bot = telebot.TeleBot(TOKEN)

@bot.message_handler(content_types=['text'])
def send_text(message):
if message.text.lower() == 'Hello ':
bot.send_message(message.chat.id, 'Hello my creator')
elif message.text.lover() == 'Bye':
bot.send_message(message.chat.id, 'Goodbye creator')

bot.polling ()

when I drive the script run:
C:\Users\defaultuser0>python HQDBot2021.py

C:\Users\defaultuser0>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Strazh, 2022-04-05
@Strazh

Hello, the code is a bit wrong. You need it like this at the end: bot.polling(none_stop=True)
If you want, you can write to telegram and we will discuss the topic of bots
TG TG: KIRILL_PROGRAMMER

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question