Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import time
- import discord
- from discord.ext import commands
- from discord import Embed
- import random
- from profanity import profanity
- # import time
- from bs4 import BeautifulSoup
- import requests
- from html.parser import HTMLParser
- import math as m
- from discord.voice_client import VoiceClient
- from discord.ext.commands import Bot
- import pprint
- import asyncio
- from PIL import Image
- from random import randint
- import urllib.request
- import geocoder
- import aiohttp
- import urllib
- import PyPDF2
- import openpyxl
- import wikipedia
- import random
- import pyjokes
- import json
- from discord.ext.commands import Bot
- prefix = '$'
- des = 'I am your personal helper, I can help you with queries you have.'
- # Make the client
- client = commands.Bot(description=des, command_prefix=prefix)
- #Invalid Syntax Error
- @client.event
- async def on_ready():
- print("----------------------")
- print("Logged In As")
- print("Username: %s" % client.user.name)
- print("ID: %s" % client.user.id)
- print("----------------------")
- @commands.command()
- async def choose(ctx, *choices: str):
- await ctx.send(random.choice(choices))
- @commands.command()
- async def decryptSC(ctx, arg):
- enc = arg
- for displacement in range(127):
- for char in enc:
- decimal = ord(char)
- if decimal - displacement > 0:
- await ctx.send(chr(decimal - displacement))
- await ctx.send(": " + str(displacement))
- @commands.command()
- async def dadjoke(ctx):
- r = requests.get('https://icanhazdadjoke.com', headers={"Accept":"application/json"})
- raw_joke = r.json();
- joke = raw_joke['joke']
- await ctx.send(joke)
- @commands.command()
- async def numbers(ctx, arg):
- url = 'http://numbersapi.com/'
- apiurl = url + arg
- await ctx.send(json.dumps(apiurl))
- @commands.command()
- async def fuckOff(ctx, arg):
- response = "```\"Fuck off " + arg + " - Everyone```"
- await ctx.send(response)
- @commands.command()
- async def randomPerson(ctx):
- response = requests.get("https://mightyalex-ui-faces-v1.p.rapidapi.com/?limit=5",
- headers={
- "X-RapidAPI-Host": "mightyalex-ui-faces-v1.p.rapidapi.com",
- "X-RapidAPI-Key": "5e7a3747e1msh68ee79a8afc00cep1c6704jsn416df28913f7",
- "X-API-KEY": "9497433be95c260dcf6295af47172c"
- }
- )
- print(response.text)
- @commands.command()
- async def Cat(ctx):
- api_address='https://aws.random.cat/meow'
- json_data = requests.get(api_address).json()
- katten = json_data["file"]
- await ctx.send(katten)
- @commands.command()
- async def Dog(ctx):
- api_address='https://random.dog/woof.json'
- json_data = requests.get(api_address).json()
- katten = json_data["url"]
- await ctx.send(katten)
- @commands.command()
- async def Fox(ctx):
- api_address='https://randomfox.ca/floof/'
- json_data = requests.get(api_address).json()
- katten = json_data["link"]
- await ctx.send(katten)
- @commands.command()
- async def joke(ctx):
- await ctx.send(pyjokes.get_joke())
- @commands.command()
- async def genderName(ctx, arg):
- url = 'https://api.genderize.io/?name='
- apiurl = url + arg
- ressponse = requests.get(apiurl).json()
- Recwest = ressponse["gender"]
- await ctx.send(Recwest)
- await ctx.send("The probability of this is: ", ressponse["probability"])
- @commands.command()
- async def defineUD(ctx, arg):
- UD_DEFINE_URL = 'https://api.urbandictionary.com/v0/define?term={}'.format(arg)
- ressponse = requests.get(UD_DEFINE_URL).json()
- Recwest = ressponse["list"][0]["definition"]
- await ctx.send(Recwest)
- @commands.command()
- async def checkUrl(ctx, arg):
- url = 'https://www.virustotal.com/vtapi/v2/url/report'
- params = {'apikey': '5f697b730cfd317a7e2e3663e0b65f5ceb5ed90984e22567d142c0cfcfa9b2f2', 'resource':arg}
- ressponse = requests.get(url, params=params).json()
- Recwest = ressponse["positives"]
- if Recwest == 0:
- await ctx.send("```This website is to be trusted.```")
- else:
- await ctx.send("This site has {} found issues. I would not trust it".format(str(Recwest)))
- with open("fullrequests.txt", "w+") as f:
- f.write(str(ressponse))
- await ctx.send(file=discord.File(f, 'fullrequests.txt'))
- @commands.command()
- async def helpme(ctx):
- await ctx.send("""```Here are some commands you can try:
- 1. $weather
- 2. $helpme
- 3. $lookup
- 4. $joke
- 5. $decryptSC, for decrypting Shift Cypher
- 6. $repeat x
- 8. $choose x x
- 9. $Cat
- 10. $Dog
- 11. $Fox
- 12. $genderName x
- 13. $checkUrl x
- 14. $defineUD x
- 15. $advice
- 16. $fuckOff x
- 17. $randomPerson
- 18. $dadjoke
- That's all I have for now, but I am still in béta testing```""")
- @commands.command()
- async def repeat(ctx, times: int, content='repeating...'):
- """Repeats a message multiple times."""
- for i in range(times):
- await ctx.send(content)
- @commands.command()
- async def lookup(ctx, arg):
- thingy35 = wikipedia.page(arg)
- thingy34 = str(wikipedia.page(arg).content).split(".")[0]
- await ctx.send('Here is what came back from a search: \n\n {0}. \n \n Here is the link: {1}'.format(thingy34, thingy35.url))
- @commands.command()
- async def advice(ctx):
- url = 'https://api.adviceslip.com/advice'
- ressponse = requests.get(url).json()
- Recwest = ressponse["slip"]
- await ctx.send("Advice: {}".format(Recwest))
- @commands.command()
- async def weather(ctx):
- g = geocoder.ip('me')
- rg = geocoder.yandex(g.latlng, method='reverse')
- data = rg.json
- add_format = data['city']
- api_address='http://api.openweathermap.org/data/2.5/weather?appid=34f0968e5b315c84a6a6cbbe4ec9f1bf&q='
- city = add_format
- url = api_address + city
- json_data = requests.get(url).json()
- realtime_weather = json_data["weather"][0]["description"]
- await ctx.send("```Today we are going to have some {}```".format(realtime_weather))
- client.add_command(weather)
- client.add_command(helpme)
- client.add_command(lookup)
- client.add_command(joke)
- client.add_command(choose)
- client.add_command(repeat)
- client.add_command(decryptSC)
- client.add_command(Cat)
- client.add_command(Dog)
- client.add_command(Fox)
- client.add_command(checkUrl)
- client.add_command(genderName)
- client.add_command(defineUD)
- client.add_command(advice)
- client.add_command(dadjoke)
- client.add_command(numbers)
- client.add_command(fuckOff)
- client.add_command(randomPerson)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement