Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import discord
- from discord.ext.commands import Bot
- from discord.ext import commands
- import asyncio
- import random
- from bs4 import BeautifulSoup
- import urllib.request
- import re
- import os
- from boto.s3.connection import S3Connection
- client = commands.Bot(command_prefix='j!')
- client.remove_command('help')
- @client.event
- async def on_ready():
- await client.change_presence(status=discord.Status.online, activity=discord.Game('j!help | Created by Johnodon'))
- print('Bot is ready.')
- @client.event
- async def on_command_error(ctx, error):
- if isinstance(error, commands.CommandNotFound):
- print('Error: Invalid command run.')
- await ctx.send('Invalid command used.')
- @client.event
- async def on_member_join(member):
- print(f'{member} has joined the server.')
- @client.event
- async def on_member_remove(member):
- print(f'{member} has left the server.')
- @client.command()
- async def ping(ctx):
- await ctx.send(f'Pong! ({round(client.latency * 1000)}ms)')
- @client.command(aliases=['8ball'])
- async def _8ball(ctx, *, question):
- responses = ['It is certain.',
- 'It is decidedly so.',
- 'Without a doubt.',
- 'Yes - definitely.',
- 'You may rely on it.',
- 'As I see it, yes.',
- 'Most likely.',
- 'Outlook good.',
- 'Yes.',
- 'Signs point to yes.',
- 'Reply hazy, try again.',
- 'Ask again later.',
- 'Better not tell you now.',
- 'Cannot predict now.'
- 'Concentrate and ask again.',
- "Don't count on it.",
- 'My reply is no.',
- 'My sources say no.',
- 'Outlook not so good.',
- 'Very doubtful.']
- await ctx.send(f'Question: {question}\nAnswer: {random.choice(responses)}')
- @client.command()
- async def add(ctx, left : int, right : int):
- await ctx.send(left + right)
- @client.command()
- async def subtract(ctx, left : int, right : int):
- await ctx.send(left - right)
- @client.command()
- async def multiply(ctx, left : int, right : int):
- await ctx.send(left * right)
- @client.command()
- async def divide(ctx, left : int, right : int):
- await ctx.send(left / right)
- @client.command()
- async def help(ctx):
- embed = discord.Embed(title="The Hangout Discord Server", colour=discord.Colour(0xffec), url="http://thehangout.ga/")
- embed.set_author(name="Help", icon_url="https://static.wixstatic.com/media/04af07_8ed6ef39adca4c57a858b0cc991065dd~mv2.png/v1/fill/w_128,h_128,al_c,q_80/the-hangoutlogo%20copy.webp")
- embed.set_footer(text="JohnodonBot")
- embed.add_field(name="j!help", value="Shows this menu", inline=False)
- embed.add_field(name="j!ping", value="Displays the Bot's ping", inline=False)
- embed.add_field(name="j!8ball [Question]", value="Ask it anything!", inline=False)
- embed.add_field(name="j!add [number] [number]", value="Adds two numbers", inline=True)
- embed.add_field(name="j!subtract [number] [number]", value="Subtracts two numbers", inline=True)
- embed.add_field(name="j!multiply [number] [number]", value="Multiplies two numbers", inline=True)
- embed.add_field(name="j!divide [number] [number]", value="Divides two numbers", inline=True)
- embed.add_field(name="j!whoisbest", value="Who is best?", inline=False)
- await ctx.send(embed=embed)
- @client.command()
- async def userinfo(ctx, member: discord.Member = None):
- member = ctx.author if not member else member
- roles = [role for role in member.roles]
- embed = discord.Embed(colour=member.color, timestamp=ctx.message.created_at)
- embed.set_author(name=f"User Info = {member}")
- embed.set_thumbnail(url=member.avatar_url)
- embed.set_footer(text=f"Requested by {ctx.author}", icon_url=ctx.author.avatar_url)
- embed.add_field(name="ID:", vaulue=member.id)
- embed.add_field(name="Guild Name:", vaulue=member.display_name)
- embed.add_field(name="Created at:", vaulue=member.created_at.sfrftime("%a, %#d %B %Y, %I:%M %p UTC"))
- embed.add_field(name="Joined on:", vaulue=member.joined_at.sfrftime("%a, %#d %B %Y, %I:%M %p UTC"))
- embed.add_field(name=f"Roles: ({len(roles)})", vaulue=" ".join([role.mention for role in roles]))
- embed.add_field(name="Top Role:", vaulue=member.top_role.mention)
- embed.add_field(name="Bot:", vaulue=member.bot)
- await ctx.send(embed=embed)
- @client.command()
- async def whoisbest(ctx):
- await ctx.send('<@265913945900974080> is.... Obviously. He made this bot.')
- @_8ball.error
- async def _ball_error(ctx):
- if isinstance(error, commands.MissingRequiredArgument):
- await ctx.send('Enter a question for the 8ball to answer.')
- client.run('REDACTED')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement