Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

discord.py unban command

@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}")
Comment

unban discord.py

@client.command()
@commands.has_permissions(ban_members=True)
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.send(f'Unbanned {user.mention}')
            return
Comment

PREVIOUS NEXT
Code Example
Python :: how to randomise a string in python 
Python :: how to comment in python 
Python :: save python plot 
Python :: pdf to jpg 
Python :: read file bytes python 
Python :: print list vertically python 
Python :: django messages framework 
Python :: docker python 3.11 
Python :: python sort array by key 
Python :: linux python virtual environment 
Python :: whatsapp bot python code 
Python :: pygame buttons 
Python :: correlation matrix in python 
Python :: python array use numpy arange 
Python :: rotate 2 dimensional list python 
Python :: python 3d software 
Python :: python docstring use 
Python :: what is python 
Python :: pandas columns 
Python :: slider python 
Python :: np minimum of array 
Python :: how to reverse string in python 
Python :: how to run a python package from command line 
Python :: Pass a variable to dplyr "rename" to change columnname 
Python :: python else syntax 
Python :: text to speech module python 
Python :: jquery datepicker disable 
Python :: api key python 
Python :: python launch prompt 
Python :: 2d array python initialize 
ADD CONTENT
Topic
Content
Source link
Name
5+4 =