Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import discord as d
- import sys, traceback
- from discord.ext.commands import Bot
- from discord.ext.commands import bot_has_permissions
- from discord.ext.commands import has_permissions
- from discord.ext import commands as c
- import os
- from random import randint
- client = Bot(command_prefix='?R ')
- class BotCogs:
- @client.command()
- @c.is_owner()
- async def stop(ctx):
- """Stop the bot. ONLY OWNER CAN DO SO"""
- try:
- await ctx.send('Stopping.......')
- client.loop.run_until_complete(client.logout())
- except Exception as e:
- print(e)
- @client.command()
- async def desc(ctx):
- """Sends desc of bot"""
- try:
- await ctx.send('I am Ratchet. A fun bot. To see a list of commands, type in \'?R helps\'.\n To report a bug, DM the owner. @12944qwerty#9317')
- except Exception as e:
- print(e)
- @client.command()
- async def ping(ctx):
- """Tests for reply speed"""
- try:
- msg = await ctx.send('Pong!:ping_pong: {}ms '.format(round(client.latency * 1000,1)))
- msg2 = str(msg.content) + '\nEdit: {}ms'.format(round(client.latency * 1000,1))
- await msg.edit(content=msg2)
- except Exception as e:
- print(e)
- @client.command()
- async def hi(ctx):
- """Test if bot is working"""
- try:
- await ctx.send('Hello {}!'.format(ctx.author.display_name))
- except Exception as e:
- print(e)
- class ModsCogs:
- @client.command()
- async def ban(ctx, *, user : d.Member):
- """votetoban someone"""
- try:
- await ctx.send('@Moderators, {} has requested for {} to be banned'.format(ctx.author, user.mention))
- #await ctx.send('Please specify a user you want to ban.')
- except Exception as e:
- print(e)
- initial_extensions = [
- 'cogs.Mods',
- 'cogs.Bot',
- ]
- if __name__ == '__main__':
- for extension in initial_extensions:
- try:
- client.load_extension(extension)
- except Exception as e:
- print(f'Failed to load extension {extension}.', file=sys.stderr)
- traceback.print_exc()
- token = os.environ.get('TOKEN')
- try:
- client.loop.run_until_complete(client.start(token))
- except KeyboardInterrupt:
- client.loop.run_until_complete(client.logout())
- finally:
- client.loop.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement