Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

/start doesn't work #1452

Open
2 tasks done
sevocrear opened this issue Apr 6, 2024 · 5 comments
Open
2 tasks done

/start doesn't work #1452

sevocrear opened this issue Apr 6, 2024 · 5 comments
Labels
needs triage This issue is not yet confirmed waiting for reply Further information is requested

Comments

@sevocrear
Copy link

Checklist

  • I am sure the error is coming from aiogram code
  • I have searched in the issue tracker for similar bug reports, including closed ones

Operating system

Ubuntu 22.4

Python version

3.8

aiogram version

2.21

Expected behavior

Bots responds

Current behavior

/start doesn't work for the bot I made with aiogram. But for all other users it works perfectly. What could be a problem?

Steps to reproduce

  1. Open bot @WishShareBot
  2. Type /start
  3. It works (but not for me @sevocrear

Code example

No response

Logs

No logs from bot as it doesn't respond to my account

Additional information

No response

@sevocrear sevocrear added the bug Something is wrong with the framework label Apr 6, 2024
@sevocrear
Copy link
Author

sevocrear commented Apr 7, 2024

As I figured out, it doesn't get messages from second account. But if I turn my script off, getUpdate (https://api.telegram.org/bot'token'/getUpdates) get all the messages I send to the bot:

{"ok":true,"result":[{"update_id":967979408, "message":{"message_id":143,"from":{"id":489327708,"is_bot":false,"first_name":"Ilia","last_name":"Sevostianov","username":"sevocrear","language_code":"ru","is_premium":true},"chat":{"id":489327708,"first_name":"Ilia","last_name":"Sevostianov","username":"sevocrear","type":"private"},"date":1712478116,"text":"For"}}]}

@Olegt0rr
Copy link
Contributor

Olegt0rr commented Apr 7, 2024

Looks like a non-aiogram issue. Debug your application or send minimal reproducible example

@Olegt0rr Olegt0rr added waiting for reply Further information is requested needs triage This issue is not yet confirmed and removed bug Something is wrong with the framework labels Apr 7, 2024
@Petrprogs
Copy link

Have some problem now. Bot can send messages, but not handling any commands

@Olegt0rr
Copy link
Contributor

Olegt0rr commented Apr 9, 2024

Have some problem now. Bot can send messages, but not handling any commands

@Petrprogs, still need minimal reproducible example

@Petrprogs
Copy link

Have some problem now. Bot can send messages, but not handling any commands

@Petrprogs, still need minimal reproducible example

This was problem in my code:

import asyncio
from aiogram import Bot, Dispatcher, types, F
from aiogram.filters import Command

bot = Bot(token=TG_TOKEN)
dp = Dispatcher()

@dp.message(Command("start"))
async def send_welcome(msg):
    await msg.reply("Hi there!")

async def main_loop():
    while True:
          print("Some infinty loop")
          await asyncio.sleep(10)

asyncio.run(main_loop())
asyncio.run(dp.start_polling(bot)) # This won't run, because main_loop() has infinity while loop

To solve this a just moved dp.start_polling(bot) to main_loop() like this:

import asyncio
from aiogram import Bot, Dispatcher, types, F
from aiogram.filters import Command

bot = Bot(token=TG_TOKEN)
dp = Dispatcher()

@dp.message(Command("start"))
async def send_welcome(msg):
    await msg.reply("Hi there!")

async def main_loop():
    asyncio.create_task(dp.start_polling(bot))
    while True:
          print("Some infinty loop")
          await asyncio.sleep(10)

asyncio.run(main_loop())

Sorry for my weird code :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs triage This issue is not yet confirmed waiting for reply Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants