Esempio n. 1
0
 async def hijridate(self, ctx):
     hijri = self.get_current_hijri()
     today = date.today()
     em = make_embed(colour=0x72bcd4,
                     author="Today's Hijri Date",
                     description=hijri + f'\n{today}',
                     author_icon=ICON)
     await ctx.send(embed=em)
Esempio n. 2
0
    async def quran(self, ctx, ref: str, edition: str = 'haleem'):
        async with ctx.channel.typing():

            # If no translation was specified, find a translation to use.
            if edition is None:
                try:

                    # edition = await get_guild_translation(ctx.message.guild.id)
                    edition = self.format_edition(edition)
                except AttributeError:
                    edition = 85

            # If a translation was specified in the command, check whether it is valid:
            else:
                try:
                    edition = self.format_edition(edition)
                except KeyError:
                    return await ctx.send(INVALID_TRANSLATION)

            # Now fetch the verses:
            try:
                spec = self.get_spec(ref, edition)
            except:
                return await ctx.send(
                    INVALID_ARGUMENTS_ENGLISH.format(get_prefix(ctx)))

            surah_name, readable_edition, revelation_type = await self.get_metadata(
                spec, edition)
            translated_surah_name = await self.get_translated_surah_name(
                spec, edition)

            if revelation_type == "makkah":
                revelation_type = "Meccan"
            else:
                revelation_type = "Medinan"

            await self.get_verses(spec)

            em = make_embed(
                fields=spec.ordered_dict,
                author=f"Surah {surah_name} ({translated_surah_name})",
                author_icon=ICON,
                colour=0x048c28,
                inline=False,
                footer=f'Translation: {readable_edition} |'
                f' {revelation_type}')

            if len(em) > 6000:
                return await ctx.send("This passage was too long to send.")

            await ctx.send(embed=em)
Esempio n. 3
0
    async def convertfromhijri(self, ctx, hijri_date: str):
        try:
            hijri_date = datetime.strptime(hijri_date, "%d-%m-%Y").date()
        except:
            return await ctx.send(DATE_INVALID)

        try:
            hijri = self.get_gregorian(hijri_date=hijri_date)
        except OverflowError:
            return await ctx.send(HIJRI_DATE_OUT_OF_RANGE)

        em = make_embed(colour=0x72bcd4,
                        author="Hijri → Gregorian Conversion",
                        description=hijri,
                        author_icon=ICON)
        await ctx.send(embed=em)
Esempio n. 4
0
    async def converttohijri(self, ctx, gregorian_date: str):
        try:
            gregorian_date = datetime.strptime(gregorian_date,
                                               "%d-%m-%Y").date()
        except:
            return await ctx.send(DATE_INVALID)

        try:
            hijri = self.get_hijri(gregorian_date=gregorian_date)
        except OverflowError:
            return await ctx.send(GREGORIAN_DATE_OUT_OF_RANGE)

        em = make_embed(colour=0x72bcd4,
                        author="Gregorian → Hijri Conversion",
                        description=hijri,
                        author_icon=ICON)
        await ctx.send(embed=em)
Esempio n. 5
0
    async def aquran(self, ctx, *, ref: str):
        try:
            spec = self.get_spec(ref)
        except:
            return await ctx.send(
                INVALID_ARGUMENTS_ARABIC.format(get_prefix(ctx)))

        surah_name = await self.get_metadata(spec, edition='ar')
        await self.get_verses(spec)

        em = make_embed(fields=spec.ordered_dict,
                        author=f' سورة {surah_name}',
                        author_icon=ICON,
                        colour=0x048c28,
                        inline=False,
                        footer="")

        if len(em) > 6000:
            return await ctx.send("This passage was too long to send.")

        await ctx.send(embed=em)