I'm trying to make a warning system in discord bot, but before it I trying to make RAW code of it. The structure I already know, but when it goes to JSON file I don't know more The part that I confused is at here
checkname = any(d['USER ID'] == id_card for d in json_load['user_id'])
if checkname == True:
print(json_load['user_id']['WARN STATUS'])
if checkname == False:
write_json(dump_data)
And this is my JSON file
{
"guild_configuration": {
"guild_ids": [
11111111111111
],
"token": "SENSOR"
},
"user_id": [
{
"USER ID": "385053392059236353",
"USERNAME": "MorpKnight",
"WARN STATUS": "Unwarned",
"WARNING": 0
},
{
"USER ID": "128418907681764",
"USERNAM": "TESTING",
"WARN STATUS": "WARNED",
"WARNING": 1
}
]
}
I firstly I know I need to check the USER ID is the person that I warned or no. Then I need to check about "WARNING" and "WARN STATUS" but I don't know how? Any idea?