M
M
merken2020-08-30 14:22:31
Bots
merken, 2020-08-30 14:22:31

Created a Telegram bot, but it doesn't work; an error pops up, what should I do?

I created a bot for telegram, everything was fine. Then I write python bot.py on the windose command line
(to check if there are any errors in the code) and then this pops up.
Traceback (most recent call last):
File "bot.py", line 2, in
import config
ModuleNotFoundError: No module named 'config'
That's why the telegram bot doesn't work for me.
WHAT TO DO?

If so here is my code:

import telebot
import configure

bot = telebot.TeleBot(configure.config.TOKEN)

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

if __name__ == '__main__':
    bot.polling(none_stop=True)

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
Sergey Karbivnichy, 2020-08-30
@hottabxp

I created a bot for telegram, everything was fine.
Just don't tell stories. You did not create a bot, you copied it from the Internet, and then with errors. Yes, and another error was given from another code.
To make it work, you need to create a "config.py" file in the same directory with the bot file. In it, write the following line:
TOKEN = 'тут_ваш_токен'
Next: 'import configure' replaced by 'import config'
And - bot = telebot.TeleBot(configure.config.TOKEN)replaced by bot = telebot.TeleBot(config.TOKEN)
And in general, you need to ban everyone who climbs into bots, but does not know the basics!!!

S
soremix, 2020-08-30
@soremix

The error has nothing to do with the code you are showing.

M
Mpyrulearn, 2020-08-30
@Mpyrulearn

Replace configure.config.TOKEN with the line: "here is your token 1234566"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question