async def anime(self, ctx, *, text): try: anime, lang = text.split(' !') except: anime = text lang = "fr" anime = mal.Anime(mal.AnimeSearch(text, timeout=2).results[0].mal_id) embed = self.anime_embed(anime, lang) await ctx.send(embed=embed)
def search_anime_title(self): query = mal.AnimeSearch(self.user_request_anime_name) query_user_anime = query.results[0].title return query_user_anime
def search_anime_image_url(self): query = mal.AnimeSearch(self.user_request_anime_name) query_image = query.results[0].image_url return query_image
def search_anime_score(self): query = mal.AnimeSearch(self.user_request_anime_name) query_score = query.results[0].score return query_score
def search_anime_episodes(self): query = mal.AnimeSearch(self.user_request_anime_name) query_amount_episodes = query.results[0].episodes return query_amount_episodes
def search_anime_synopsis(self): query = mal.AnimeSearch(self.user_request_anime_name) query_user_synopsis = query.results[0].synopsis return query_user_synopsis
async def asearch(self, ctx, *, string): if ctx.author.bot: return def check(reaction, user): return user == ctx.author and str(reaction.emoji) in reactions async with ctx.typing(): results = mal.AnimeSearch(string).results await asyncio.sleep(3) if len(results) > 0: st = "" i = 0 for res in results[0:10]: st += f" {i} -> {res.title} ({res.mal_id})\n" i += 1 message = await ctx.send( f'Se han encontrado los siguientes titulos (id):\n```{st}```') for a in range(0, i): await message.add_reaction(reactions[a]) try: reaction, user = await self.bot.wait_for('reaction_add', timeout=60.0, check=check) await message.delete() index = reactions.index(str(reaction)) async with ctx.typing(): anime = mal.Anime(results[index].mal_id) await asyncio.sleep(3) genres = "|" for a in anime.genres: genres += f" {a} |" embed = discord.Embed(title=f"{anime.title_english}", url=f"{anime.url}", description=f"Score: {anime.score}", color=0x1ffb13) embed.set_thumbnail(url=f"{anime.image_url}") embed.add_field(name="Generos", value=f"{genres}", inline=False) embed.add_field( name="Duracion", value=f"{anime.episodes} episodios de {anime.duration}", inline=False) embed.add_field(name="Synopsis", value=f"{anime.synopsis[0:1020]}...", inline=False) await ctx.send(embed=embed) except asyncio.TimeoutError: await message.delete() await ctx.send("Se ha agotado el tiempo de respuesta!") elif len(results) == 1: anime = mal.Anime(results[0].mal_id) genres = "" for a in anime.genres: genres += f" {a} |" embed = discord.Embed(title=f"{anime.title_english}", url=f"{anime.url}", description=f"Score: {anime.score}", color=0x1ffb13) embed.set_thumbnail(url=f"{anime.image_url}") embed.add_field(name="Generos", value=f"{genres}", inline=False) embed.add_field( name="Duracion", value=f"{anime.episodes} episodios de {anime.duration}", inline=False) embed.add_field(name="Synopsis", value=f"{anime.synopsis[0:1020]}...", inline=False) await ctx.send(embed=embed) else: await ctx.send('Sin resultados!')