Buongiorno, sto creando un bot in python per amministrare il mio ruppo, e sto testando una tecnologia per listare tutti gli utenti presenti attraverso una funzione, che sfortunatamente mi ritorna questi errori:
task: <Task pending name='Task-6' coro=<MTProtoSender._recv_loop() running at /home/elias/.local/lib/python3.8/site-packages/telethon/network/mtprotosender.py:503> wait_for=<Future pending cb=[<TaskWakeupMethWrapper object at 0x7fa358e7f040>()]>>
Task was destroyed but it is pending!
task: <Task pending name='Task-3' coro=<Connection._send_loop() running at /home/elias/.local/lib/python3.8/site-packages/telethon/network/connection/connection.py:306> wait_for=<Future pending cb=[<TaskWakeupMethWrapper object at 0x7fa358e6adf0>()]>>
Task was destroyed but it is pending!
task: <Task pending name='Task-4' coro=<Connection._recv_loop() running at /home/elias/.local/lib/python3.8/site-packages/telethon/network/connection/connection.py:324> wait_for=<Future pending cb=[<TaskWakeupMethWrapper object at 0x7fa358e6aee0>()]>>[/CODE]
allego qui sotto il codice nella speranza che qualcuno mi risponda presto dato che il bot mi serve tra poche ore. Ringrazio anticipamente per le risposte.
Codice:
Traceback (most recent call last):
File "bot.py", line 58, in <module>
main()
File "bot.py", line 46, in main
client.start()
File "/home/elias/.local/lib/python3.8/site-packages/telethon/client/auth.py", line 133, in start
else self.loop.run_until_complete(coro)
File "/usr/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
return future.result()
[CODE=python]import con as keys
import asyncio
from telegram.ext import *
import responses as r
from telethon import TelegramClient
from telethon.errors import SessionPasswordNeededError
from telethon.tl.functions.channels import GetParticipantsRequest
from telethon.tl.types import ChannelParticipantsSearch
from telethon.tl.types import (
PeerChannel
)
import pyrogram
print("Iniziamo...")
def start_command(update, context):
update.message.reply_text("INIZIALIZZAZIONE....")
def help_command(update, context):
update.message.reply_text("Se hai bisogno di aiuto, chiedi a un Admin!")
def handle_message(update, context):
text = str(update.message.text).lower()
response = r.sample_responses(text)
update.message.reply_text(response)
def error(update, context):
print(f"update {update} ha causato un errore {context.error}")
def pyro_command(update, context):
channels = {d.entity.user: d.entity for d in client.get_dialogs() if d.is_channel}
channel = channels['nome del canale']
all_participants = []
all_participants = client.get_participants(channel, aggressive=True)
pat = all_participants
for user in pat:
print(user)
def main():
phone = 'numero'
api_id = 'dati personali'
api_hash = 'dati personali'
client = TelegramClient(phone,api_id,api_hash)
client.start()
updater = Updater(keys.API_KEY, use_context = True)
dp = updater.dispatcher
dp.add_handler(CommandHandler("start", start_command))
dp.add_handler(CommandHandler("help", help_command))
dp.add_handler(MessageHandler(Filters.text, handle_message))
dp.add_error_handler(error)
updater.start_polling()
updater.idle()
main()
Task was destroyed but it is pending!
task: <Task pending name='Task-3' coro=<Connection._send_loop() running at /home/elias/.local/lib/python3.8/site-packages/telethon/network/connection/connection.py:306> wait_for=<Future pending cb=[<TaskWakeupMethWrapper object at 0x7fa358e6adf0>()]>>
Task was destroyed but it is pending!
task: <Task pending name='Task-4' coro=<Connection._recv_loop() running at /home/elias/.local/lib/python3.8/site-packages/telethon/network/connection/connection.py:324> wait_for=<Future pending cb=[<TaskWakeupMethWrapper object at 0x7fa358e6aee0>()]>>[/CODE]
allego qui sotto il codice nella speranza che qualcuno mi risponda presto dato che il bot mi serve tra poche ore. Ringrazio anticipamente per le risposte.