Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import discord
- import asyncio
- import random
- from discord.ext import commands
- import sys, traceback
- game = discord.Game(name='in the blue waters')
- bot = commands.Bot(command_prefix='>', description='--- List of Aqua\'s commands ---')
- extensions = ['cogs.cog']
- @bot.event
- async def on_ready():
- await bot.change_presence(status=None, game=game)
- print('---------- AquaBot ----------')
- print('Logged in as %s\n(client ID: %s)' % (bot.user.name, bot.user.id))
- print('-----------------------------')
- if __name__ == '__main__':
- for ext in extensions:
- try:
- bot.load_extension(ext)
- except Exception as e:
- print(f'Failure while loading extension {ext}!', file = sys.stderr)
- traceback.print_exc()
- print('Aqua has loaded succesfully.')
- @bot.command(help='Pong!', aliases={'pong'})
- async def ping(ctx):
- await ctx.send('Pong!')
- @bot.command(help='Hello world!', aliases={'helloworld'})
- async def hello(ctx):
- await ctx.send('Hello, world!')
- @bot.command(help='Aaaaaaaaaa!', brief='AAAAA', aliases={'scream','A'})
- async def a(ctx):
- a= random.randint(1,100)
- A = random.randint(1,2)
- if A == 1:
- await ctx.send('a' * a)
- else:
- await ctx.send('A' * a)
- @bot.command(help='Displays a list of all commands.', brief='Shows Aqua\'s commands.', aliases={'commands'})
- async def cmds(ctx):
- cmds = discord.Embed(title=':information_source: Aqua\'s commands', description='```a, dice, ping, 8ball, hello```', colour = discord.Colour.from_rgb(10,240,250))
- cmds.add_field(name='Bot Owner Only commands', value='```stop```')
- await ctx.send(embed = cmds)
- @bot.command(help='Rolls a 6-sided dice.', brief='Rolls a dice.', aliases={'roll'})
- async def dice(ctx):
- await ctx.send('You rolled a %s!' % random.randint(1,6))
- @bot.command(help='Test.')
- async def test(ctx):
- await ctx.send(':white_check_mark: Test complete.')
- @bot.command(name='8ball', brief='Ask the mighty 8Ball!', help='Ask the 8Ball a yes/no question and let the stars do the magic!', aliases={'ask','eightball'}, usage='<question...>')
- async def _ball(ctx, *args):
- r = random.choice(['Yes','No','Maybe','I don\'t know','The outlooks are good','Ask again please','Of course','Of course not'])
- ball = discord.Embed(title=':8ball: The Mighty 8Ball', colour = discord.Colour.darker_grey())
- ball.add_field(name='Your question:', value='```%s```' % ' '.join(args), inline=False)
- ball.add_field(name='The 8Ball says:', value='```%s```' % r, inline=False)
- await ctx.send(embed = ball)
- @bot.command(help='Displays when a member joined the server.', brief='Shows a member\'s join date.', aliases={'info'})
- async def joindate(ctx, *, member: discord.Member):
- fmt = '```{0} joined on {0.joined_at}.```'
- await ctx.send(fmt.format(member))
- @bot.command(help='Stops the bot. Only the bot owner can execute this command.', brief='[BOT OWNER ONLY] Stops the bot.', aliases = {'quit', 'exit'})
- @commands.is_owner()
- async def stop(ctx):
- await ctx.send(':ballot_box_with_check: `The bot has been stopped.`')
- print('The bot owner issued the >stop command.')
- exit()
- @joindate.error
- async def joindate_error(ctx, error):
- if isinstance(error, commands.BadArgument):
- await ctx.send(':warning: **Failed to find member!**')
- @stop.error
- async def stop_error(ctx, error):
- if isinstance(error, commands.CheckFailure):
- await ctx.send(':warning: **Only the bot owner can use `>stop`:!**')
- bot.run('TOKEN')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement