Skip to content
Advertisement

(discord.py) Get user’s, last message from a JSON file without specifying the name/id

I have an users.json file which store the user’s id and lmessage (current date,time) if he is write in a room.

JavaScript

How can I get all of these IDs and the lmessages which belongs to that ID without specify username or anything?

Currently I can get the user’s lmessage with a command if I specify the username:

JavaScript

Advertisement

Answer

If I understand your question correctly, you just want to iterate through all of the key-value pairs in the JSON data. If so, you can use the various dictionary methods available:

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement