在 4. 和 5. 行我需要帮助。它不发送嵌入。
@Bot.command()
@has_permissions(ban_members=True)
async def ban(ctx, member : discord.Member=None, reason=None):
if member == None or member == ctx.message.author:
embed1 = discord.Embed(title="ERROR:", description="You can not ban yourself.", color=0x00ff00)
await ctx.send(embed=embed1)
return
if reason == None:
reason = 'Nothing.'
await ctx.guild.ban(member, reason=reason)
await ctx.channel.send(f"{ctx.message.author} banned {member} from server. Reason:{reason}")```
答案 0 :(得分:1)
await ctx.guild.ban(member, reason=reason)
期望被禁止的用户,而不是成员。 试试
await member.ban(reason=reason)
喜欢记录的here。
@Bot.command()
@has_permissions(ban_members=True)
async def ban(ctx, member : discord.Member=None, reason=None):
if member == None or member == ctx.message.author:
embed1 = discord.Embed(title="ERROR:", description="You can not ban yourself.", color=0x00ff00)
await ctx.send(embed=embed1)
return
if reason == None:
reason = 'Nothing.'
await member.ban(reason=reason)
await ctx.channel.send(f"{ctx.message.author} banned {member} from server. Reason:{reason}")