这是代码,不确定我做错了什么,但我得到了这个错误
回溯(最近一次调用):文件“main.py”,第23行,在@client.commands()typeerror中:“set”对象不可调用
import discord
import random
import os
from discord.ext import commands
my_secret = os.environ['Token']
client = commands.Bot(command_prefix = '?')
@client.event
async def on_ready():
print('Bot is ready.')
@client.command()
async def kick(ctx, member : discord.Member, *, reason=None):
await member.kick(reason=reason)
@client.command()
async def ban(ctx, member : discord.Member, *, reason=None):
await member.ban(reason=reason)
await ctx.send(f'Banned {member.mention}')
@client.commands()
async def unban(ctx, *, member):
banned_users = await ctx.guild.bans()
member_name, member_discriminator = member.split('#')
for ban_entry in banned_users:
user = ban_entry.user
if (user.name, user.discriminator) == (member_name, member_discriminator):
await ctx.guild.unban(user)
await ctx.send(f'Unbanned {user.mention}')
return
client.run(os.environ['Token'])
1条答案
按热度按时间deyfvvtc1#
这本书似乎有错
应该是