Skip to content
Advertisement

How can I send a message to a user out of a JSON file?

Probably a very easy question to answer, but I want to send a message to a user after a certain time. For this I read his ID from a JSON. Problem with this? You cannot append a send to a str or this error is then spit out.

I have already tried to convert the whole thing, but without success. Can someone give me a hint here?

The code:

JavaScript

The JSON:

JavaScript

The error message:

JavaScript

Advertisement

Answer

It looks like you are using disnake instead of discord.py.

You can have a look at their docs. Here we learn something about fetch_user, get_user or getch_user which will first check the cache and then fetch the user if needed.

In your example, you can use the following:

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