gpt4 book ai didi

discord.py - 如何制作验证禁止命令?

转载 作者:行者123 更新时间:2023-12-05 04:50:59 27 4
gpt4 key购买 nike

是的,我想做到这一点,所以当我执行“/ban @user reason”时,bot 会嵌入一个响应,说你确定要禁止这个用户吗,并用勾号对其消息使用react,并等待做出禁令的人的 react 。

最佳答案

试试这个:

@bot.command(name="ban")
async def ban(ctx, member, reason=""):
if not ctx.message.mentions:
await ctx.channel.send("You must mention a user to use this command")
embed = discord.Embed(
title="Confirm ban",
description=f"Are you sure you want to ban {member.mention}",
color=0xff0000
)
message = await ctx.channel.send(embed=embed)
await message.add_reaction(u"\U0001F44D")

def check(pay):
pay.member == member and pay.message_id == ctx.message.id

await bot.wait_for("raw_reaction_add", check=check)
await member.ban(reason=reason)

关于discord.py - 如何制作验证禁止命令?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67092031/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com