Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions cogs/fun.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from discord.ext import commands
import json
import random
import requests

# Cog class:
class Fun(commands.Cog):
Expand Down Expand Up @@ -33,6 +34,42 @@ async def figlet(self, ctx, *, figtext):
fig = Figlet()
figsend = fig.renderText(figtext)
await ctx.send(f"```{figsend}```")

@commands.command()
async def urban(self, ctx, *, word):
url = "http://urbanscraper.herokuapp.com/define/"
completeurl = url + word
try:
response = requests.get(completeurl)
except:
ctx.send("Couldn't find that word.")

res = response.json()
term = res["term"]
defi = res["definition"]
example = res["example"]
word_url = res["url"]
posttime = res["posted"]
author = res["author"]

urbanembed = discord.Embed(title=term,url=word_url)
urbanembed.add_field(name="**Definition:**",value=defi)
urbanembed.add_field(name="**Example:**",value=example)
urbanembed.set_footer(text="Author: " + author)
await ctx.send(embed=urbanembed)



@commands.command()
async def emote(self, ctx, emote):
emoji = discord.Emoji()
emoteurl = emoji.url
await ctx.send(emoteurl)

@commands.command(hidden=True)
async def tts(self, ctx, *, message):
await ctx.send(content=message, tts=True)


# This always needs to be at the end of a cog file:
def setup(client):
Expand Down
1 change: 1 addition & 0 deletions cogs/utility.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ async def desc(self, ctx, *, cname):
# Weather command
@commands.command(name="weather")
async def _weather(self, ctx, city_name):
# TODO #2 Fix weather command
"""Get weather information about a location. Usage: ?weather <location>"""
base_url = "http://api.weatherapi.com/v1/current.json?"
complete_url = base_url + "key=" + weathertoken + "&q=" + city_name
Expand Down
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
discord.py
pyfiglet
gdshortener
gdshortener
urbandictionary