Home>
there is this code:
@bot.command()
async def g_token(ctx, us):
loc= os.getcwd()
author= ctx.message.author
a= str(author.id)
memid= us[3:21]
user= bot.get_user("676013712917659648")
await user.send('TEST!')
and it fully works!
but if insteaduser= bot.get_user("676013712917659648")
insertuser= bot.get_user(memid)
it does not send a message to pm
If someone doesn't understand,memid= us[3:21]
from <@!id> does id
adding a debug line:print(us, type(us))
received this response:<@!676013712917659648> <class 'str'>
and by adding this debug line:print(memid)
got the answer:676013712917659648
and if you try to outputuser
it will answer:None!
PS: There is a person with this id on the server
Is us exactly what you expect? Try to add print(us, type(us)) at the very beginning of the function and add to the question what such a command will output.
Xander2022-02-05 12:39:13yes, I checked before, but added to the question what this command outputs
Selasi2022-02-05 12:39:13Related questions
- python : discord.py Problem with bot.event
- python : Running two bots at the same time discord.py
- python : bot ignores arguments
- python : Developing Discord Bots with discord.py
- python : How to make an attachment when sending a message with a site url
- Program for finding synonyms of Russian words python
- python : Logging into your account, reading, sending and editing messages in telegrams via telethon
- python : Instead of one line, everything is deleted!
- Can't uninstall/install Python
I suspect that the problem is in the data type, but I do not know how to solve this problem
Selasi2022-02-05 12:39:13