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 update pandas 
Python :: pandas group by concat 
Python :: matplotlib remove ticks and lines 
Python :: between date pandas 
Python :: image to pdf python 
Python :: timedelta to float 
Python :: filter list with python 
Python :: python check if port in use 
Python :: python file open modes 
Python :: python get arguments 
Python :: how to migrate from sqlite to postgresql django 
Python :: python tts 
Python :: list images in directory python 
Python :: matplotlib grid in background 
Python :: python install libs 
Python :: python converting float to binary 
Python :: python pip install from script 
Python :: python add titles to subplots 
Python :: get all occurrence indices in list python 
Python :: get size of window tkinter 
Python :: matplotlib plot adjust margins 
Python :: knowing the sum of null value is pandas dataframe 
Python :: get video duration opencv python 
Python :: how to create chess board numpy 
Python :: import forms 
Python :: convert list of int to string python 
Python :: formula for compounding interest in python 
Python :: text adventure in python 
Python :: how to find where python is located 
Python :: show image jupyter notebook 
ADD CONTENT
Topic
Content
Source link
Name
3+3 =