【发布时间】:2020-05-27 08:26:22
【问题描述】:
如何让机器人再次响应?我试图让机器人让用户响应正在发送的消息,然后回复说是否为时已晚或他们做到了。
import discord
from discord.ext import commands
import time
import random
@commands.command(aliases=["RandomChocolate", "choco"])
@commands.cooldown(1, 15, commands.BucketType.user)
async def chocolate(self, ctx):
food=["hershey", "kitkat", "milk"]
rF = random.choice(food)
rFC = rF[:1]
rFL = rF[-1]
await ctx.send(f"**Hint:** It starts with **{rFC}**
and ends with **{rFL}**, you have 15 seconds to answer
by the way.")
if ctx.message.content == rF:
await ctx.send("Ok")
else:
time.sleep(15)
await ctx.send(f"Too Late!")
【问题讨论】:
标签: python discord discord.py