'return values from discord async function
how can I return the results from the awiat discord function, if I return a result I get none (print(bot.run....)
bot = discord.Client()
@bot.event
async def on_ready():
results = []
for guild in bot.guilds:
if str(guild) == "guild":
for channel in guild.text_channels:
if str(channel) == "channel":
async for message in channel.history(limit=100):
pass
mapped_message = map_message(message)
results.append(mapped_message)
time.sleep(1)
await bot.close()
return resuslst <----------------- return None
def discord():
print(bot.run('TOKEN', bot=False)) <----------------- return None
discord()
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
