【发布时间】:2021-07-16 17:31:19
【问题描述】:
所以我目前正在尝试制作一个监视频道的命令,如果在最后 x 分钟内没有发送任何消息,它将发送一条消息
我的代码是:
@client.command()
async def watch(ctx, time : int):
channel = ctx.channel
async for message in channel.history(limit = 1):
past_message = message.created_at
await asyncio.sleep(time)
async for message in channel.history(limit = 1):
new_message = message.created_at
if past_message == new_message:
if not new_message:
channel = client.get_channel(816741369682985012)
await channel.send("<@400349192125415436> bot is down")
我从 this post 但是这个命令只会在我使用命令后没有发送消息的情况下向我发送消息,如果有任何消息命令将停止或在发送警告消息后命令停止观看,我想做所以它一直在看频道
【问题讨论】:
标签: python discord discord.py