async def get_anime_schedule(weekid): "get anime schedule" dayname = get_weekday(weekid) result = f"✙ **Scheduled animes for {dayname.title()} are : **\n\n" async with jikanpy.AioJikan() as animesession: scheduled_list = (await animesession.schedule(day=dayname)).get(dayname) for a_name in scheduled_list: result += f"• [{a_name['title']}]({a_name['url']})\n" return result, dayname
def __init__(self, bot: core.Bot): self.bot = bot self.aiojikan = aiojikan = jikanpy.AioJikan(session=bot.session) self._make_mal_schedule_commands() self._make_mal_season_commands() self._make_mal_top_subcommands() aiojikan.api_cooldowns = [ CooldownMapping.from_cooldown(30, 60, BucketType.default), CooldownMapping.from_cooldown(2, 1, BucketType.default) ]
async def get_anime(message): try: query = message.pattern_match.group(1) except IndexError: if message.reply_to_msg_id: query = await message.get_reply_message().text else: await message.reply( "You gave nothing to search. (。ì _ í。)\n `Usage: .scanime <anime name>`" ) return except Exception as err: await message.edit(f"**Encountered an Unknown Exception**: \n{err}") return p_rm = await message.reply("`Searching Anime...`") f_mal_id = "" try: jikan = jikanpy.AioJikan() search_res = await jikan.search("anime", query) f_mal_id = search_res["results"][0]["mal_id"] except IndexError: await p_rm.edit(f"No Results Found for {query}") return except Exception as err: await p_rm.edit(f"**Encountered an Unknown Exception**: \n{err}") return results_ = await jikan.anime(f_mal_id) await jikan.close() await message.delete() # Get All Info of anime anime_title = results_["title"] jap_title = results_["title_japanese"] eng_title = results_["title_english"] type_ = results_["type"] results_["source"] episodes = results_["episodes"] status = results_["status"] results_["aired"].get("string") results_["duration"] rating = results_["rating"] score = results_["score"] synopsis = results_["synopsis"] results_["background"] producer_list = results_["producers"] studios_list = results_["studios"] genres_list = results_["genres"] # Info for Buttons mal_dir_link = results_["url"] trailer_link = results_["trailer_url"] main_poster = "" telegraph_poster = "" # Poster Links Search try: main_poster = get_poster(anime_title) except BaseException: pass try: telegraph_poster = getBannerLink(f_mal_id) except BaseException: pass # if not main_poster: main_poster = telegraph_poster if not telegraph_poster: telegraph_poster = main_poster genress_md = "" producer_md = "" studio_md = "" for i in genres_list: genress_md += f"{i['name']} " for i in producer_list: producer_md += f"[{i['name']}]({i['url']}) " for i in studios_list: studio_md += f"[{i['name']}]({i['url']}) " # Build synopsis telegraph post html_enc = "" html_enc += f"<img src = '{telegraph_poster}' title = {anime_title}/>" html_enc += "<br><b>» Synopsis: </b></br>" html_enc += f"<br><em>{synopsis}</em></br>" synopsis_link = post_to_telegraph(anime_title, html_enc) # Build captions: captions = f"""📺 `{anime_title}` - `{eng_title}` - `{jap_title}` **🎭 Genre:** `{genress_md}` **🆎 Type:** `{type_}` **🔢 Episodes:** `{episodes}` **📡 Status:** `{status}` **🔞 Rating:** `{rating}` **💯 Score:** `{score}` [📖 Synopsis]({synopsis_link}) [🎬 Trailer]({trailer_link}) [📚 More Info]({mal_dir_link}) """ await p_rm.delete() await message.client.send_file(message.chat_id, file=main_poster, caption=captions)
import re import logging import asyncio from typing import List import jikanpy import discord # type: ignore[import] import backoff # type: ignore[import] from typing import Optional, Dict, Any, Tuple from . import fibo_long, log j = jikanpy.AioJikan("http://localhost:8000/v3/") @log @backoff.on_exception( fibo_long, # fibonacci sequence backoff (jikanpy.exceptions.JikanException, jikanpy.exceptions.APIException), max_tries=3, ) async def get_data( mal_id: int, ignore_image: bool, **kwargs: logging.Logger ) -> Tuple[str, Optional[str], Optional[str], bool, Optional[str], str]: logger: Optional[logging.Logger] = kwargs.get("logger", None) if logger: logger.debug("Sleeping before MAL request...") await asyncio.sleep(10)
async def get_anime(message): try: query = message.pattern_match.group(1) except IndexError: if message.reply_to_msg_id: query = await message.get_reply_message().text else: await message.reply( "`Anda tidak memberikan apapun untuk dicari.\nGunakan .scanime [nama anime]`" ) return except Exception as err: await message.edit( f"`Menemukan pengecualian yang tidak diketahui :` \n{err}") return p_rm = await message.reply("`Mencari Anime...`") f_mal_id = "" try: jikan = jikanpy.AioJikan() search_res = await jikan.search("anime", query) f_mal_id = search_res["results"][0]["mal_id"] except IndexError: await p_rm.edit(f"`Tidak ada hasil yang ditemukan untuk` **{query}**") return except Exception as err: await p_rm.edit( f"`Menemukan pengecualian yang tidak diketahui :` \n{err}") return results_ = await jikan.anime(f_mal_id) await jikan.close() await message.delete() # Get All Info of anime anime_title = results_["title"] jap_title = results_["title_japanese"] eng_title = results_["title_english"] type_ = results_["type"] results_["source"] episodes = results_["episodes"] status = results_["status"] results_["aired"].get("string") results_["duration"] rating = results_["rating"] score = results_["score"] synopsis = results_["synopsis"] results_["background"] producer_list = results_["producers"] studios_list = results_["studios"] genres_list = results_["genres"] # Info for Buttons mal_dir_link = results_["url"] trailer_link = results_["trailer_url"] main_poster = "" telegraph_poster = "" # Poster Links Search try: main_poster = get_poster(anime_title) except BaseException: pass try: telegraph_poster = getBannerLink(f_mal_id) except BaseException: pass # if not main_poster: main_poster = telegraph_poster if not telegraph_poster: telegraph_poster = main_poster genress_md = "" producer_md = "" studio_md = "" for i in genres_list: genress_md += f"{i['name']} " for i in producer_list: producer_md += f"[{i['name']}]({i['url']}) " for i in studios_list: studio_md += f"[{i['name']}]({i['url']}) " # Build synopsis telegraph post html_enc = "" html_enc += f"<img src = '{telegraph_poster}' title = {anime_title}/>" html_enc += "<br><b>• Ringkasan : </b></br>" html_enc += f"<br><em>{synopsis}</em></br>" synopsis_link = post_to_telegraph(anime_title, html_enc) # Build captions: captions = f"""📺 **{anime_title}** - **{eng_title}** - **{jap_title}** **🎭 Genre :** `{genress_md}` **🆎 Tipe :** `{type_}` **🔢 Episode :** `{episodes}` **📡 Status :** `{status}` **🔞 Peringkat :** `{rating}` **💯 Skor :** `{score}` [📖 Ringkasan]({synopsis_link}) [🎬 Cuplikan]({trailer_link}) [📚 Info selengkapnya]({mal_dir_link}) """ await p_rm.delete() await message.client.send_file(message.chat_id, file=main_poster, caption=captions)
import discord import random from discord.ext import commands import jikanpy from collections import Counter jikan = jikanpy.AioJikan() def genrechoosermanga(genrename): genre = { 'Action': 1, 'Adventure': 2, 'Cars': 3, 'Comedy': 4, 'Mystery': 7, 'Drama': 8, 'Ecchi': 9, 'Fantasy': 10, 'Horror': 14, 'Martial Arts': 17, 'Mecha': 18, 'Samurai': 21, 'Romance': 22, 'School': 23, 'Sci fi': 24, 'Sci-fi': 24, 'Scifi': 24, 'Shoujo': 25, 'Shoujo ai': 26, 'Shoujo-ai': 26,
async def get_anime(message): try: query = message.pattern_match.group(1) except IndexError: if message.reply_to_msg_id: query = await message.get_reply_message().text else: await message.reply( "You gave nothing to search. (。ì _ í。)\n `Usage: .ani <anime name>`" ) return except Exception as err: await message.edit(f'**Encountered an Unknown Exception**: \n{err}') return p_rm = await message.reply("`Searching Anime...`") f_mal_id = "" try: jikan = jikanpy.AioJikan() search_res = await jikan.search("anime", query) f_mal_id = search_res['results'][0]['mal_id'] except IndexError: await p_rm.edit(f"No Results Found for {query}") return except Exception as err: await p_rm.edit(f"**Encountered an Unknown Exception**: \n{err}") return results_ = await jikan.anime(f_mal_id) await jikan.close() # Get All Info of anime anime_title = results_['title'] id = results_['mal_id'] jap_title = results_['title_japanese'] eng_title = results_['title_english'] type_ = results_['type'] results_['source'] episodes = results_['episodes'] status = results_['status'] results_['aired'].get('string') results_['duration'] rating = results_['rating'] score = results_['score'] synopsis = results_['synopsis'] results_['background'] producer_list = results_['producers'] studios_list = results_['studios'] genres_list = results_['genres'] # Info for Buttons mal_dir_link = results_['url'] trailer_link = results_['trailer_url'] main_poster = '' telegraph_poster = '' # Poster Links Search try: main_poster = get_poster(anime_title) except BaseException: pass try: telegraph_poster = getBannerLink(f_mal_id) except BaseException: pass # if not main_poster: main_poster = telegraph_poster if not telegraph_poster: telegraph_poster = main_poster genress_md = '' producer_md = '' studio_md = '' for i in genres_list: genress_md += f"{i['name']} " for i in producer_list: producer_md += f"[{i['name']}]({i['url']}) " for i in studios_list: studio_md += f"[{i['name']}]({i['url']}) " # Build synopsis telegraph post html_enc = '' html_enc += f"<img src = '{telegraph_poster}' title = {anime_title}/>" html_enc += f"<br><b>» Studios:</b> {studio_md}</br>" html_enc += f"<br><b>» Producers:</b> {producer_md}</br>" html_enc += "<br><b>» Synopsis: </b></br>" html_enc += f"<br><em>{synopsis}</em></br>" synopsis_link = post_to_telegraph(anime_title, html_enc) # Build captions: captions = f'''📺 `{anime_title}` - `{eng_title}` - `{jap_title}` **🆎 Type:** `{type_}` **🆔 ID:** `{id}` **🎭 Genre:** `{genress_md}` **🔢 Episodes:** `{episodes}` **📡 Status:** `{status}` **💯 Score:** `{score}/10` **🔞 Rating:** `{rating}` [🎬 Trailer]({trailer_link}) [📖 Synopsis]({synopsis_link}) [📚 More Info]({mal_dir_link}) ©️ @LazyAF_Pepe''' await p_rm.delete() await message.client.send_file(message.chat_id, file=main_poster, caption=captions) await message.delete()