lundi 23 novembre 2020

discord.py random member pick

@bot.command()
async def 이벤트뽑기(ctx, count=1):
author = ctx.message.author
#if not ctx.author.guild_permissions.manage_roles:
    #return await ctx.send(f'{author.mention}, 권한이 없으십니다. 지속적으로 사용시 밴 사유에 해당되므로 주의해주세요!')
guild = bot.get_guild(645894601961635841)
results = [ member for member in ctx.guild.members if not member.bot]
if count > len(results) or count <= 0:
    await ctx.send('꺼져')
    return
embed5 = discord.Embed(
    description=f"첫 번째 당첨자를 발표하겠습니다!",
    inline=True, color=0xfe8686) 
await ctx.send(embed=embed5)
member = random.choice(results)
results = []
role = ctx.guild.get_role(771397597935173652)
for member in guild.members:
    if role in member.roles:
        results.append(member.mention)
        embed6 = discord.Embed(description=f'**당첨자분들은 ! ANDY#1000 에게 디엠 부탁드립니다.**\n\n{", ".join(results)}/{member}님 **당첨** 축하드립니다!', color=0x86f4fe)
        embed6.set_thumbnail(url="https://cdn.discordapp.com/attachments/650916786111250432/773144216742002698/704862766770552883.png")
        await ctx.send(embed=embed6)
        break

So this is my code. I want to random member but i dont know how to do it

Help me plz i want to random it




Aucun commentaire:

Enregistrer un commentaire