Mayuri-Chan / pyrofork

Pyrogram fork with Adjustable web page preview, Quote Reply, Story & Topics Support, Mongodb session storage, and much more. go to https://pyrofork.wulan17.top/ for documentation.
https://pyrofork.wulan17.top
GNU Lesser General Public License v3.0
162 stars 78 forks source link

The bot does not call message handlers #58

Open R1senDev opened 8 months ago

R1senDev commented 8 months ago

Checklist

Description

Nothing happens when sending a message to the bot in the example below.

Steps to reproduce

  1. Try to write an echo bot;
  2. ..enjoy.

Code example

from pyrogram.filters import text
from pyrogram.client  import Client
from tomllib          import load

with open('auth.toml', 'rb') as file: auth_data = load(file)

app = Client(
    name      = auth_data['api']['name'],
    api_id    = auth_data['api']['id'],
    api_hash  = auth_data['api']['hash'],
    bot_token = auth_data['api']['token']
)

@app.on_message()
async def on_text(_, msg):
    print(msg.text)
    await app.send_message(
        chat_id = msg.chat.id,
        text = 'Ping!'
    )

print('Starting..')
app.run()

Logs

Starting..