Python白名单命令



应用程序命令引发异常:

AttributeError: 'dict' object has no attribute 'read'

我还想补充一点,如果成员的webhook和公会id在config.ini中,它应该说这个成员已经在白名单中了

@bot.slash_command(name="add", description="whitelist")
@commands.has_permissions(administrator=True)
async def whitelist(ctx, guildid: discord.Option(str, "guildid", required = True), webhook: discord.Option(str, "webhook", required = True), member: discord.Option(str, "addmember", required = True)):
user = ctx.author
config.read('config.ini')
config.set('hooks', str(user), webhook)
with open('config.ini', 'w') as f:
config.write(f)
await ctx.respond(f"Added <@{user}> to whitelist!")
print(f"Added {member} to the whitelist!")

最新更新