This commit is contained in:
Milka64 2020-03-19 12:07:56 +01:00
parent 415b610f6a
commit 71efb092f1
2 changed files with 7 additions and 5 deletions

View file

@ -52,16 +52,17 @@ class Mybot(commands.Cog):
# return
user = ctx.message.author.name
source = self.sounds_history[0]
self.sounds.append((source,ctx))
self.sounds.append(source)
@commands.command(help='Gif me')
async def gif(self, ctx):
query = ctx.message.content
query = ctx.message.content.replace('!gif ','')
print(query)
api_instance = giphy_client.DefaultApi()
api_key = "udhL9Rgdme3HpAoFhWVZoYM0l0XwkzLz"
lang = 'fr'
try:
api_response = api_instance.gifs_search_get(api_key, query, lang=lang)
api_response = api_instance.gifs_search_get(api_key, query, lang=lang, limit=10)
api_response.to_dict()['data'][0]
get_url = random.choice(api_response.to_dict()['data'])
get_url['url']
@ -168,7 +169,9 @@ class Mybot(commands.Cog):
if not ctx.voice_client.is_playing() and ctx.voice_client.is_connected():
ctx.voice_client.play(source, after=lambda e: print('Player error: %s' % e) if e else None)
self.sounds.pop(0)
self.sounds_history.insert(source,0)
self.sounds_history.reverse()
self.sounds_history.append((source,ctx))
self.sounds_history.reverse()
if len(self.sounds_history) >5:
self.sounds_history = self.sounds_history[:5]

View file

@ -2,7 +2,6 @@
Click = 7.0
Jinja2 = 2.10.1
MarkupSafe = 1.1.1
aiohttp = 3.5.4
async-timeout = 3.0.1
attrs = 19.1.0
binaryornot = 0.4.4