我希望能够在特定的不一致频道中找到最早的消息,而不是绑定到不一致命令.
我试过使用discord机器人,但似乎它们主要是用来执行机器人命令的,所以我怎么能随时这样做呢?
我试过以下几种方法:
import discord
client = Client(intents=discord.Intents.all())
async def getfirstmessage():
channel = client.get_guild(guildid).get_channel(channelid)
messages = [message async for message in channel.history(limit=1, oldest_first=True)]
print(messages)
我收到了这样的错误:
RuntimeWarning: coroutine 'getfirstmessage' was never awaited getfirstmessage()
当我try 在‘getfirst stMessage’函数前面添加等待时,如果收到以下错误:
SyntaxError: 'await' outside function
先谢谢你.