Skip to content

Commit

Permalink
Merge pull request cgrok#188 from SharpBit/rewrite
Browse files Browse the repository at this point in the history
Gif command
  • Loading branch information
fourjr authored Nov 15, 2017
2 parents 23e8be7 + 4fb5205 commit 69ec5bb
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 8 deletions.
17 changes: 17 additions & 0 deletions cogs/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@
from urllib.request import urlopen
from sympy import solve
from PIL import Image
import safygiphy
from ext import embedtobox


class NumericStringParserForPython3(object):
Expand Down Expand Up @@ -152,6 +154,21 @@ def __init__(self, bot):
self.bot = bot
self.emoji_converter = commands.EmojiConverter()
self.nsp=NumericStringParserForPython3()

@commands.command()
async def gif(self, ctx, *, tag):
''' Get a random gif. Usage: gif <tag> '''
g = safygiphy.Giphy()
gif = g.random(tag=tag)
color = await ctx.get_dominant_color(ctx.author.avatar_url)
em = discord.Embed(color=color)
em.set_image(url=str(gif.get('data', {}).get('image_original_url')))
try:
await ctx.send(embed=em)
except discord.HTTPException:
em_list = await embedtobox.etb(em)
for page in em_list:
await ctx.send(page)

@commands.command()
async def embedsay(self, ctx, *, message):
Expand Down
8 changes: 3 additions & 5 deletions data/cc.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
{
"pycc":{

},
"textcc":{

"pycc": {},
"textcc": {
"selfstats": "https://github.com/SharpBit/selfstats"
}
}
6 changes: 3 additions & 3 deletions data/options.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"CR_TAG":"your clash royale tag",
"MODLOG":"modlog channel",
"NICKPROTECT":[]
"CR_TAG": "CY8G8VVQ",
"MODLOG": "modlog channel",
"NICKPROTECT": []
}
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ wikipedia
crasync
cr-py
urban-async
safygiphy

0 comments on commit 69ec5bb

Please sign in to comment.