Answer the question
In order to leave comments, you need to log in
How to tag a random user?
It is necessary that the bot respond to the !who command with "I think it's him" and tag a random user.
I saw a similar question on Habré with the solution below, but in this case the bot only tags itself.
from random import choice
await ctx.send(choice(ctx.guild.members).mention)
Answer the question
In order to leave comments, you need to log in
The problem is most likely the missing intents of the members: https://discordpy.readthedocs.io/en/stable/intents...
Enable the required "intents" in the bot settings in the discord panel, and if you use discord.py>= 1.5.0, add an argument intents
to the constructor of the bot object, for example:
intents = discord.Intents()
intents.members = True
bot = commands.Bot(..., intents=intents)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question