usernein / pyromod

A monkeypatcher add-on for Pyrogram
https://pyromod.pauxis.dev/
GNU Lesser General Public License v3.0
223 stars 70 forks source link

Problem with pyromod #46

Closed ohAndre closed 10 months ago

ohAndre commented 10 months ago
import pyromod
from pyromod.exceptions import ListenerTimeout
from pyromod import Client

from pyrogram import Client, filters
from pyrogram.types import InlineKeyboardMarkup, InlineKeyboardButton, CallbackQuery
import json, configparser, random

from Andre.buttons import buttons
from Andre.filters import database
from main import Andre

app = Andre
prefixes = app.ALIAS

app1 = True

@app.on_message(filters.command("test", prefixes=prefixes))
async def applications(client, message):
    global app1

    if app1 == True:
        username  = client.ask(chat_id=message.chat_id, text='username:')
        app1 = False

    elif app1 == False:
        await client.send_message(message.chat.id, text=f"{username}")

Hello, this is my code. When i do the command /test it says me this in console:

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/dist-packages/pyrogram/dispatcher.py", line 226, in handler_worker
    if await handler.check(self.client, parsed_update):
  File "/usr/local/lib/python3.9/dist-packages/pyromod/listen/message_handler.py", line 58, in check
    await self.check_if_has_matching_listener(client, message)
  File "/usr/local/lib/python3.9/dist-packages/pyromod/listen/message_handler.py", line 37, in check_if_has_matching_listener
    listener = client.get_listener_matching_with_data(data, ListenerTypes.MESSAGE)
  File "/usr/local/lib/python3.9/dist-packages/pyrogram/sync.py", line 53, in async_to_sync_wrap
    coroutine = function(*args, **kwargs)
  File "/usr/local/lib/python3.9/dist-packages/pyromod/listen/client.py", line 123, in get_listener_matching_with_data
    for listener in self.listeners[listener_type]:
AttributeError: 'Client' object has no attribute 'listeners'