コード例 #1
0
ファイル: anime_world.py プロジェクト: lyoko98s/Xtra-Plugins
async def manga(client, message):
    pablo = await edit_or_reply(message, "`Searching For Manga.....`")
    anime = get_text(message)
    if not anime:
        await pablo.edit("`Please Give Me A Valid Input. You Can Check Help Menu To Know More!`")
        return
    search = MangaSearch(anime)
    ID = search.results[0].mal_id
    manga = Manga(ID)
    jp = ""
    for x in manga.genres:
        jp += x + ";  "
    link = manga.image_url
    if link is None:
        link = search.results[0].image_url
    By = f"""<u><b>manga Information Gathered</b></u>
<b>tlele:- {search.results[0].title}
Mal ID:- {search.results[0].mal_id}
Url:- {search.results[0].url}
Type:- {search.results[0].type}
volumes:- {search.results[0].volumes}
Score:- {search.results[0].score}
Synopsis:- {search.results[0].synopsis}
Status:- {manga.status}
Genres:- {jp}
Chapters:- {manga.chapters}
Popularity:- {manga.popularity}
Rank:- {manga.rank}
favorites:- {manga.favorites}</b>
"""
    await pablo.edit(By, parse_mode="html")
コード例 #2
0
async def random_manga_def(message):
    while 1 :
        try :
            number_manga = randint(0, 25000)
            manga = Manga(number_manga)
            await message.channel.send("Si tu sais pas quoi faire, tu peux lire :\nhttps://myanimelist.net/manga/" + str(number_manga))
            break
        except :
            print(number_manga, "error manga")
            continue
コード例 #3
0
 async def get_manga(self, ctx, *args):
     logger.info(Constants.FUN_QUERY_SENT, Constants.MANGA, " ".join(args))
     try:
         manga_search = MangaSearch(" ".join(args))
         manga = Manga((manga_search.results[0]).mal_id)
         await ctx.send(
             Constants.MSG_FUN_RESPONSE.format(manga.title, manga.synopsis,
                                               manga.image_url))
     except Exception:
         logger.error(Constants.FUN_QUERY_ERR, Constants.MANGA,
                      ' '.join(args))
         await ctx.send(
             Constants.MSG_FUN_ERR.format(Constants.MANGA, ' '.join(args)))
コード例 #4
0
ファイル: anime.py プロジェクト: ESSutherland/DiscordBotv2
    async def manga(self, interaction: discord.Interaction, params: str):
        print(
            f'{interaction.user}({interaction.user.id}) executed Manga command.'
        )
        await interaction.response.send_message(embed=discord.Embed(
            title='Fetching Data...Please Wait.',
            color=self.client.guilds[0].get_member(self.client.user.id).color))

        search = MangaSearch(params)

        if len(search.results) > 0:
            manga_data = search.results[0]

            manga_data_2 = Manga(manga_data.mal_id)

            embed = discord.Embed(title=manga_data.title,
                                  description=manga_data_2.title_japanese,
                                  color=self.client.guilds[0].get_member(
                                      self.client.user.id).color,
                                  url=manga_data.url)
            embed.set_image(url=manga_data.image_url)
            embed.add_field(name='Synopsis',
                            value=manga_data.synopsis,
                            inline=False)
            embed.add_field(name='Volumes',
                            value=str(manga_data_2.volumes),
                            inline=True)
            embed.add_field(name='Status',
                            value=str(manga_data_2.status),
                            inline=True)
            embed.add_field(name='Score',
                            value=str(manga_data.score),
                            inline=True)

            embed.set_footer(text=f'Published: {manga_data_2.published}')

            button = Button(label='View on site',
                            style=discord.ButtonStyle.url,
                            url=manga_data_2.url)
            view = View()
            view.add_item(button)

            await interaction.edit_original_message(embed=embed, view=view)
        else:
            await interaction.edit_original_message(
                embed=await helpers.embed_helper.create_error_embed(
                    f'Could not find any manga similar to {params}'))
