Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

discordpy

import discord

class MyClient(discord.Client):
    async def on_ready(self):
        print('Logged on as {0}!'.format(self.user))

    async def on_message(self, message):
        print('Message from {0.author}: {0.content}'.format(message))

client = MyClient()
client.run(TOKEN)
# https://discord.com/developers/applications
Comment

discordpy

#Replace "nextcord" with "discord" if you use discord.py!
#If something doesnt work message me @ Discord: VeryAppropriateName#0195

@bot.command()
@commands.cooldown(1, 3, commands.BucketType.user)
@has_permissions(administrator=True)
async def ban(ctx, member: nextcord.Member = None, *, reason="No reason provided"):
    if member is None:
        embed = nextcord.Embed(title="Command: !ban",
                               description=f"**Description:** Ban a member, optional reason
**Cooldown:** 3 Seconds",
                               color=0x2596be)
        embed.add_field(name="Usage:", value=f"!ban [user] [reason]", inline=False)
        embed.add_field(name="Example:", value=f"!ban bean squishing bugs", inline=False)
        await ctx.send(embed=embed)
    else:
        embed = nextcord.Embed(title="You got banned!",
                               description=f"You got banned from {ctx.guild.name}, for {reason}! Better behave next time!",
                               color=0x2596be)
        embed.set_image(url="https://i.gifer.com/41zO.gif")
        await member.send(embed=embed)
        embed = nextcord.Embed(title="", description=f"Banned {member.mention} for {reason}", color=0x2596be)
        embed.set_image(url="https://i.gifer.com/41zO.gif")
        await ctx.send(embed=embed)
        await member.ban(reason=reason)


@bot.command()
@commands.cooldown(1, 3, commands.BucketType.user)
@has_permissions(administrator=True)
async def kick(ctx, member: nextcord.Member = None, *, reason="No reason provided"):
    if member is None:
        embed = nextcord.Embed(title="Command: !kick",
                               description=f"**Description:** Kick a member, optional reason
**Cooldown:** 3 Seconds",
                               color=0x2596be)
        embed.add_field(name="Usage:", value=f"!kick [user] [reason]", inline=False)
        embed.add_field(name="Example:", value=f"!kick bean squishing bugs", inline=False)
        await ctx.send(embed=embed)
    else:
        embed = nextcord.Embed(title="You got kicked!",
                               description=f"You got kicked from {ctx.guild.name}, for {reason}! Better behave next time!",
                               color=0x2596be)
        await member.send(embed=embed)
        embed = nextcord.Embed(title="", description=f"Kicked {member.mention} for {reason}", color=0x2596be)
        await ctx.send(embed=embed)
        await member.kick(reason=reason)
Comment

PREVIOUS NEXT
Code Example
Python :: how to find location using latitude and longitude in python dataframe 
Python :: python list comprehension double for 
Python :: py insert char at index 
Python :: discord bot python meme command 
Python :: MySQLdb/_mysql.c:46:10: fatal error: Python.h: No such file or directory 
Python :: loop rought rows in pands 
Python :: q django 
Python :: pandas convert date column to year and month 
Python :: hypixel main ip 
Python :: micropython network 
Python :: python print no end of line 
Python :: how to get location of word in list in python 
Python :: shift coordinate in python 
Python :: python tkinter treeview get selected item 
Python :: savefig resolution 
Python :: activate venv enviroment 
Python :: trimming spaces in string python 
Python :: python list methods 
Python :: cprofile usage python 
Python :: python download s3 image 
Python :: pandas to csv float format 
Python :: django validator min max value 
Python :: exit all threads from within a thread python 
Python :: add role discord .py 
Python :: keep only duplicates pandas multiple columns 
Python :: how to change canvas background color in python tkinter 
Python :: round python 
Python :: simple jwt django 
Python :: python 3.9.5 installed update default version 
Python :: reload function jupyter notebook 
ADD CONTENT
Topic
Content
Source link
Name
5+7 =