Answer the question
In order to leave comments, you need to log in
Error with the "start" command in the telegram bot?
Start command script:
@dp.message_handler(commands=['start'])
async def start_command(message: types.Message):
with open('pol.txt') as file:
contents = file.read()
search_word = message.from_user.username
if search_word in contents:
pass
else:
file = open("pol.txt", "a")
<b> file.write(message.from_user.username + ';' + message.from_user.id + '\n')</b>
file.close()
await bot.send_message(chat_id=message.chat.id, text=' Привет, я помогу тебе скачать видео с TikTok. \n/help - инструкция как скачать видео.\n \n Поддержать проект - qiwi.com/n/XACER\n Магазин - @eze_pokupka3_bot')
Task exception was never retrieved
future: <Task finished name='Task-9' coro=<Dispatcher._process_polling_updates() done, defined at /usr/local/lib/python3.9/dist-packages/aiogram/dispatcher/dispatcher.py:409> exception=TypeError('can only concatenate str (not "int") to str')>
Traceback (most recent call last):
File "/usr/local/lib/python3.9/dist-packages/aiogram/dispatcher/dispatcher.py", line 417, in _process_polling_updates
for responses in itertools.chain.from_iterable(await self.process_updates(updates, fast)):
File "/usr/local/lib/python3.9/dist-packages/aiogram/dispatcher/dispatcher.py", line 238, in process_updates
return await asyncio.gather(*tasks)
File "/usr/local/lib/python3.9/dist-packages/aiogram/dispatcher/handler.py", line 116, in notify
response = await handler_obj.handler(*args, **partial_data)
File "/usr/local/lib/python3.9/dist-packages/aiogram/dispatcher/dispatcher.py", line 259, in process_update
return await self.message_handlers.notify(update.message)
File "/usr/local/lib/python3.9/dist-packages/aiogram/dispatcher/handler.py", line 116, in notify
response = await handler_obj.handler(*args, **partial_data)
File "/root/TT2/main.py", line 38, in start_command
file.write(message.from_user.username + ';' + message.from_user.id + '\n')
TypeError: can only concatenate str (not "int") to str
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question