コード例 #5
0
async def _(event):
    if event.fwd_from:
        return
    input_str = event.pattern_match.group(1)
    LeO = await edit_or_reply("Please Wait....🚶‍♂️🚶‍♂️🚶‍♂️")
    search = MangaSearch(input_str)
    ID = search.results[0].mal_id
    manga = Manga(ID)
    jp = ""
    for x in manga.genres:
        jp += x + ";  "
    link = manga.image_url
    if link == None:
        link = search.results[0].image_url
    By = f"""<u><b>manga Information Gathered</b></u>
<b>tlele:- {search.results[0].title}
Mal ID:- {search.results[0].mal_id}
Url:- {search.results[0].url}
Type:- {search.results[0].type}
volumes:- {search.results[0].volumes}
Score:- {search.results[0].score}
Synopsis:- {search.results[0].synopsis}
Status:- {manga.status}
Genres:- {jp}
Chapters:- {manga.chapters}
Popularity:- {manga.popularity}
Rank:- {manga.rank}
favorites:- {manga.favorites}</b>
"""
    await borg.send_message(
        event.chat_id,
        By,
        parse_mode="HTML",
        file=link,
        force_document=False,
        silent=True,
    )
    await LeO.delete()
コード例 #6
0
ファイル: manga.py プロジェクト: darenliang/mal-api
 def setUpClass(cls):
     cls.manga = Manga(1)
コード例 #7
0
 async def aboutmanga(self, ctx: commands.Context, mal_id: int):
     """Displays about the manga using the MAL MANGA ID. get it by using mangasearch command."""
     message = await ctx.send(":mag: Searching...", delete_after=5)
     manga = Manga(int(mal_id))
     embeds = []
     e = Embed(
         title=manga.title,
         description=manga.synopsis[:4096],
         timestamp=ctx.message.created_at,
     )
     if manga.title_japanese:
         e.add_field(
             name=":japanese_castle: **Title in Japanese**",
             value=f"{manga.title_japanese}",
         )
     if manga.title_synonyms:
         e.add_field(name="**Title Synonyms**",
                     value=" ,".join(manga.title_synonyms))
     if manga.score:
         e.add_field(name=":star: **Score**", value=f"{manga.score} :star:")
     if manga.type:
         e.add_field(name=":dividers: **Type**", value=manga.type)
     if manga.url:
         e.add_field(name=":link: **MAL Url**",
                     value=f"[CLICK HERE]({manga.url})")
     if manga.mal_id:
         e.add_field(name=":id: **MAL ID**", value=manga.mal_id)
     if manga.status:
         e.add_field(name=":hourglass_flowing_sand: **Status**",
                     value=manga.status)
     if manga.genres:
         e.add_field(name=":arrow_right: **Genre**",
                     value=" ,".join(manga.genres))
     if manga.rank:
         e.add_field(name=":trophy: **Rank**", value=manga.rank)
     if manga.popularity:
         e.add_field(name="**Popularity**", value=f"#{manga.popularity}")
     if manga.chapters:
         e.add_field(name=":book: **No. of Chapters**",
                     value=manga.chapters)
     if manga.volumes:
         e.add_field(name=":books: **Volumes**", value=manga.volumes)
     if manga.authors:
         e.add_field(name=":pen_fountain: **Author(s)**",
                     value="\n・".join(manga.authors))
     if manga.published:
         e.add_field(name=":map: **Published**", value=manga.published)
     if manga.characters and len(format_manga_characters(
             manga.characters)) <= 600:
         e.add_field(name="**Characters**",
                     value=format_manga_characters(manga.characters))
     else:
         if manga.characters:
             e1 = Embed(
                 title="Characters",
                 description=format_manga_characters(
                     manga.characters)[:4096],
             )
             e1.set_footer(
                 text=
                 f"{manga.title_japanese} | {manga.mal_id} | {manga.score} stars",
                 icon_url=manga.image_url,
             )
             embeds.append(e1)
     if (manga.related_manga and
             len(format_related_anime_manga(manga.related_manga)) < 1024):
         e.add_field(
             name="**Related Manga**",
             value=format_related_anime_manga(manga.related_manga),
         )
     else:
         if manga.related_manga:
             e1 = Embed(
                 title="Related Manga",
                 description=format_related_anime_manga(
                     manga.related_manga)[:4096],
             )
             e1.set_footer(
                 text=
                 f"{manga.title_japanese} | {manga.mal_id} | {manga.score} stars",
                 icon_url=manga.image_url,
             )
             embeds.append(e1)
     if manga.image_url:
         e.set_image(url=manga.image_url)
     e.set_footer(
         text=
         f"{manga.title_japanese} | {manga.mal_id} | {manga.score} stars",
         icon_url=manga.image_url,
     )
     paginator = EmbedPaginator(entries=[e] + embeds, ctx=ctx)
     await paginator.start()