Skip to content

Instantly share code, notes, and snippets.

@AxizY
Last active November 30, 2022 15:11
Show Gist options
  • Save AxizY/f61141bdfc626437920429e06a054eb8 to your computer and use it in GitHub Desktop.
Save AxizY/f61141bdfc626437920429e06a054eb8 to your computer and use it in GitHub Desktop.
import discord
from discord.ext import commands
import asyncio
import random
client = commands.Bot(command_prefix = '/')
client.remove_command('help')
@client.event
async def on_ready():
print("The bot is ready")
await client.change_presence(activity=discord.Game(name='Prefix is /'))
@client.command()
@commands.has_permissions(administrator=True)
async def help(ctx):
cmds = discord.Embed(
title = "Commands",
description = "A list of all commands and their functions",
color = discord.Color.blue()
)
cmds.add_field(name='Clear', value='/clear [num]', inline=False)
cmds.add_field(name="WordClear", value="/wordclear [Num] [specific word]", inline=False)
cmds.add_field(name="Userclear", value="/userclear [Num] [@Member]", inline=False)
cmds.add_field(name="Userinfo", value="/userinfo [@Member]", inline=False)
cmds.add_field(name="Coinflip", value="/coinflip", inline=False)
cmds.add_field(name="Ping", value="/ping", inline=False)
await ctx.send(embed=cmds)
@client.command()
@commands.has_permissions(administrator=True)
async def clear(gone, amount = 2):
await gone.channel.purge(limit=amount)
@client.command()
@commands.has_permissions(administrator=True)
async def wordclear(ctx, amount, specific):
await ctx.message.delete()
messages = await ctx.channel.history(limit=int(amount)).flatten()
for message in messages:
if specific in message.content.lower(): await message.delete()
@client.command()
@commands.has_permissions(administrator=True)
async def userclear(ctx, amount, *member: discord.Member):
await ctx.message.delete()
messages = await ctx.channel.history(limit=int(amount)).flatten()
for message in messages:
for mem in member:
if message.author == mem: await message.delete()
@client.command()
@commands.has_permissions(administrator=True)
async def coinflip(flip):
choices = ["Heads", "Tails"]
randcoin = random.choice(choices)
embed = discord.Embed(
title=randcoin,
color = discord.Color.blue()
)
await flip.send(embed=embed)
client.run(TOKEN)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment