how do i mention a random member in this code?
@tree.command(name = 'tinder')
async def tinder(interaction: discord.Interaction):
users = interaction.guild.members
await interaction.response.send_message(f'{interaction.user.mention} deu match com {random.choice(users)} :flushed:')
"interaction.guild.members" only returns me the bot user
i'm using intents.member
intents = discord.Intents.all()
intents.members = True
take a random member of the server the command was written on, not all servers
enable intents.members from discord developer portal and then use intents.member . This normally happens if intent.members is not enabled.
intents = discord.Intents.default()
intents.members = True
bot = commands.Bot(command_prefix = "prefix", intents=intents)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.