the below script connects to discord, and then disconnects again.
that works perfectly and prints out these two items:
**** Logged in!
**** End
But when the script ends, I get this additional warning:
Unclosed connector
connections:
['[(,
3702249.404694462)]']
connector:
I tried many ways but have not figured out how to et around this; any pointers are welcome. Of course I could simply ignore it, but I'd prefer to handle this "graciously"
Код: Выделить всё
import discord
import asyncio
# Suppress login messages from discord
import logging
logging.getLogger("discord.client").setLevel(logging.WARNING)
logging.getLogger("discord.gateway").setLevel(logging.WARNING)
intents = discord.Intents.default()
client = discord.Client(intents=intents)
@client.event
async def on_ready():
print('**** Logged in!')
await client.close()
# Starts the script:
DISCORD_BOT_TOKEN = 'xxx'
if __name__ == '__main__':
client.run(DISCORD_BOT_TOKEN)
print('**** End')
Источник: https://stackoverflow.com/questions/781 ... onnections