【发布时间】:2018-11-25 12:36:13
【问题描述】:
在 Discord 中,发送消息有 2000 个字符的限制,因此我们需要拆分并发送多条消息。我使用下面的代码,它可以工作,但是消息没有按指定的顺序发送,所以我在每条消息之后都使用了sleep()。现在它可以工作了,但有时消息仍然不符合顺序。由于顺序混乱,阅读长消息时会变得混乱。
@bot.command(pass_context=True)
async def ping(ctx):
msg = "Message 1".format(ctx.message)
await bot.say(msg)
await sleep(.5)
msg = "Message 2".format(ctx.message)
await bot.say(msg)
await sleep(.5)
msg = "Message 3".format(ctx.message)
await bot.say(msg)
await sleep(.5)
msg = "Message 4 {0.author.mention}".format(ctx.message)
await bot.say(msg)
我需要在每条消息之后检查发送的消息,然后它应该在最后一条消息之后发送第二条消息。或者有没有其他解决方案来解决这个问题?
【问题讨论】:
标签: python python-3.x discord discord.py