I'm using a JSON file to store the number of warnings a user has. When a user is warned, I want to increase the number of warnings.
This is the JSON sample I use :
{
"users": {
"976797937789198397" : "1",
"270904126974590976" : "2",
"871490226692976791" : "1"
} }
This is the code I use to fetch the number of warnings a user has, and this works without any errors. I just need a way to find out how to add +1 to a user every time they are warned.
@commands.command()
async def getWarns(self, ctx : commands.Context, member : discord.Member):
with open('warns.json') as f:
data = json.load(f)
await ctx.send(data["users"][f"{member.id}"])