mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-06 19:28:54 -05:00
image cog polish
This commit is contained in:
parent
cf2677d4fa
commit
e581230789
@ -1,7 +1,10 @@
|
|||||||
import discord
|
import discord
|
||||||
from discord.ext import commands
|
from discord.ext import commands
|
||||||
from random import randint
|
from random import randint
|
||||||
|
try:
|
||||||
from imgurpython import ImgurClient
|
from imgurpython import ImgurClient
|
||||||
|
except:
|
||||||
|
print("imgurpython is not installed. Do 'pip install imgurpython' to use this cog.\n")
|
||||||
import aiohttp
|
import aiohttp
|
||||||
import random
|
import random
|
||||||
|
|
||||||
@ -16,8 +19,9 @@ class Image:
|
|||||||
|
|
||||||
@commands.command(no_pm=True)
|
@commands.command(no_pm=True)
|
||||||
async def imgur(self, *text):
|
async def imgur(self, *text):
|
||||||
"""Retrieves a random imgur picture.
|
"""Retrieves a random imgur picture
|
||||||
imgur search [keyword] - retrieves first hit of search query.
|
|
||||||
|
imgur search [keyword] - Retrieves first hit of search query.
|
||||||
imgur [subreddit section] [top or new] - retrieves top 3 hottest or latest pictures of today for given a subreddit section, e.g. 'funny'."""
|
imgur [subreddit section] [top or new] - retrieves top 3 hottest or latest pictures of today for given a subreddit section, e.g. 'funny'."""
|
||||||
imgurclient = ImgurClient("1fd3ef04daf8cab", "f963e574e8e3c17993c933af4f0522e1dc01e230")
|
imgurclient = ImgurClient("1fd3ef04daf8cab", "f963e574e8e3c17993c933af4f0522e1dc01e230")
|
||||||
if text == ():
|
if text == ():
|
||||||
@ -46,7 +50,9 @@ class Image:
|
|||||||
|
|
||||||
@commands.command(no_pm=True)
|
@commands.command(no_pm=True)
|
||||||
async def gif(self, *text):
|
async def gif(self, *text):
|
||||||
""" gif [keyword] - retrieves first search result from giphy """
|
"""Retrieves first search result from giphy
|
||||||
|
|
||||||
|
gif [keyword]"""
|
||||||
if len(text) > 0:
|
if len(text) > 0:
|
||||||
if len(text[0]) > 1 and len(text[0]) < 20:
|
if len(text[0]) > 1 and len(text[0]) < 20:
|
||||||
try:
|
try:
|
||||||
@ -68,7 +74,9 @@ class Image:
|
|||||||
|
|
||||||
@commands.command(no_pm=True)
|
@commands.command(no_pm=True)
|
||||||
async def gifr(self, *text):
|
async def gifr(self, *text):
|
||||||
""" gifr [keyword] - retrieves a random gif from a giphy search """
|
"""Retrieves a random gif from a giphy search
|
||||||
|
|
||||||
|
gifr [keyword]"""
|
||||||
random.seed()
|
random.seed()
|
||||||
if len(text) > 0:
|
if len(text) > 0:
|
||||||
if len(text[0]) > 1 and len(text[0]) < 20:
|
if len(text[0]) > 1 and len(text[0]) < 20:
|
||||||
@ -88,7 +96,7 @@ class Image:
|
|||||||
else:
|
else:
|
||||||
await self.bot.say("Invalid search.")
|
await self.bot.say("Invalid search.")
|
||||||
else:
|
else:
|
||||||
await self.bot.say("gif [text]")
|
await self.bot.say("gifr [text]")
|
||||||
|
|
||||||
def setup(bot):
|
def setup(bot):
|
||||||
bot.add_cog(Image(bot))
|
bot.add_cog(Image(bot))
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user