my code is this but output is terrible
import os
import discord
import asyncio
from discord.ext import tasks, commands
client = discord.Client()
@client.event
async def on_ready():
print(f'Connected to Discord!')
channel = client.get_channel(231231321213)
messages = await channel.history(limit=1).flatten()
print(messages)
client.run('token', bot=False)
My Output:
Connected to Discord! [<Message id=826111938424864848 channel= type=<MessageType.default: 0> author= flags=>] Traceback (most recent call last):
File "C:\Users\cinar\untitled0.py", line 18, in client.run('Bot Token', bot=False)
File "D:\Users\cinar\anaconda3\lib\site-packages\discord\client.py", line 714, in run _cleanup_loop(loop)
File "D:\Users\cinar\anaconda3\lib\site-packages\discord\client.py", line 95, in _cleanup_loop loop.close()
File "D:\Users\cinar\anaconda3\lib\asyncio\selector_events.py", line 89, in close raise RuntimeError("Cannot close a running event loop")
RuntimeError: Cannot close a running event loop
history()
yieldingMessage
not string, maybe trymessage.content
? Also, I just realize, why do you needbot = False
? Like, are you trying to self bot? – hard lander