Skip to content

Instantly share code, notes, and snippets.

@GrunclePug
Last active April 17, 2018 04:33
Show Gist options
  • Save GrunclePug/ebb0aaa204a8f3cef7ab01ff894f8817 to your computer and use it in GitHub Desktop.
Save GrunclePug/ebb0aaa204a8f3cef7ab01ff894f8817 to your computer and use it in GitHub Desktop.
Python Discord Bot
//Made By: @GrunclePug#7015
#Discord Bot by GrunclePug#7015
import discord
import asyncio
from discord.ext.commands import Bot
from discord.ext import commands
import platform
import random
version = 'You are running GruncleBot 1.0'
#Bot Desc
client = Bot(description="A simple bot made by GrunclePug#7015", command_prefix="g!", pm_help = False)
#Startup
@client.event
async def on_ready():
print('Logged in as '+client.user.name+' (ID:'+client.user.id+') | Connected to '+str(len(client.servers))+' servers | Connected to '+str(len(set(client.get_all_members())))+' users')
print('~~~~~~~~')
print('Current Discord.py Version: {} | Current Python Version: {}'.format(discord.__version__, platform.python_version()))
print('~~~~~~~~')
print('Use this link to invite {}:'.format(client.user.name))
print('https://discordapp.com/oauth2/authorize?client_id={}&scope=bot&permissions=8'.format(client.user.id))
print('~~~~~~~~')
print(version)
print('Created by GrunclePug#7015')
return await client.change_presence(game=discord.Game(name='g! Made by GrunclePug#7015'))
#Commands
@client.command()
async def ping(*args):
"""Test the delay between you and the bot"""
await client.say(":ping_pong: Pong!")
await asyncio.sleep(3)
@client.command()
async def version(*args):
"""Check the current bot version"""
await client.say("You are running GruncleBot 1.0")
await asyncio.sleep(3)
@client.command()
async def shoot(user_name : discord.User):
"""Shoot another player"""
await client.say(f"*Shoots {user_name.mention} <a:pepeshoot:415631916361056256>")
await asyncio.sleep(3)
@client.command(pass_context = True)
async def kick(ctx, user_name: discord.User):
"""Kick a user from server"""
await client.kick(user_name)
await client.say("__**User Has Been Kicked!**__")
@client.command(pass_context = True)
async def ban(ctx, user_name: discord.User):
"""Ban a user from server"""
await client.ban(user_name)
await client.say("__**User Has Been Banned!**__")
@client.command()
async def flip(*args):
"""Flip a coin"""
flip = random.choice(["<:doge:415649385633021955> Heads! <:doge:415649385633021955>","<:doge:415649385633021955> Tails! <:doge:415649385633021955>"])
await client.say(flip)
await asyncio.sleep(3)
@client.command()
async def waifu(user_name : discord.User):
"""Rate someone as a waifu"""
rate = random.randint(1, 100)
await client.say(f"{user_name.mention} **is** " + str(rate) + "**%** " + "**waifu** <:waifu:415696776369274880>")
await asyncio.sleep(3)
@client.command()
async def purge(ctx, *, number : int):
message = [] #empty list to put all msgs in the Log
async for x in client.logs_from(ctx.message.channel, limit = number):
message.append(x)
await client.delete_messages(message)
client.run('BOT TOKEN')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment