import discord
class MyClient(discord.Client):
async def on_ready(self):
print('Logged on as', self.user)
async def on_message(self, message):
# don't respond to ourselves
if message.author == self.user:
return
if message.content == 'ping':
await message.channel.send('pong')
client = MyClient()
client.run('token')
#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)
@bot.command()
@has_permissions(administrator=True)
async def mute(ctx, member: nextcord.Member=None, time=None, *, reason="No reason specified"):
if member is None:
embed = nextcord.Embed(title="Command: !mute",
description=f"**Description:** Mute a member, optional reason
**Cooldown:** 3 Seconds",
color=0x2596be)
embed.add_field(name="Usage:", value=f"!mute [user] [time] (reason)", inline=False)
embed.add_field(name="Example", value=f"!mute bean 5m Squishing Small ants", inline=False)
await ctx.send(embed=embed)
if time is None:
embed = nextcord.Embed(title="Command: !mute",
description=f"**Description:** Mute a member, optional reason
**Cooldown:** 3 Seconds",
color=0x2596be)
embed.add_field(name="Usage:", value=f"!mute [user] [time] (reason)", inline=False)
embed.add_field(name="Example", value=f"!mute bean 5m Squishing Small ants", inline=False)
await ctx.send(embed=embed)
else:
desctime = time
guild = ctx.guild
mutedRole = nextcord.utils.get(guild.roles, name="Muted")
time_convert = {"s":1, "m":60, "h":3600, "d":86400, "w":604800, "mo":31536000}
tempmute = int(time[0]) * time_convert[time[-1]]
if not mutedRole:
embed = nextcord.Embed(title="Setup Muted Role", description="No Muted role was found, please create one!")
embed.set_footer(text="Due to issues I can't create one myself...")
await ctx.send(embed=embed)
else:
embed = nextcord.Embed(title="Muted", description=f"{member.mention} was muted for {desctime}")
embed.set_image(url="https://c.tenor.com/l1yJ91orR_kAAAAd/yt-battles-youre-muted.gif")
embed.add_field(name="Reason", value=reason, inline=False)
await ctx.send(embed=embed)
embed = nextcord.Embed(title="Muted", description=f"You were muted in {ctx.guild.name} for {desctime}")
embed.add_field(name="Reason", value=reason)
embed.set_image(url="https://c.tenor.com/l1yJ91orR_kAAAAd/yt-battles-youre-muted.gif")
embed.add_field(name="Times", value="s = seconds
m = minutes
h = hours
d = days
w = weeks
mo = months")
await member.send(embed=embed)
await member.add_roles(mutedRole, reason=reason)
await asyncio.sleep(tempmute)
embed = nextcord.Embed(title="Unmuted", description=f"You were unmuted in {ctx.guild.name}")
await member.send(embed=embed)
embed = nextcord.Embed(title="Unmuted", description=f"Unmuted {member.mention}")
await ctx.send(embed=embed)
await member.remove_roles(mutedRole)
@bot.command()
@has_permissions(administrator=True)
async def unmute(ctx, member: nextcord.Member):
mutedRole = nextcord.utils.get(member.roles, name="Muted")
if not mutedRole:
embed = nextcord.Embed(title="Can't unmute", description="This user is not muted!")
embed.set_footer(text="Did you mean !mute?")
await ctx.send(embed=embed)
else:
embed = nextcord.Embed(title="Unmuted", description=f"You were unmuted in {ctx.guild.name}")
await member.send(embed=embed)
embed = nextcord.Embed(title="Unmuted", description=f"Unmuted {member.mention}")
await ctx.send(embed=embed)
await member.remove_roles(mutedRole)