Giter Club home page Giter Club logo

Comments (5)

Olegt0rr avatar Olegt0rr commented on June 2, 2024 1

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

from aiogram.

sevocrear avatar sevocrear commented on June 2, 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"}}]}

from aiogram.

Petrprogs avatar Petrprogs commented on June 2, 2024

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

from aiogram.

Olegt0rr avatar Olegt0rr commented on June 2, 2024

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

@Petrprogs, still need minimal reproducible example

from aiogram.

Petrprogs avatar Petrprogs commented on June 2, 2024

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 :)

from aiogram.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.