BlackList Json discord.py

Asked by At

i want to make a blacklist system for my discord.py bot in async... i want to use a json rather then a database im just really confused atm

@client.command()
async def blacklist(ctx, member: discord.Member = None):
    with open('blacklist.json', 'r')as f:
        users = json.load(f)
        if user.id in users:
            await client.say("already blacklisted")
        else:
            with open('blacklist.json', 'w')as f:
                json.dump(users, f)
                if not user.id in users:
                    users[user.id] = {}
                await client.say(f"done!! {member.name} has been blacklisted")```

0 Answers