“Commande Discord.py Unban” Réponses codées

Commande Discord.py Unban

@client.command()
async def unban(ctx, *, member):
	banned_users = await ctx.guild.bans()
	
	member_name, member_discriminator = member.split('#')
	for ban_entry in banned_users:
		user = ban_entry.user
		
		if (user.name, user.discriminator) == (member_name, member_discriminator):
 			await ctx.guild.unban(user)
 			await ctx.channel.send(f"Unbanned: {user.mention}")
Ioga Master

Commande Discord.py Unban

@client.command()
@commands.has_role(1234567890) # Role ID
@commands.cooldown(1,15, commands.BucketType.user)
async def unban(ctx, member:discord.User, *, reason=None):
    if reason == None:
        reason = f"No Reason Provided"
    await ctx.guild.unban(member, reason=reason)
    await ctx.send(f"{member.mention} has been **unbanned**", delete_after=15)
    embed = discord.Embed(title="Unban Log", description=f"{member.mention} has been **unbanned** by {ctx.author.mention}\n\nReason: `{reason}`\n\nUnbanned from: `{ctx.guild.name}`", color=0x1355ed)
    embed.add_field(name="User", value=f"{member}", inline=True)
    embed.add_field(name="UserID", value=f"{member.id}", inline=True)
    embed.add_field(name="Moderator", value=f"{ctx.author}", inline=True)
    embed.set_footer(text=f"Unban log - Banned user: {member.name}")
    embed.set_thumbnail(url=member.avatar_url)
    embed.timestamp = datetime.datetime.utcnow()
    logchannel = client.get_channel(988416086217203732)
    await logchannel.send(embed=embed)
    await ctx.message.delete()
    print(f"Sucsessfully unbanned {member.name}")
Da Minty

Commande Discord.py Unban

@client.command()
async def unban(ctx, *,member):
    banned_user = await ctx.guild.bans()

    member_name, member_discriminator = member.split('#')
    for ban_entry in banned_users:
        user = ban_entry.user

        if (user.name, user.discriminator) == (member_name, member_discriminator):
            await ctx.guild.unban(user)
            await ctx.send(f'Unbanned {user.mention}')
Worried Wasp

Réponses similaires à “Commande Discord.py Unban”

Questions similaires à “Commande Discord.py Unban”

Plus de réponses similaires à “Commande Discord.py Unban” dans Python

Parcourir les réponses de code populaires par langue

Parcourir d'autres langages de code