Answer the question
In order to leave comments, you need to log in
Error when writing a telegram bot on aiogram?
import aiogram
from aiogram import Bot, types
from aiogram.dispatcher import Dispatcher
from aiogram.utils import executor
from config import token
bot = Bot(token=TOKEN)
dp = Dispatcher(bot)
@dp.message_handler(commands=['start'] )
async def process_start_command(message: types.Message):
await message.reply("Hello!\nWrite me something!")
@dp.message_handler(commands=['help'])
async def process_help_command(message: types. Message):
await message.reply("Write me something and I'll send this text back to you!")
@dp.message_handler(commands=['test'])
async def cmd_image(message: types.Message):
await message.answer_video(file_id)
if __name__ == '__main__':
executor.start_polling(dp)
Error : Traceback (most recent call last):
File "/data/user/0/en.iiec.pydroid3/files/accomp_files/ iiec_run/iiec_run.py", line 31, in
start(fakepyfile,mainpyfile)
File "/data/user/0/ru.iiec.pydroid3/files/accomp_files/iiec_run/iiec_run.py", line 30, in start
exec( open(mainpyfile).read(), __main__.__dict__)
File "", line 5, in
ImportError: cannot import name 'token' from 'config' (/storage/emulated/0/Download/python/config.py)
[ Program finished]
Answer the question
In order to leave comments, you need to log in
cannot import name 'token' from 'config'
(
/storage/emulated/0/Download/python/config.py )
bot = telebot.TeleBot('сюда токен своего бота')
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question