Congo
Congo

Reputation: 1

How to tag a random user on a Discord server

I'm trying to make a bot that tags a random user with a string after running a command, but the bot keeps tagging itself every time the command is run.

@client.command(aliases=['idea'])
async def idea(ctx):
    idea = ['idea1', 'idea2', 'idea3']
    usr = random.choice(ctx.channel.guild.members)
    await ctx.send(random.choice(idea) + ' a ' + str(usr.mention))

Upvotes: 0

Views: 482

Answers (1)

unex
unex

Reputation: 1356

If you are running discord.py v1.5, please see this documentation page on how to enable Privileged Intents for your bot. This is a recent change that would explain why your bot cannot see any users other than itself.

Upvotes: 1

Related Questions