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 :: get IP address python 
Python :: gdscript string format 
Python :: python install pylab 
Python :: current datetime pandas 
Python :: python read file to variable 
Python :: extract domain name from url python 
Python :: get current site django 
Python :: how to import pygame onto python 
Python :: get screen size python 
Python :: how to export a string as txt file in python 
Python :: python list of all states 
Python :: 8 ball responses list python 
Python :: loop through list backwards python 
Python :: python check file extension 
Python :: export image python 
Python :: python reload class 
Python :: how to sort by length python 
Python :: unzip file python 
Python :: base64 encode python 
Python :: python windows hide files 
Python :: executable_path has been deprecated, please pass in a Service object driver = webdriver.Chrome(ChromeDriverManager().install()) 
Python :: how to identify GPU with pytorch script 
Python :: read csv as list python 
Python :: shuffle dataframe python 
Python :: how to calculate rmse in linear regression python 
Python :: ndarray to pil image 
Python :: how to remove text in brackets of python 
Python :: time start python 
Python :: tkinter entry default value 
Python :: inspectdb django 
ADD CONTENT
Topic
Content
Source link
Name
8+2 =