diff --git a/cogs/fun.py b/cogs/fun.py index 6f1886e..06c3d9a 100644 --- a/cogs/fun.py +++ b/cogs/fun.py @@ -3,6 +3,7 @@ from discord.ext import commands import json import random +import requests # Cog class: class Fun(commands.Cog): @@ -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): diff --git a/cogs/utility.py b/cogs/utility.py index 204ee81..c377b2f 100644 --- a/cogs/utility.py +++ b/cogs/utility.py @@ -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 """ base_url = "http://api.weatherapi.com/v1/current.json?" complete_url = base_url + "key=" + weathertoken + "&q=" + city_name diff --git a/requirements.txt b/requirements.txt index 861b410..937da9e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,4 @@ discord.py pyfiglet -gdshortener \ No newline at end of file +gdshortener +urbandictionary \ No newline at end of file