From 37fa3c2af994d7e44d3733aa4e9575ae14bfd61d Mon Sep 17 00:00:00 2001 From: Anubhav1603 Date: Tue, 22 Sep 2020 17:14:32 +0530 Subject: added json file for zodiac explantion --- bot/resources/valentines/zodiac_explanation.json | 98 ++++++++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 bot/resources/valentines/zodiac_explanation.json diff --git a/bot/resources/valentines/zodiac_explanation.json b/bot/resources/valentines/zodiac_explanation.json new file mode 100644 index 00000000..ccca6fcd --- /dev/null +++ b/bot/resources/valentines/zodiac_explanation.json @@ -0,0 +1,98 @@ +{ + "Aries":{ + "About":"Amazing people born between **March 21** to **April 19**. Aries loves to be number one, so it’s no surprise that these audacious rams are the first sign of the zodiac. Bold and ambitious, Aries dives headfirst into even the most challenging situations.", + "Motto":"***“When you know yourself, you're empowered. When you accept yourself, you're invincible.”***", + "Strengths":"courageous, determined, confident, enthusiastic, optimistic, honest, passionate.", + "Weaknesses":"impatient, moody, short-tempered, impulsive, aggressive.", + "full_form":"**A** for assertive\n**R** for refreshing\n **I** for independent\n**E** for energetic\n**S** for sexy", + "url":"https://www.horoscope.com/images-US/signs/profile-aries.png" + }, + "Taurus": { + "About": "Amazing people born between **April 20** to **May 20**. Taurus is an earth sign represented by the bull. Like their celestial spirit animal, Taureans enjoy relaxing in serene, bucolic environments surrounded by soft sounds, soothing aromas, and succulent flavors", + "Motto": "***“Nothing worth having comes easy.”***", + "Strengths": "reliable, patient, practical, devoted, responsible, stable.", + "Weaknesses": "stubborn, possessive, uncompromising.", + "full_form": "***T*** for trailblazing\n***A*** for ambitious\n***U*** for unwavering\n***R*** for reliable\n***U*** for understanding\n***S*** for stable", + "url": "https://www.horoscope.com/images-US/signs/profile-taurus.png" + }, + "Gemini":{ + "About": "Amazing people born between **May 21** to **June 20**. Have you ever been so busy that you wished you could clone yourself just to get everything done? That’s the Gemini experience in a nutshell. Appropriately symbolized by the celestial twins, this air sign was interested in so many pursuits that it had to double itself.", + "Motto": "***“I manifest my reality.”***", + "Strengths": "gentle, affectionate, curious, adaptable, ability to learn quickly and exchange ideas.", + "Weaknesses": "nervous, inconsistent, indecisive.", + "full_form": "***G*** for generous\n***E*** for emotionally in tune\n***M*** for motivated\n***I*** for imaginative\n***N*** for nice\n***I*** for intelligent", + "url": "https://www.horoscope.com/images-US/signs/profile-gemini.png" + }, + "Cancer":{ + "About": "Amazing people born between **June 21 ** to **July 22**. Cancer is a cardinal water sign. Represented by the crab, this crustacean seamlessly weaves between the sea and shore representing Cancer’s ability to exist in both emotional and material realms. Cancers are highly intuitive and their psychic abilities manifest in tangible spaces: For instance, Cancers can effortlessly pick up the energies in a room.", + "Motto": "***“I feel, therefore I am.”***", + "Strengths": "tenacious, highly imaginative, loyal, emotional, sympathetic, persuasive.", + "Weaknesses": "moody, pessimistic, suspicious, manipulative, insecuremoody, pessimistic, suspicious, manipulative, insecure.", + "full_form": "***C*** for caring\n***A*** for ambitious\n***N*** for nourishing\n***C*** for creative\n***E*** for emotionally intelligent\n***R*** for resilient", + "url": "https://www.horoscope.com/images-US/signs/profile-cancer.png" + }, + "Leo":{ + "About": "Amazing people born between **July 23** to **August 22**. Roll out the red carpet because Leo has arrived. Leo is represented by the lion and these spirited fire signs are the kings and queens of the celestial jungle. They’re delighted to embrace their royal status: Vivacious, theatrical, and passionate, Leos love to bask in the spotlight and celebrate themselves.", + "Motto": "***“If you know the way, go the way and show the way—you're a leader.”***", + "Strengths": "creative, passionate, generous, warm-hearted, cheerful, humorous.", + "Weaknesses": "arrogant, stubborn, self-centered, lazy, inflexible.", + "full_form": "***L*** for leaders\n***E*** for energetic\n***O*** for optimistic", + "url": "https://www.horoscope.com/images-US/signs/profile-leo.png" + }, + "Virgo":{ + "About": "Amazing people born between **August 23** to **September 22**. Virgo is an earth sign historically represented by the goddess of wheat and agriculture, an association that speaks to Virgo’s deep-rooted presence in the material world. Virgos are logical, practical, and systematic in their approach to life. This earth sign is a perfectionist at heart and isn’t afraid to improve skills through diligent and consistent practice.", + "Motto": "***“My best can always be better.”***", + "Strengths": "loyal, analytical, kind, hardworking, practical.", + "Weaknesses": "shyness, worry, overly critical of self and others, all work and no play.", + "full_form": "***V*** for virtuous\n***I*** for intelligent\n***R*** for responsible\n***G*** for generous\n***O*** for optimistic", + "url": "https://www.horoscope.com/images-US/signs/profile-virgo.png" + }, + "Libra":{ + "About": "Amazing people born between **September 23** to **October 22**. Libra is an air sign represented by the scales (interestingly, the only inanimate object of the zodiac), an association that reflects Libra's fixation on balance and harmony. Libra is obsessed with symmetry and strives to create equilibrium in all areas of life.", + "Motto": "***“No person is an island.”***", + "Strengths": "cooperative, diplomatic, gracious, fair-minded, social.", + "Weaknesses": "indecisive, avoids confrontations, will carry a grudge, self-pity.", + "full_form": "***L*** for loyal\n***I*** for inquisitive\n***B*** for balanced\n***R*** for responsible\n***A*** for altruistic", + "url": "https://www.horoscope.com/images-US/signs/profile-libra.png" + }, + "Scorpio":{ + "About": "Amazing people born between **October 23** to **November 21**. Scorpio is one of the most misunderstood signs of the zodiac. Because of its incredible passion and power, Scorpio is often mistaken for a fire sign. In fact, Scorpio is a water sign that derives its strength from the psychic, emotional realm.", + "Motto": "***“You never know what you are capable of until you try.”***", + "Strengths": "resourceful, brave, passionate, stubborn, a true friend.", + "Weaknesses": "distrusting, jealous, secretive, violent.", + "full_form": "***S*** for seductive\n***C*** for cerebral\n***O*** for original\n***R*** for reactive\n***P*** for passionate\n***I*** for intuitive\n***O*** for outstanding", + "url": "https://www.horoscope.com/images-US/signs/profile-scorpio.png" + }, + "Sagittarius":{ + "About": "Amazing people born between **November 22** to **December 21**. Represented by the archer, Sagittarians are always on a quest for knowledge. The last fire sign of the zodiac, Sagittarius launches its many pursuits like blazing arrows, chasing after geographical, intellectual, and spiritual adventures.", + "Motto": "***“Towering genius disdains a beaten path.”***", + "Strengths": "generous, idealistic, great sense of humor.", + "Weaknesses": "promises more than can deliver, very impatient, will say anything no matter how undiplomatic.", + "full_form": "***S*** for seductive\n***A*** for adventurous\n***G*** for grateful\n***I*** for intelligent\n***T*** for trailblazing\n***T*** for tenacious adept\n***A*** for adept\n***R*** for responsible\n***I*** for idealistic\n***U*** for unparalled\n***S*** for sophisticated", + "url": "https://www.horoscope.com/images-US/signs/profile-sagittarius.png" + }, + "Capricorn":{ + "About": "Amazing people born between **December 22** to **January 19**. The last earth sign of the zodiac, Capricorn is represented by the sea goat, a mythological creature with the body of a goat and tail of a fish. Accordingly, Capricorns are skilled at navigating both the material and emotional realms.", + "Motto": "***“I can succeed at anything I put my mind to.”***", + "Strengths": "responsible, disciplined, self-control, good managers.", + "Weaknesses": "know-it-all, unforgiving, condescending, expecting the worst.", + "full_form": "***C*** for confident\n***A*** for analytical\n***P*** for practical\n***R*** for responsible\n***I*** for intelligent\n***C*** for caring\n***O*** for organized\n***R*** for realistic\n***N*** for neat", + "url": "https://www.horoscope.com/images-US/signs/profile-capricorn.png" + }, + "Aquarius":{ + "About": "Amazing people born between **January 20** to **February 18**. Despite the “aqua” in its name, Aquarius is actually the last air sign of the zodiac. Aquarius is represented by the water bearer, the mystical healer who bestows water, or life, upon the land. Accordingly, Aquarius is the most humanitarian astrological sign.", + "Motto": "***“There is no me, there is only we.”***", + "Strengths": "Progressive, original, independent, humanitarian.", + "Weaknesses": "Runs from emotional expression, temperamental, uncompromising, aloof.", + "full_form": "***A*** for analytical\n***Q*** for quirky\n***U*** for uncompromising\n***A*** for action-focused\n***R*** for respectful\n***I*** for intelligent\n***U*** for unique\n***S*** for sincere", + "url": "https://www.horoscope.com/images-US/signs/profile-aquarius.png" + }, + "Pisces":{ + "About": "Amazing people born between **February 19** to **March 20**. Pisces, a water sign, is the last constellation of the zodiac. It's symbolized by two fish swimming in opposite directions, representing the constant division of Pisces' attention between fantasy and reality. As the final sign, Pisces has absorbed every lesson — the joys and the pain, the hopes and the fears — learned by all of the other signs.", + "Motto": "***“I have a lot of love to give, it only takes a little patience and those worth giving it all to.”***", + "Strengths": "Compassionate, artistic, intuitive, gentle, wise, musical.", + "Weaknesses": "Fearful, overly trusting, sad, desire to escape reality, can be a victim or a martyr.", + "full_form": "***P*** for psychic\n***I*** for intelligent\n***S*** for surprising\n***C*** for creative\n***E*** for emotionally-driven\n***S*** for sensitive", + "url": "https://www.horoscope.com/images-US/signs/profile-pisces.png" + } +} -- cgit v1.2.3 From 3609a35d5e50f88d7189f0124eadcadd220768bc Mon Sep 17 00:00:00 2001 From: Anubhav1603 Date: Tue, 22 Sep 2020 17:15:43 +0530 Subject: added zodiac sign list --- bot/exts/valentines/valentine_zodiac.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bot/exts/valentines/valentine_zodiac.py b/bot/exts/valentines/valentine_zodiac.py index ef9ddc78..5d36314d 100644 --- a/bot/exts/valentines/valentine_zodiac.py +++ b/bot/exts/valentines/valentine_zodiac.py @@ -13,6 +13,9 @@ log = logging.getLogger(__name__) LETTER_EMOJI = ':love_letter:' HEART_EMOJIS = [":heart:", ":gift_heart:", ":revolving_hearts:", ":sparkling_heart:", ":two_hearts:"] +zodiac_signs = ["Aries", "Taurus", "Gemini", "Cancer", "Leo", "Virgo", "Libra", + "Scorpio", "Sagittarius", "Capricorn", "Aquarius", "Pisces"] + class ValentineZodiac(commands.Cog): """A Cog that returns a counter compatible zodiac sign to the given user's zodiac sign.""" -- cgit v1.2.3 From 69b17d575deadbcae3dbc07bd156824a263ebdc2 Mon Sep 17 00:00:00 2001 From: Anubhav1603 Date: Tue, 22 Sep 2020 17:44:52 +0530 Subject: added subcommand zodiac --- bot/exts/valentines/valentine_zodiac.py | 38 ++++++++++++++++++++++++++++++--- 1 file changed, 35 insertions(+), 3 deletions(-) diff --git a/bot/exts/valentines/valentine_zodiac.py b/bot/exts/valentines/valentine_zodiac.py index 5d36314d..f4e4ac34 100644 --- a/bot/exts/valentines/valentine_zodiac.py +++ b/bot/exts/valentines/valentine_zodiac.py @@ -17,6 +17,11 @@ zodiac_signs = ["Aries", "Taurus", "Gemini", "Cancer", "Leo", "Virgo", "Libra", "Scorpio", "Sagittarius", "Capricorn", "Aquarius", "Pisces"] +with open(Path("bot/resources/valentines/zodiac_explanation.json"), "r", encoding="utf8") as file: + """Load zodiac zodiac explanation from static JSON resource.""" + zodiac_fact = load(file) + + class ValentineZodiac(commands.Cog): """A Cog that returns a counter compatible zodiac sign to the given user's zodiac sign.""" @@ -32,13 +37,33 @@ class ValentineZodiac(commands.Cog): zodiacs = load(json_data) return zodiacs - @commands.command(name="partnerzodiac") - async def counter_zodiac(self, ctx: commands.Context, zodiac_sign: str) -> None: + def zodiac_sign_verify(self, zodiac: str) -> discord.Embed: + """Gives informative zodiac embed.""" + c_zodiac = zodiac.capitalize() + embed = discord.Embed() + embed.color = Colours.pink + if c_zodiac in zodiac_signs: + log.info("Making zodiac embed") + embed.title = f"__{c_zodiac}__" + embed.description = zodiac_fact[f"{c_zodiac}"]["About"] + embed.add_field(name='__Full form__', value=zodiac_fact[f"{c_zodiac}"]["full_form"], inline=False) + embed.add_field(name='__Motto__', value=zodiac_fact[f"{c_zodiac}"]["Motto"], inline=False) + embed.add_field(name='__Strengths__', value=zodiac_fact[f"{c_zodiac}"]["Strengths"], inline=False) + embed.add_field(name='__Weaknesses__', value=zodiac_fact[f"{c_zodiac}"]["Weaknesses"], inline=False) + embed.set_thumbnail(url=zodiac_fact[f"{c_zodiac}"]["url"]) + else: + embed.description = "Umm you gave wrong zodiac name so i aren't able to find any :sweat_smile:" + log.info("Wrong Zodiac name provided") + return embed + log.info("Zodiac embed ready") + + @commands.group(name="partnerzodiac", invoke_without_command=True) + async def partner_zodiac(self, ctx: commands.Context, zodiac_sign: str) -> None: """Provides a counter compatible zodiac sign to the given user's zodiac sign.""" try: compatible_zodiac = random.choice(self.zodiacs[zodiac_sign.lower()]) except KeyError: - return await ctx.send(zodiac_sign.capitalize() + " zodiac sign does not exist.") + return await ctx.send(f"`{zodiac_sign.capitalize()}` zodiac sign does not exist.") emoji1 = random.choice(HEART_EMOJIS) emoji2 = random.choice(HEART_EMOJIS) @@ -54,6 +79,13 @@ class ValentineZodiac(commands.Cog): ) await ctx.send(embed=embed) + @partner_zodiac.command(name='zodiac') + async def zodiac(self, ctx: commands.Context, zodiac_sign: str) -> None: + """Provides information about zodiac sign by taking zodiac sign name as input.""" + final_embed = self.zodiac_sign_verify(zodiac_sign) + log.info("Embed successfully sent") + await ctx.send(embed=final_embed) + def setup(bot: commands.Bot) -> None: """Valentine zodiac Cog load.""" -- cgit v1.2.3 From 873512a135e614409af8114c7856fcd13ccb3c79 Mon Sep 17 00:00:00 2001 From: Anubhav1603 Date: Tue, 22 Sep 2020 17:52:19 +0530 Subject: added subcommand date and removed a from doc string of date --- bot/exts/valentines/valentine_zodiac.py | 109 ++++++++++++++++++++++++++++++++ 1 file changed, 109 insertions(+) diff --git a/bot/exts/valentines/valentine_zodiac.py b/bot/exts/valentines/valentine_zodiac.py index f4e4ac34..66762134 100644 --- a/bot/exts/valentines/valentine_zodiac.py +++ b/bot/exts/valentines/valentine_zodiac.py @@ -57,6 +57,100 @@ class ValentineZodiac(commands.Cog): return embed log.info("Zodiac embed ready") + def zodiac_date_verifer(self, month: str, date: int) -> str: + """Returns zodiac sign by checking month and date.""" + month = month.capitalize() + log.info("started searching zodaic sign based on month and date") + if month == "January" or month == "Jan": + if date >= 1 and date <= 19: + zodiac = "Capricorn" + elif date >= 20 and date <= 31: + zodiac = "Aquarius" + else: + zodiac = None + elif month == "Feburary" or month == "Feb": + if date >= 1 and date <= 18: + zodiac = "Aquarius" + elif date >= 19 and date <= 29: + zodiac = "Pisces" + else: + zodiac = None + elif month == "March" or month == "Mar": + if date >= 1 and date <= 20: + zodiac = "Pisces" + elif date >= 21 and date <= 31: + zodiac = "Aries" + else: + zodiac = None + elif month == "April" or month == "Apr": + if date >= 1 and date <= 19: + zodiac = "Aries" + elif date >= 20 and date <= 30: + zodiac = "Taurus" + else: + zodiac = None + elif month == "May": + if date >= 1 and date <= 20: + zodiac = "Taurus" + elif date >= 21 and date <= 31: + zodiac = "Gemini" + else: + zodiac = None + elif month == "June" or month == "Jun": + if date >= 1 and date <= 20: + zodiac = "Gemini" + elif date >= 21 and date <= 30: + zodiac = "Cancer" + else: + zodiac = None + elif month == "July" or month == "Jul": + if date >= 1 and date <= 22: + zodiac = "Cancer" + elif date >= 23 and date <= 31: + zodiac = "Leo" + else: + zodiac = None + elif month == "August" or month == "Aug": + if date >= 1 and date <= 22: + zodiac = "Leo" + elif date >= 23 and date <= 31: + zodiac = "Virgo" + else: + zodiac = None + elif month == "September" or month == "Sept": + if date >= 1 and date <= 22: + zodiac = "Virgo" + elif date >= 23 and date <= 30: + zodiac = "Libra" + else: + zodiac = None + elif month == "October" or month == "Oct": + if date >= 1 and date <= 22: + zodiac = "Libra" + elif date >= 23 and date <= 31: + zodiac = "Scorpio" + else: + zodiac = None + elif month == "November" or month == "Nov": + if date >= 1 and date <= 21: + zodiac = "Scorpio" + elif date >= 22 and date <= 30: + zodiac = "Sagittarius" + else: + zodiac = None + elif month == "December" or month == "Dec": + if date >= 1 and date <= 21: + zodiac = "Sagittarius" + elif date >= 22 and date <= 31: + zodiac = "Capricorn" + else: + zodiac = None + else: + zodiac = None + log.info("Wrong Zodiac date or month provided") + return zodiac + log.info("Zodiac name sent") + @commands.group(name="partnerzodiac", invoke_without_command=True) async def partner_zodiac(self, ctx: commands.Context, zodiac_sign: str) -> None: """Provides a counter compatible zodiac sign to the given user's zodiac sign.""" @@ -86,6 +180,21 @@ class ValentineZodiac(commands.Cog): log.info("Embed successfully sent") await ctx.send(embed=final_embed) + @partner_zodiac.command(name="date") + async def date_and_month(self, ctx: commands.Context, month: str, date: int) -> None: + """Provides information about zodiac sign by taking month and date as input.""" + zodiac_sign_based_on_month_and_date = self.zodiac_date_verifer(month, date) + log.info("zodiac sign based on month and date received") + if zodiac_sign_based_on_month_and_date is None: + log.info("zodiac sign based on month and date returned None") + final_embed = discord.Embed() + final_embed.color = Colours.pink + final_embed.description = "You provided wrong date or month so i aren't able to find any zodiac sign" + else: + final_embed = self.zodiac_sign_verify(zodiac_sign_based_on_month_and_date) + log.info("zodiac sign embed based on month and date is now sent") + await ctx.send(embed=final_embed) + def setup(bot: commands.Bot) -> None: """Valentine zodiac Cog load.""" -- cgit v1.2.3 From 8f2b68044e327278d5af0a535c46d6724b1b7aa2 Mon Sep 17 00:00:00 2001 From: Anubhav1603 Date: Wed, 23 Sep 2020 16:01:09 +0530 Subject: modified zodiac_sign_verifer --- bot/exts/valentines/valentine_zodiac.py | 100 +++----------------------------- 1 file changed, 9 insertions(+), 91 deletions(-) diff --git a/bot/exts/valentines/valentine_zodiac.py b/bot/exts/valentines/valentine_zodiac.py index 66762134..e020548c 100644 --- a/bot/exts/valentines/valentine_zodiac.py +++ b/bot/exts/valentines/valentine_zodiac.py @@ -1,5 +1,6 @@ import logging import random +from datetime import datetime from json import load from pathlib import Path @@ -20,6 +21,8 @@ zodiac_signs = ["Aries", "Taurus", "Gemini", "Cancer", "Leo", "Virgo", "Libra", with open(Path("bot/resources/valentines/zodiac_explanation.json"), "r", encoding="utf8") as file: """Load zodiac zodiac explanation from static JSON resource.""" zodiac_fact = load(file) +year = datetime.now().year +zodiac_date = {"Aries": (datetime(year, 1, 20), datetime(year, 2, 18))} class ValentineZodiac(commands.Cog): @@ -57,96 +60,11 @@ class ValentineZodiac(commands.Cog): return embed log.info("Zodiac embed ready") - def zodiac_date_verifer(self, month: str, date: int) -> str: + def zodiac_date_verifer(self, query_datetime: datetime) -> str: """Returns zodiac sign by checking month and date.""" - month = month.capitalize() - log.info("started searching zodaic sign based on month and date") - if month == "January" or month == "Jan": - if date >= 1 and date <= 19: - zodiac = "Capricorn" - elif date >= 20 and date <= 31: - zodiac = "Aquarius" - else: - zodiac = None - elif month == "Feburary" or month == "Feb": - if date >= 1 and date <= 18: - zodiac = "Aquarius" - elif date >= 19 and date <= 29: - zodiac = "Pisces" - else: - zodiac = None - elif month == "March" or month == "Mar": - if date >= 1 and date <= 20: - zodiac = "Pisces" - elif date >= 21 and date <= 31: - zodiac = "Aries" - else: - zodiac = None - elif month == "April" or month == "Apr": - if date >= 1 and date <= 19: - zodiac = "Aries" - elif date >= 20 and date <= 30: - zodiac = "Taurus" - else: - zodiac = None - elif month == "May": - if date >= 1 and date <= 20: - zodiac = "Taurus" - elif date >= 21 and date <= 31: - zodiac = "Gemini" - else: - zodiac = None - elif month == "June" or month == "Jun": - if date >= 1 and date <= 20: - zodiac = "Gemini" - elif date >= 21 and date <= 30: - zodiac = "Cancer" - else: - zodiac = None - elif month == "July" or month == "Jul": - if date >= 1 and date <= 22: - zodiac = "Cancer" - elif date >= 23 and date <= 31: - zodiac = "Leo" - else: - zodiac = None - elif month == "August" or month == "Aug": - if date >= 1 and date <= 22: - zodiac = "Leo" - elif date >= 23 and date <= 31: - zodiac = "Virgo" - else: - zodiac = None - elif month == "September" or month == "Sept": - if date >= 1 and date <= 22: - zodiac = "Virgo" - elif date >= 23 and date <= 30: - zodiac = "Libra" - else: - zodiac = None - elif month == "October" or month == "Oct": - if date >= 1 and date <= 22: - zodiac = "Libra" - elif date >= 23 and date <= 31: - zodiac = "Scorpio" - else: - zodiac = None - elif month == "November" or month == "Nov": - if date >= 1 and date <= 21: - zodiac = "Scorpio" - elif date >= 22 and date <= 30: - zodiac = "Sagittarius" - else: - zodiac = None - elif month == "December" or month == "Dec": - if date >= 1 and date <= 21: - zodiac = "Sagittarius" - elif date >= 22 and date <= 31: - zodiac = "Capricorn" - else: - zodiac = None - else: - zodiac = None + for zodiac_name, date_range in zodiac_date.items(): + if (date_range[0] <= query_datetime <= date_range[1]): + zodiac = zodiac_name log.info("Wrong Zodiac date or month provided") return zodiac log.info("Zodiac name sent") @@ -181,9 +99,9 @@ class ValentineZodiac(commands.Cog): await ctx.send(embed=final_embed) @partner_zodiac.command(name="date") - async def date_and_month(self, ctx: commands.Context, month: str, date: int) -> None: + async def date_and_month(self, ctx: commands.Context, month: int, date: int) -> None: """Provides information about zodiac sign by taking month and date as input.""" - zodiac_sign_based_on_month_and_date = self.zodiac_date_verifer(month, date) + zodiac_sign_based_on_month_and_date = self.zodiac_date_verifer(datetime(year, month, date)) log.info("zodiac sign based on month and date received") if zodiac_sign_based_on_month_and_date is None: log.info("zodiac sign based on month and date returned None") -- cgit v1.2.3 From ceaf27c9bcb5f4afe4c867d576ddfa5d2c79d46b Mon Sep 17 00:00:00 2001 From: Anubhav1603 Date: Thu, 24 Sep 2020 16:35:38 +0530 Subject: added starting date and ending date of zodiac sign in json --- bot/resources/valentines/zodiac_explanation.json | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/bot/resources/valentines/zodiac_explanation.json b/bot/resources/valentines/zodiac_explanation.json index ccca6fcd..ce8dd5ec 100644 --- a/bot/resources/valentines/zodiac_explanation.json +++ b/bot/resources/valentines/zodiac_explanation.json @@ -1,5 +1,7 @@ { "Aries":{ + "start_at":[3, 21], + "end_at": [4, 19], "About":"Amazing people born between **March 21** to **April 19**. Aries loves to be number one, so it’s no surprise that these audacious rams are the first sign of the zodiac. Bold and ambitious, Aries dives headfirst into even the most challenging situations.", "Motto":"***“When you know yourself, you're empowered. When you accept yourself, you're invincible.”***", "Strengths":"courageous, determined, confident, enthusiastic, optimistic, honest, passionate.", @@ -8,6 +10,8 @@ "url":"https://www.horoscope.com/images-US/signs/profile-aries.png" }, "Taurus": { + "start_at": [4, 20], + "end_at": [5, 20], "About": "Amazing people born between **April 20** to **May 20**. Taurus is an earth sign represented by the bull. Like their celestial spirit animal, Taureans enjoy relaxing in serene, bucolic environments surrounded by soft sounds, soothing aromas, and succulent flavors", "Motto": "***“Nothing worth having comes easy.”***", "Strengths": "reliable, patient, practical, devoted, responsible, stable.", @@ -16,6 +20,8 @@ "url": "https://www.horoscope.com/images-US/signs/profile-taurus.png" }, "Gemini":{ + "start_at": [5, 21], + "end_at": [6, 20], "About": "Amazing people born between **May 21** to **June 20**. Have you ever been so busy that you wished you could clone yourself just to get everything done? That’s the Gemini experience in a nutshell. Appropriately symbolized by the celestial twins, this air sign was interested in so many pursuits that it had to double itself.", "Motto": "***“I manifest my reality.”***", "Strengths": "gentle, affectionate, curious, adaptable, ability to learn quickly and exchange ideas.", @@ -24,6 +30,8 @@ "url": "https://www.horoscope.com/images-US/signs/profile-gemini.png" }, "Cancer":{ + "start_at": [6, 21], + "end_at": [7, 22], "About": "Amazing people born between **June 21 ** to **July 22**. Cancer is a cardinal water sign. Represented by the crab, this crustacean seamlessly weaves between the sea and shore representing Cancer’s ability to exist in both emotional and material realms. Cancers are highly intuitive and their psychic abilities manifest in tangible spaces: For instance, Cancers can effortlessly pick up the energies in a room.", "Motto": "***“I feel, therefore I am.”***", "Strengths": "tenacious, highly imaginative, loyal, emotional, sympathetic, persuasive.", @@ -32,6 +40,8 @@ "url": "https://www.horoscope.com/images-US/signs/profile-cancer.png" }, "Leo":{ + "start_at": [7, 23], + "end_at": [8, 22], "About": "Amazing people born between **July 23** to **August 22**. Roll out the red carpet because Leo has arrived. Leo is represented by the lion and these spirited fire signs are the kings and queens of the celestial jungle. They’re delighted to embrace their royal status: Vivacious, theatrical, and passionate, Leos love to bask in the spotlight and celebrate themselves.", "Motto": "***“If you know the way, go the way and show the way—you're a leader.”***", "Strengths": "creative, passionate, generous, warm-hearted, cheerful, humorous.", @@ -40,6 +50,8 @@ "url": "https://www.horoscope.com/images-US/signs/profile-leo.png" }, "Virgo":{ + "start_at": [8, 23], + "end_at": [9, 22], "About": "Amazing people born between **August 23** to **September 22**. Virgo is an earth sign historically represented by the goddess of wheat and agriculture, an association that speaks to Virgo’s deep-rooted presence in the material world. Virgos are logical, practical, and systematic in their approach to life. This earth sign is a perfectionist at heart and isn’t afraid to improve skills through diligent and consistent practice.", "Motto": "***“My best can always be better.”***", "Strengths": "loyal, analytical, kind, hardworking, practical.", @@ -48,6 +60,8 @@ "url": "https://www.horoscope.com/images-US/signs/profile-virgo.png" }, "Libra":{ + "start_at": [9, 23], + "end_at": [10, 22], "About": "Amazing people born between **September 23** to **October 22**. Libra is an air sign represented by the scales (interestingly, the only inanimate object of the zodiac), an association that reflects Libra's fixation on balance and harmony. Libra is obsessed with symmetry and strives to create equilibrium in all areas of life.", "Motto": "***“No person is an island.”***", "Strengths": "cooperative, diplomatic, gracious, fair-minded, social.", @@ -56,6 +70,8 @@ "url": "https://www.horoscope.com/images-US/signs/profile-libra.png" }, "Scorpio":{ + "start_at": [10, 23], + "end_at": [11, 21], "About": "Amazing people born between **October 23** to **November 21**. Scorpio is one of the most misunderstood signs of the zodiac. Because of its incredible passion and power, Scorpio is often mistaken for a fire sign. In fact, Scorpio is a water sign that derives its strength from the psychic, emotional realm.", "Motto": "***“You never know what you are capable of until you try.”***", "Strengths": "resourceful, brave, passionate, stubborn, a true friend.", @@ -64,6 +80,8 @@ "url": "https://www.horoscope.com/images-US/signs/profile-scorpio.png" }, "Sagittarius":{ + "start_at": [11, 22], + "end_at": [12, 21], "About": "Amazing people born between **November 22** to **December 21**. Represented by the archer, Sagittarians are always on a quest for knowledge. The last fire sign of the zodiac, Sagittarius launches its many pursuits like blazing arrows, chasing after geographical, intellectual, and spiritual adventures.", "Motto": "***“Towering genius disdains a beaten path.”***", "Strengths": "generous, idealistic, great sense of humor.", @@ -72,6 +90,8 @@ "url": "https://www.horoscope.com/images-US/signs/profile-sagittarius.png" }, "Capricorn":{ + "start_at": [12, 22], + "end_at": [1, 19], "About": "Amazing people born between **December 22** to **January 19**. The last earth sign of the zodiac, Capricorn is represented by the sea goat, a mythological creature with the body of a goat and tail of a fish. Accordingly, Capricorns are skilled at navigating both the material and emotional realms.", "Motto": "***“I can succeed at anything I put my mind to.”***", "Strengths": "responsible, disciplined, self-control, good managers.", @@ -80,6 +100,8 @@ "url": "https://www.horoscope.com/images-US/signs/profile-capricorn.png" }, "Aquarius":{ + "start_at": [1, 20], + "end_at": [2,18], "About": "Amazing people born between **January 20** to **February 18**. Despite the “aqua” in its name, Aquarius is actually the last air sign of the zodiac. Aquarius is represented by the water bearer, the mystical healer who bestows water, or life, upon the land. Accordingly, Aquarius is the most humanitarian astrological sign.", "Motto": "***“There is no me, there is only we.”***", "Strengths": "Progressive, original, independent, humanitarian.", @@ -88,6 +110,8 @@ "url": "https://www.horoscope.com/images-US/signs/profile-aquarius.png" }, "Pisces":{ + "start_at": [2, 19], + "end_at": [3, 20], "About": "Amazing people born between **February 19** to **March 20**. Pisces, a water sign, is the last constellation of the zodiac. It's symbolized by two fish swimming in opposite directions, representing the constant division of Pisces' attention between fantasy and reality. As the final sign, Pisces has absorbed every lesson — the joys and the pain, the hopes and the fears — learned by all of the other signs.", "Motto": "***“I have a lot of love to give, it only takes a little patience and those worth giving it all to.”***", "Strengths": "Compassionate, artistic, intuitive, gentle, wise, musical.", -- cgit v1.2.3 From d83c3f058e1e6f0b249894331485daa27399ea0e Mon Sep 17 00:00:00 2001 From: Anubhav1603 Date: Thu, 24 Sep 2020 16:37:23 +0530 Subject: changed type of month and merged 2 static method into 1 --- bot/exts/valentines/valentine_zodiac.py | 39 +++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/bot/exts/valentines/valentine_zodiac.py b/bot/exts/valentines/valentine_zodiac.py index e020548c..611d6e60 100644 --- a/bot/exts/valentines/valentine_zodiac.py +++ b/bot/exts/valentines/valentine_zodiac.py @@ -14,38 +14,35 @@ log = logging.getLogger(__name__) LETTER_EMOJI = ':love_letter:' HEART_EMOJIS = [":heart:", ":gift_heart:", ":revolving_hearts:", ":sparkling_heart:", ":two_hearts:"] -zodiac_signs = ["Aries", "Taurus", "Gemini", "Cancer", "Leo", "Virgo", "Libra", +ZODIAC_SIGNS = ["Aries", "Taurus", "Gemini", "Cancer", "Leo", "Virgo", "Libra", "Scorpio", "Sagittarius", "Capricorn", "Aquarius", "Pisces"] -with open(Path("bot/resources/valentines/zodiac_explanation.json"), "r", encoding="utf8") as file: - """Load zodiac zodiac explanation from static JSON resource.""" - zodiac_fact = load(file) -year = datetime.now().year -zodiac_date = {"Aries": (datetime(year, 1, 20), datetime(year, 2, 18))} - - class ValentineZodiac(commands.Cog): """A Cog that returns a counter compatible zodiac sign to the given user's zodiac sign.""" def __init__(self, bot: commands.Bot): self.bot = bot - self.zodiacs = self.load_json() + self.zodiacs, self.zodiac_fact = self.load_comp_json() @staticmethod - def load_json() -> dict: + def load_comp_json() -> dict: """Load zodiac compatibility from static JSON resource.""" + p1 = Path("bot/resources/valentines/zodiac_explanation.json") p = Path("bot/resources/valentines/zodiac_compatibility.json") + with p1.open(encoding="utf8") as json_data: + zodiac_fact = load(json_data) with p.open(encoding="utf8") as json_data: zodiacs = load(json_data) - return zodiacs + return zodiacs, zodiac_fact def zodiac_sign_verify(self, zodiac: str) -> discord.Embed: """Gives informative zodiac embed.""" c_zodiac = zodiac.capitalize() + zodiac_fact = self.zodiac_fact embed = discord.Embed() embed.color = Colours.pink - if c_zodiac in zodiac_signs: + if c_zodiac in ZODIAC_SIGNS: log.info("Making zodiac embed") embed.title = f"__{c_zodiac}__" embed.description = zodiac_fact[f"{c_zodiac}"]["About"] @@ -62,10 +59,15 @@ class ValentineZodiac(commands.Cog): def zodiac_date_verifer(self, query_datetime: datetime) -> str: """Returns zodiac sign by checking month and date.""" - for zodiac_name, date_range in zodiac_date.items(): - if (date_range[0] <= query_datetime <= date_range[1]): + for zodiac_name, date_range in self.zodiac_fact.items(): + value_start = datetime(2020, date_range["start_at"][0], date_range["start_at"][1]).date() + value_end = datetime(2020, date_range["end_at"][0], date_range["end_at"][1]).date() + if value_start <= query_datetime.date() <= value_end: zodiac = zodiac_name - log.info("Wrong Zodiac date or month provided") + break + else: + zodiac = None + log.info("Wrong Zodiac date or month provided") return zodiac log.info("Zodiac name sent") @@ -101,8 +103,11 @@ class ValentineZodiac(commands.Cog): @partner_zodiac.command(name="date") async def date_and_month(self, ctx: commands.Context, month: int, date: int) -> None: """Provides information about zodiac sign by taking month and date as input.""" - zodiac_sign_based_on_month_and_date = self.zodiac_date_verifer(datetime(year, month, date)) - log.info("zodiac sign based on month and date received") + try: + zodiac_sign_based_on_month_and_date = self.zodiac_date_verifer(datetime(2020, month, date)) + log.info("zodiac sign based on month and date received") + except ValueError as e: + await ctx.send(f'You cannot do that, {e}') if zodiac_sign_based_on_month_and_date is None: log.info("zodiac sign based on month and date returned None") final_embed = discord.Embed() -- cgit v1.2.3 From 28d5b05564f79f087d437e06fcf97b3ad9055451 Mon Sep 17 00:00:00 2001 From: Anubhav1603 Date: Thu, 24 Sep 2020 16:46:45 +0530 Subject: replaced c_zodiac with zodiac --- bot/exts/valentines/valentine_zodiac.py | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/bot/exts/valentines/valentine_zodiac.py b/bot/exts/valentines/valentine_zodiac.py index 611d6e60..7d428878 100644 --- a/bot/exts/valentines/valentine_zodiac.py +++ b/bot/exts/valentines/valentine_zodiac.py @@ -38,19 +38,19 @@ class ValentineZodiac(commands.Cog): def zodiac_sign_verify(self, zodiac: str) -> discord.Embed: """Gives informative zodiac embed.""" - c_zodiac = zodiac.capitalize() + zodiac = zodiac.capitalize() zodiac_fact = self.zodiac_fact embed = discord.Embed() embed.color = Colours.pink - if c_zodiac in ZODIAC_SIGNS: + if zodiac in ZODIAC_SIGNS: log.info("Making zodiac embed") - embed.title = f"__{c_zodiac}__" - embed.description = zodiac_fact[f"{c_zodiac}"]["About"] - embed.add_field(name='__Full form__', value=zodiac_fact[f"{c_zodiac}"]["full_form"], inline=False) - embed.add_field(name='__Motto__', value=zodiac_fact[f"{c_zodiac}"]["Motto"], inline=False) - embed.add_field(name='__Strengths__', value=zodiac_fact[f"{c_zodiac}"]["Strengths"], inline=False) - embed.add_field(name='__Weaknesses__', value=zodiac_fact[f"{c_zodiac}"]["Weaknesses"], inline=False) - embed.set_thumbnail(url=zodiac_fact[f"{c_zodiac}"]["url"]) + embed.title = f"__{zodiac}__" + embed.description = zodiac_fact[f"{zodiac}"]["About"] + embed.add_field(name='__Full form__', value=zodiac_fact[f"{zodiac}"]["full_form"], inline=False) + embed.add_field(name='__Motto__', value=zodiac_fact[f"{zodiac}"]["Motto"], inline=False) + embed.add_field(name='__Strengths__', value=zodiac_fact[f"{zodiac}"]["Strengths"], inline=False) + embed.add_field(name='__Weaknesses__', value=zodiac_fact[f"{zodiac}"]["Weaknesses"], inline=False) + embed.set_thumbnail(url=zodiac_fact[f"{zodiac}"]["url"]) else: embed.description = "Umm you gave wrong zodiac name so i aren't able to find any :sweat_smile:" log.info("Wrong Zodiac name provided") @@ -77,7 +77,8 @@ class ValentineZodiac(commands.Cog): try: compatible_zodiac = random.choice(self.zodiacs[zodiac_sign.lower()]) except KeyError: - return await ctx.send(f"`{zodiac_sign.capitalize()}` zodiac sign does not exist.") + await ctx.send(f"`{zodiac_sign.capitalize()}` zodiac sign does not exist.") + return emoji1 = random.choice(HEART_EMOJIS) emoji2 = random.choice(HEART_EMOJIS) -- cgit v1.2.3 From abb493f3aa0fbf7c70f7be7a25943a0465ef18fc Mon Sep 17 00:00:00 2001 From: Anubhav1603 Date: Thu, 24 Sep 2020 16:48:25 +0530 Subject: corrected order of logging --- bot/exts/valentines/valentine_zodiac.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bot/exts/valentines/valentine_zodiac.py b/bot/exts/valentines/valentine_zodiac.py index 7d428878..0fd748f0 100644 --- a/bot/exts/valentines/valentine_zodiac.py +++ b/bot/exts/valentines/valentine_zodiac.py @@ -67,9 +67,9 @@ class ValentineZodiac(commands.Cog): break else: zodiac = None - log.info("Wrong Zodiac date or month provided") - return zodiac + log.info("Wrong Zodiac date or month provided") log.info("Zodiac name sent") + return zodiac @commands.group(name="partnerzodiac", invoke_without_command=True) async def partner_zodiac(self, ctx: commands.Context, zodiac_sign: str) -> None: -- cgit v1.2.3 From 1b8cbc444368bd9ac5130f5944156908f5050386 Mon Sep 17 00:00:00 2001 From: Anubhav1603 Date: Thu, 24 Sep 2020 16:50:34 +0530 Subject: corrected order of logging --- bot/exts/valentines/valentine_zodiac.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bot/exts/valentines/valentine_zodiac.py b/bot/exts/valentines/valentine_zodiac.py index 0fd748f0..12ecf2f8 100644 --- a/bot/exts/valentines/valentine_zodiac.py +++ b/bot/exts/valentines/valentine_zodiac.py @@ -54,8 +54,8 @@ class ValentineZodiac(commands.Cog): else: embed.description = "Umm you gave wrong zodiac name so i aren't able to find any :sweat_smile:" log.info("Wrong Zodiac name provided") - return embed log.info("Zodiac embed ready") + return embed def zodiac_date_verifer(self, query_datetime: datetime) -> str: """Returns zodiac sign by checking month and date.""" -- cgit v1.2.3 From ef6bc8a23a7f49e90e2317f53a4cdb89d8c838dc Mon Sep 17 00:00:00 2001 From: Anubhav1603 Date: Thu, 24 Sep 2020 17:04:15 +0530 Subject: chaanged partnerzodiac group to zodiac group --- bot/exts/valentines/valentine_zodiac.py | 50 ++++++++++++++++----------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/bot/exts/valentines/valentine_zodiac.py b/bot/exts/valentines/valentine_zodiac.py index 12ecf2f8..38ccdf10 100644 --- a/bot/exts/valentines/valentine_zodiac.py +++ b/bot/exts/valentines/valentine_zodiac.py @@ -71,37 +71,14 @@ class ValentineZodiac(commands.Cog): log.info("Zodiac name sent") return zodiac - @commands.group(name="partnerzodiac", invoke_without_command=True) - async def partner_zodiac(self, ctx: commands.Context, zodiac_sign: str) -> None: - """Provides a counter compatible zodiac sign to the given user's zodiac sign.""" - try: - compatible_zodiac = random.choice(self.zodiacs[zodiac_sign.lower()]) - except KeyError: - await ctx.send(f"`{zodiac_sign.capitalize()}` zodiac sign does not exist.") - return - - emoji1 = random.choice(HEART_EMOJIS) - emoji2 = random.choice(HEART_EMOJIS) - embed = discord.Embed( - title="Zodic Compatibility", - description=f'{zodiac_sign.capitalize()}{emoji1}{compatible_zodiac["Zodiac"]}\n' - f'{emoji2}Compatibility meter : {compatible_zodiac["compatibility_score"]}{emoji2}', - color=Colours.pink - ) - embed.add_field( - name=f'A letter from Dr.Zodiac {LETTER_EMOJI}', - value=compatible_zodiac['description'] - ) - await ctx.send(embed=embed) - - @partner_zodiac.command(name='zodiac') + @commands.group(name='zodiac', invoke_without_command=True) async def zodiac(self, ctx: commands.Context, zodiac_sign: str) -> None: """Provides information about zodiac sign by taking zodiac sign name as input.""" final_embed = self.zodiac_sign_verify(zodiac_sign) log.info("Embed successfully sent") await ctx.send(embed=final_embed) - @partner_zodiac.command(name="date") + @zodiac.command(name="date") async def date_and_month(self, ctx: commands.Context, month: int, date: int) -> None: """Provides information about zodiac sign by taking month and date as input.""" try: @@ -119,6 +96,29 @@ class ValentineZodiac(commands.Cog): log.info("zodiac sign embed based on month and date is now sent") await ctx.send(embed=final_embed) + @zodiac.command(name="partnerzodiac") + async def partner_zodiac(self, ctx: commands.Context, zodiac_sign: str) -> None: + """Provides a counter compatible zodiac sign to the given user's zodiac sign.""" + try: + compatible_zodiac = random.choice(self.zodiacs[zodiac_sign.lower()]) + except KeyError: + await ctx.send(f"`{zodiac_sign.capitalize()}` zodiac sign does not exist.") + return + + emoji1 = random.choice(HEART_EMOJIS) + emoji2 = random.choice(HEART_EMOJIS) + embed = discord.Embed( + title="Zodic Compatibility", + description=f'{zodiac_sign.capitalize()}{emoji1}{compatible_zodiac["Zodiac"]}\n' + f'{emoji2}Compatibility meter : {compatible_zodiac["compatibility_score"]}{emoji2}', + color=Colours.pink + ) + embed.add_field( + name=f'A letter from Dr.Zodiac {LETTER_EMOJI}', + value=compatible_zodiac['description'] + ) + await ctx.send(embed=embed) + def setup(bot: commands.Bot) -> None: """Valentine zodiac Cog load.""" -- cgit v1.2.3 From 606f5874cf5a5525db19ecad4dc1178b163f63f1 Mon Sep 17 00:00:00 2001 From: Anubhav1603 Date: Thu, 24 Sep 2020 17:33:30 +0530 Subject: added union to month now it take str and and int both --- bot/exts/valentines/valentine_zodiac.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/bot/exts/valentines/valentine_zodiac.py b/bot/exts/valentines/valentine_zodiac.py index 38ccdf10..6fbce788 100644 --- a/bot/exts/valentines/valentine_zodiac.py +++ b/bot/exts/valentines/valentine_zodiac.py @@ -3,6 +3,7 @@ import random from datetime import datetime from json import load from pathlib import Path +from typing import Union import discord from discord.ext import commands @@ -17,6 +18,12 @@ HEART_EMOJIS = [":heart:", ":gift_heart:", ":revolving_hearts:", ":sparkling_hea ZODIAC_SIGNS = ["Aries", "Taurus", "Gemini", "Cancer", "Leo", "Virgo", "Libra", "Scorpio", "Sagittarius", "Capricorn", "Aquarius", "Pisces"] +MONTH_NAME = {"January": 1, "Jan": 1, "Feburary": 2, "Feb": 2, "March": 3, "Mar": 3, + "April": 4, "Apr": 4, "May": 5, "June": 6, "Jun": 6, "July": 7, "Jul": 7, + "August": 8, "Aug": 8, "September": 9, "Sept": 9, "October": 10, "Oct": 10, + "November": 11, "Nove": 11, "December": 12, "December": 12 + } + class ValentineZodiac(commands.Cog): """A Cog that returns a counter compatible zodiac sign to the given user's zodiac sign.""" @@ -79,8 +86,15 @@ class ValentineZodiac(commands.Cog): await ctx.send(embed=final_embed) @zodiac.command(name="date") - async def date_and_month(self, ctx: commands.Context, month: int, date: int) -> None: + async def date_and_month(self, ctx: commands.Context, date: int, month: Union[int, str]) -> None: """Provides information about zodiac sign by taking month and date as input.""" + if isinstance(month, str): + month = month.capitalize() + if month in MONTH_NAME.keys(): + month = MONTH_NAME[month] + else: + await ctx.send("Sorry, but you have given wrong Month name") + return try: zodiac_sign_based_on_month_and_date = self.zodiac_date_verifer(datetime(2020, month, date)) log.info("zodiac sign based on month and date received") -- cgit v1.2.3 From e88bae4a015d1373307610c0e0035bdd30beddd1 Mon Sep 17 00:00:00 2001 From: Anubhav1603 Date: Thu, 24 Sep 2020 18:07:48 +0530 Subject: handler exception of capricorn --- bot/exts/valentines/valentine_zodiac.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/bot/exts/valentines/valentine_zodiac.py b/bot/exts/valentines/valentine_zodiac.py index 6fbce788..60510377 100644 --- a/bot/exts/valentines/valentine_zodiac.py +++ b/bot/exts/valentines/valentine_zodiac.py @@ -95,6 +95,12 @@ class ValentineZodiac(commands.Cog): else: await ctx.send("Sorry, but you have given wrong Month name") return + if month == 1 or month == 12: + if date >= 1 and date <= 19 or date >= 22 and date <= 31: + zodiac = "Capricorn" + final_embed = self.zodiac_sign_verify(zodiac) + await ctx.send(embed=final_embed) + return try: zodiac_sign_based_on_month_and_date = self.zodiac_date_verifer(datetime(2020, month, date)) log.info("zodiac sign based on month and date received") -- cgit v1.2.3 From 372f8982d2fa9c2c45b2a4c4eac107501261340f Mon Sep 17 00:00:00 2001 From: Anubhav1603 Date: Thu, 24 Sep 2020 19:15:07 +0530 Subject: corrected inconsistent tab --- bot/resources/valentines/zodiac_explanation.json | 176 +++++++++++------------ 1 file changed, 88 insertions(+), 88 deletions(-) diff --git a/bot/resources/valentines/zodiac_explanation.json b/bot/resources/valentines/zodiac_explanation.json index ce8dd5ec..c23d474d 100644 --- a/bot/resources/valentines/zodiac_explanation.json +++ b/bot/resources/valentines/zodiac_explanation.json @@ -1,12 +1,12 @@ { - "Aries":{ + "Aries": { "start_at":[3, 21], "end_at": [4, 19], "About":"Amazing people born between **March 21** to **April 19**. Aries loves to be number one, so it’s no surprise that these audacious rams are the first sign of the zodiac. Bold and ambitious, Aries dives headfirst into even the most challenging situations.", "Motto":"***“When you know yourself, you're empowered. When you accept yourself, you're invincible.”***", "Strengths":"courageous, determined, confident, enthusiastic, optimistic, honest, passionate.", "Weaknesses":"impatient, moody, short-tempered, impulsive, aggressive.", - "full_form":"**A** for assertive\n**R** for refreshing\n **I** for independent\n**E** for energetic\n**S** for sexy", + "full_form":"__**A**__ssertive\n__**R**__efreshing\n__**I**__ndependent\n__**E**__nergetic\n__**S**__exy", "url":"https://www.horoscope.com/images-US/signs/profile-aries.png" }, "Taurus": { @@ -16,107 +16,107 @@ "Motto": "***“Nothing worth having comes easy.”***", "Strengths": "reliable, patient, practical, devoted, responsible, stable.", "Weaknesses": "stubborn, possessive, uncompromising.", - "full_form": "***T*** for trailblazing\n***A*** for ambitious\n***U*** for unwavering\n***R*** for reliable\n***U*** for understanding\n***S*** for stable", + "full_form": "__**T**__railblazing\n__**A**__mbitious\n__**U**__nwavering\n__**R**__eliable\n__**U**__nderstanding\n__**S**__table", "url": "https://www.horoscope.com/images-US/signs/profile-taurus.png" }, - "Gemini":{ + "Gemini": { "start_at": [5, 21], "end_at": [6, 20], "About": "Amazing people born between **May 21** to **June 20**. Have you ever been so busy that you wished you could clone yourself just to get everything done? That’s the Gemini experience in a nutshell. Appropriately symbolized by the celestial twins, this air sign was interested in so many pursuits that it had to double itself.", "Motto": "***“I manifest my reality.”***", "Strengths": "gentle, affectionate, curious, adaptable, ability to learn quickly and exchange ideas.", "Weaknesses": "nervous, inconsistent, indecisive.", - "full_form": "***G*** for generous\n***E*** for emotionally in tune\n***M*** for motivated\n***I*** for imaginative\n***N*** for nice\n***I*** for intelligent", + "full_form": "__**G**__enerous\n__**E**__motionally in tune\n__**M**__otivated\n__**I**__maginative\n__**N**__ice\n__**I**__ntelligent", "url": "https://www.horoscope.com/images-US/signs/profile-gemini.png" }, - "Cancer":{ - "start_at": [6, 21], - "end_at": [7, 22], - "About": "Amazing people born between **June 21 ** to **July 22**. Cancer is a cardinal water sign. Represented by the crab, this crustacean seamlessly weaves between the sea and shore representing Cancer’s ability to exist in both emotional and material realms. Cancers are highly intuitive and their psychic abilities manifest in tangible spaces: For instance, Cancers can effortlessly pick up the energies in a room.", - "Motto": "***“I feel, therefore I am.”***", - "Strengths": "tenacious, highly imaginative, loyal, emotional, sympathetic, persuasive.", - "Weaknesses": "moody, pessimistic, suspicious, manipulative, insecuremoody, pessimistic, suspicious, manipulative, insecure.", - "full_form": "***C*** for caring\n***A*** for ambitious\n***N*** for nourishing\n***C*** for creative\n***E*** for emotionally intelligent\n***R*** for resilient", - "url": "https://www.horoscope.com/images-US/signs/profile-cancer.png" + "Cancer": { + "start_at": [6, 21], + "end_at": [7, 22], + "About": "Amazing people born between **June 21 ** to **July 22**. Cancer is a cardinal water sign. Represented by the crab, this crustacean seamlessly weaves between the sea and shore representing Cancer’s ability to exist in both emotional and material realms. Cancers are highly intuitive and their psychic abilities manifest in tangible spaces: For instance, Cancers can effortlessly pick up the energies in a room.", + "Motto": "***“I feel, therefore I am.”***", + "Strengths": "tenacious, highly imaginative, loyal, emotional, sympathetic, persuasive.", + "Weaknesses": "moody, pessimistic, suspicious, manipulative, insecuremoody, pessimistic, suspicious, manipulative, insecure.", + "full_form": "__**C**__aring\n__**A**__mbitious\n__**N**__ourishing\n__**C**__reative\n__**E**__motionally intelligent\n__**R**__esilient", + "url": "https://www.horoscope.com/images-US/signs/profile-cancer.png" }, - "Leo":{ - "start_at": [7, 23], - "end_at": [8, 22], - "About": "Amazing people born between **July 23** to **August 22**. Roll out the red carpet because Leo has arrived. Leo is represented by the lion and these spirited fire signs are the kings and queens of the celestial jungle. They’re delighted to embrace their royal status: Vivacious, theatrical, and passionate, Leos love to bask in the spotlight and celebrate themselves.", - "Motto": "***“If you know the way, go the way and show the way—you're a leader.”***", - "Strengths": "creative, passionate, generous, warm-hearted, cheerful, humorous.", - "Weaknesses": "arrogant, stubborn, self-centered, lazy, inflexible.", - "full_form": "***L*** for leaders\n***E*** for energetic\n***O*** for optimistic", - "url": "https://www.horoscope.com/images-US/signs/profile-leo.png" + "Leo": { + "start_at": [7, 23], + "end_at": [8, 22], + "About": "Amazing people born between **July 23** to **August 22**. Roll out the red carpet because Leo has arrived. Leo is represented by the lion and these spirited fire signs are the kings and queens of the celestial jungle. They’re delighted to embrace their royal status: Vivacious, theatrical, and passionate, Leos love to bask in the spotlight and celebrate themselves.", + "Motto": "***“If you know the way, go the way and show the way—you're a leader.”***", + "Strengths": "creative, passionate, generous, warm-hearted, cheerful, humorous.", + "Weaknesses": "arrogant, stubborn, self-centered, lazy, inflexible.", + "full_form": "__**L**__eaders\n__**E**__nergetic\n__**O**__ptimistic", + "url": "https://www.horoscope.com/images-US/signs/profile-leo.png" }, - "Virgo":{ - "start_at": [8, 23], - "end_at": [9, 22], - "About": "Amazing people born between **August 23** to **September 22**. Virgo is an earth sign historically represented by the goddess of wheat and agriculture, an association that speaks to Virgo’s deep-rooted presence in the material world. Virgos are logical, practical, and systematic in their approach to life. This earth sign is a perfectionist at heart and isn’t afraid to improve skills through diligent and consistent practice.", - "Motto": "***“My best can always be better.”***", - "Strengths": "loyal, analytical, kind, hardworking, practical.", - "Weaknesses": "shyness, worry, overly critical of self and others, all work and no play.", - "full_form": "***V*** for virtuous\n***I*** for intelligent\n***R*** for responsible\n***G*** for generous\n***O*** for optimistic", - "url": "https://www.horoscope.com/images-US/signs/profile-virgo.png" + "Virgo": { + "start_at": [8, 23], + "end_at": [9, 22], + "About": "Amazing people born between **August 23** to **September 22**. Virgo is an earth sign historically represented by the goddess of wheat and agriculture, an association that speaks to Virgo’s deep-rooted presence in the material world. Virgos are logical, practical, and systematic in their approach to life. This earth sign is a perfectionist at heart and isn’t afraid to improve skills through diligent and consistent practice.", + "Motto": "***“My best can always be better.”***", + "Strengths": "loyal, analytical, kind, hardworking, practical.", + "Weaknesses": "shyness, worry, overly critical of self and others, all work and no play.", + "full_form": "__**V**__irtuous\n__**I**__ntelligent\n__**R**__esponsible\n__**G**__enerous\n__**O**__ptimistic", + "url": "https://www.horoscope.com/images-US/signs/profile-virgo.png" }, - "Libra":{ - "start_at": [9, 23], - "end_at": [10, 22], - "About": "Amazing people born between **September 23** to **October 22**. Libra is an air sign represented by the scales (interestingly, the only inanimate object of the zodiac), an association that reflects Libra's fixation on balance and harmony. Libra is obsessed with symmetry and strives to create equilibrium in all areas of life.", - "Motto": "***“No person is an island.”***", - "Strengths": "cooperative, diplomatic, gracious, fair-minded, social.", - "Weaknesses": "indecisive, avoids confrontations, will carry a grudge, self-pity.", - "full_form": "***L*** for loyal\n***I*** for inquisitive\n***B*** for balanced\n***R*** for responsible\n***A*** for altruistic", - "url": "https://www.horoscope.com/images-US/signs/profile-libra.png" + "Libra": { + "start_at": [9, 23], + "end_at": [10, 22], + "About": "Amazing people born between **September 23** to **October 22**. Libra is an air sign represented by the scales (interestingly, the only inanimate object of the zodiac), an association that reflects Libra's fixation on balance and harmony. Libra is obsessed with symmetry and strives to create equilibrium in all areas of life.", + "Motto": "***“No person is an island.”***", + "Strengths": "cooperative, diplomatic, gracious, fair-minded, social.", + "Weaknesses": "indecisive, avoids confrontations, will carry a grudge, self-pity.", + "full_form": "__**L**__oyal\n__**I**__nquisitive\n__**B**__alanced\n__**R**__esponsible\n__**A**__ltruistic", + "url": "https://www.horoscope.com/images-US/signs/profile-libra.png" + }, + "Scorpio": { + "start_at": [10, 23], + "end_at": [11, 21], + "About": "Amazing people born between **October 23** to **November 21**. Scorpio is one of the most misunderstood signs of the zodiac. Because of its incredible passion and power, Scorpio is often mistaken for a fire sign. In fact, Scorpio is a water sign that derives its strength from the psychic, emotional realm.", + "Motto": "***“You never know what you are capable of until you try.”***", + "Strengths": "resourceful, brave, passionate, stubborn, a true friend.", + "Weaknesses": "distrusting, jealous, secretive, violent.", + "full_form": "__**S**__eductive\n__**C**__erebral\n__**O**__riginal\n__**R**__eactive\n__**P**__assionate\n__**I**__ntuitive\n__**O**__utstanding", + "url": "https://www.horoscope.com/images-US/signs/profile-scorpio.png" }, - "Scorpio":{ - "start_at": [10, 23], - "end_at": [11, 21], - "About": "Amazing people born between **October 23** to **November 21**. Scorpio is one of the most misunderstood signs of the zodiac. Because of its incredible passion and power, Scorpio is often mistaken for a fire sign. In fact, Scorpio is a water sign that derives its strength from the psychic, emotional realm.", - "Motto": "***“You never know what you are capable of until you try.”***", - "Strengths": "resourceful, brave, passionate, stubborn, a true friend.", - "Weaknesses": "distrusting, jealous, secretive, violent.", - "full_form": "***S*** for seductive\n***C*** for cerebral\n***O*** for original\n***R*** for reactive\n***P*** for passionate\n***I*** for intuitive\n***O*** for outstanding", - "url": "https://www.horoscope.com/images-US/signs/profile-scorpio.png" + "Sagittarius": { + "start_at": [11, 22], + "end_at": [12, 21], + "About": "Amazing people born between **November 22** to **December 21**. Represented by the archer, Sagittarians are always on a quest for knowledge. The last fire sign of the zodiac, Sagittarius launches its many pursuits like blazing arrows, chasing after geographical, intellectual, and spiritual adventures.", + "Motto": "***“Towering genius disdains a beaten path.”***", + "Strengths": "generous, idealistic, great sense of humor.", + "Weaknesses": "promises more than can deliver, very impatient, will say anything no matter how undiplomatic.", + "full_form": "__**S**__eductive\n__**A**__dventurous\n__**G**__rateful\n__**I**__ntelligent\n__**T**__railblazing\n__**T**__enacious adept\n__**A**__dept\n__**R**__esponsible\n__**I**__dealistic\n__**U**__nparalled\n__**S**__ophisticated", + "url": "https://www.horoscope.com/images-US/signs/profile-sagittarius.png" }, - "Sagittarius":{ - "start_at": [11, 22], - "end_at": [12, 21], - "About": "Amazing people born between **November 22** to **December 21**. Represented by the archer, Sagittarians are always on a quest for knowledge. The last fire sign of the zodiac, Sagittarius launches its many pursuits like blazing arrows, chasing after geographical, intellectual, and spiritual adventures.", - "Motto": "***“Towering genius disdains a beaten path.”***", - "Strengths": "generous, idealistic, great sense of humor.", - "Weaknesses": "promises more than can deliver, very impatient, will say anything no matter how undiplomatic.", - "full_form": "***S*** for seductive\n***A*** for adventurous\n***G*** for grateful\n***I*** for intelligent\n***T*** for trailblazing\n***T*** for tenacious adept\n***A*** for adept\n***R*** for responsible\n***I*** for idealistic\n***U*** for unparalled\n***S*** for sophisticated", - "url": "https://www.horoscope.com/images-US/signs/profile-sagittarius.png" + "Capricorn": { + "start_at": [12, 22], + "end_at": [1, 19], + "About": "Amazing people born between **December 22** to **January 19**. The last earth sign of the zodiac, Capricorn is represented by the sea goat, a mythological creature with the body of a goat and tail of a fish. Accordingly, Capricorns are skilled at navigating both the material and emotional realms.", + "Motto": "***“I can succeed at anything I put my mind to.”***", + "Strengths": "responsible, disciplined, self-control, good managers.", + "Weaknesses": "know-it-all, unforgiving, condescending, expecting the worst.", + "full_form": "__**C**__onfident\n__**A**__nalytical\n__**P**__ractical\n__**R**__esponsible\n__**I**__ntelligent\n__**C**__aring\n__**O**__rganized\n__**R**__ealistic\n__**N**__eat", + "url": "https://www.horoscope.com/images-US/signs/profile-capricorn.png" }, - "Capricorn":{ - "start_at": [12, 22], - "end_at": [1, 19], - "About": "Amazing people born between **December 22** to **January 19**. The last earth sign of the zodiac, Capricorn is represented by the sea goat, a mythological creature with the body of a goat and tail of a fish. Accordingly, Capricorns are skilled at navigating both the material and emotional realms.", - "Motto": "***“I can succeed at anything I put my mind to.”***", - "Strengths": "responsible, disciplined, self-control, good managers.", - "Weaknesses": "know-it-all, unforgiving, condescending, expecting the worst.", - "full_form": "***C*** for confident\n***A*** for analytical\n***P*** for practical\n***R*** for responsible\n***I*** for intelligent\n***C*** for caring\n***O*** for organized\n***R*** for realistic\n***N*** for neat", - "url": "https://www.horoscope.com/images-US/signs/profile-capricorn.png" + "Aquarius": { + "start_at": [1, 20], + "end_at": [2,18], + "About": "Amazing people born between **January 20** to **February 18**. Despite the “aqua” in its name, Aquarius is actually the last air sign of the zodiac. Aquarius is represented by the water bearer, the mystical healer who bestows water, or life, upon the land. Accordingly, Aquarius is the most humanitarian astrological sign.", + "Motto": "***“There is no me, there is only we.”***", + "Strengths": "Progressive, original, independent, humanitarian.", + "Weaknesses": "Runs from emotional expression, temperamental, uncompromising, aloof.", + "full_form": "__**A**__nalytical\n__**Q**__uirky\n__**U**__ncompromising\n__**A**__ction-focused\n__**R**__espectful\n__**I**__ntelligent\n__**U**__nique\n__**S**__incere", + "url": "https://www.horoscope.com/images-US/signs/profile-aquarius.png" }, - "Aquarius":{ - "start_at": [1, 20], - "end_at": [2,18], - "About": "Amazing people born between **January 20** to **February 18**. Despite the “aqua” in its name, Aquarius is actually the last air sign of the zodiac. Aquarius is represented by the water bearer, the mystical healer who bestows water, or life, upon the land. Accordingly, Aquarius is the most humanitarian astrological sign.", - "Motto": "***“There is no me, there is only we.”***", - "Strengths": "Progressive, original, independent, humanitarian.", - "Weaknesses": "Runs from emotional expression, temperamental, uncompromising, aloof.", - "full_form": "***A*** for analytical\n***Q*** for quirky\n***U*** for uncompromising\n***A*** for action-focused\n***R*** for respectful\n***I*** for intelligent\n***U*** for unique\n***S*** for sincere", - "url": "https://www.horoscope.com/images-US/signs/profile-aquarius.png" - }, - "Pisces":{ - "start_at": [2, 19], - "end_at": [3, 20], - "About": "Amazing people born between **February 19** to **March 20**. Pisces, a water sign, is the last constellation of the zodiac. It's symbolized by two fish swimming in opposite directions, representing the constant division of Pisces' attention between fantasy and reality. As the final sign, Pisces has absorbed every lesson — the joys and the pain, the hopes and the fears — learned by all of the other signs.", - "Motto": "***“I have a lot of love to give, it only takes a little patience and those worth giving it all to.”***", - "Strengths": "Compassionate, artistic, intuitive, gentle, wise, musical.", - "Weaknesses": "Fearful, overly trusting, sad, desire to escape reality, can be a victim or a martyr.", - "full_form": "***P*** for psychic\n***I*** for intelligent\n***S*** for surprising\n***C*** for creative\n***E*** for emotionally-driven\n***S*** for sensitive", - "url": "https://www.horoscope.com/images-US/signs/profile-pisces.png" - } + "Pisces": { + "start_at": [2, 19], + "end_at": [3, 20], + "About": "Amazing people born between **February 19** to **March 20**. Pisces, a water sign, is the last constellation of the zodiac. It's symbolized by two fish swimming in opposite directions, representing the constant division of Pisces' attention between fantasy and reality. As the final sign, Pisces has absorbed every lesson — the joys and the pain, the hopes and the fears — learned by all of the other signs.", + "Motto": "***“I have a lot of love to give, it only takes a little patience and those worth giving it all to.”***", + "Strengths": "Compassionate, artistic, intuitive, gentle, wise, musical.", + "Weaknesses": "Fearful, overly trusting, sad, desire to escape reality, can be a victim or a martyr.", + "full_form": "__**P**__sychic\n__**I**__ntelligent\n__**S**__urprising\n__**C**__reative\n__**E**__motionally-driven\n__**S**__ensitive", + "url": "https://www.horoscope.com/images-US/signs/profile-pisces.png" + } } -- cgit v1.2.3 From d1a3aba9a7eff421ed9daf4694c6f2315c8b2af1 Mon Sep 17 00:00:00 2001 From: Anubhav <57266248+Anubhav1603@users.noreply.github.com> Date: Fri, 25 Sep 2020 18:17:27 +0530 Subject: Update bot/exts/valentines/valentine_zodiac.py Co-authored-by: Rohan Reddy Alleti --- bot/exts/valentines/valentine_zodiac.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/bot/exts/valentines/valentine_zodiac.py b/bot/exts/valentines/valentine_zodiac.py index 60510377..8c051ebe 100644 --- a/bot/exts/valentines/valentine_zodiac.py +++ b/bot/exts/valentines/valentine_zodiac.py @@ -66,10 +66,8 @@ class ValentineZodiac(commands.Cog): def zodiac_date_verifer(self, query_datetime: datetime) -> str: """Returns zodiac sign by checking month and date.""" - for zodiac_name, date_range in self.zodiac_fact.items(): - value_start = datetime(2020, date_range["start_at"][0], date_range["start_at"][1]).date() - value_end = datetime(2020, date_range["end_at"][0], date_range["end_at"][1]).date() - if value_start <= query_datetime.date() <= value_end: + for zodiac_name, zodiac_data in self.zodiac_fact.items(): + if zodiac_data["start_at"] <= query_datetime.date() <= zodiac_data["end_at"]: zodiac = zodiac_name break else: -- cgit v1.2.3 From 9319667c648cb6c837ed4fb55af0ae375f246fa3 Mon Sep 17 00:00:00 2001 From: Anubhav <57266248+Anubhav1603@users.noreply.github.com> Date: Fri, 25 Sep 2020 18:18:09 +0530 Subject: changed month name to calender Co-authored-by: Rohan Reddy Alleti --- bot/exts/valentines/valentine_zodiac.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bot/exts/valentines/valentine_zodiac.py b/bot/exts/valentines/valentine_zodiac.py index 8c051ebe..7e38dcc0 100644 --- a/bot/exts/valentines/valentine_zodiac.py +++ b/bot/exts/valentines/valentine_zodiac.py @@ -88,10 +88,10 @@ class ValentineZodiac(commands.Cog): """Provides information about zodiac sign by taking month and date as input.""" if isinstance(month, str): month = month.capitalize() - if month in MONTH_NAME.keys(): - month = MONTH_NAME[month] - else: - await ctx.send("Sorry, but you have given wrong Month name") + try: + month = list(calendar.month_abbr).index(month[:3]) + except ValueError: + await ctx.send("Sorry, but you have given wrong month name.") return if month == 1 or month == 12: if date >= 1 and date <= 19 or date >= 22 and date <= 31: -- cgit v1.2.3 From 6ab5d835714117345582433218c09f295809038f Mon Sep 17 00:00:00 2001 From: Anubhav <57266248+Anubhav1603@users.noreply.github.com> Date: Fri, 25 Sep 2020 18:19:04 +0530 Subject: modified if else for checking capricon zodiac sign Co-authored-by: Rohan Reddy Alleti --- bot/exts/valentines/valentine_zodiac.py | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/bot/exts/valentines/valentine_zodiac.py b/bot/exts/valentines/valentine_zodiac.py index 7e38dcc0..f15a2d8f 100644 --- a/bot/exts/valentines/valentine_zodiac.py +++ b/bot/exts/valentines/valentine_zodiac.py @@ -93,25 +93,22 @@ class ValentineZodiac(commands.Cog): except ValueError: await ctx.send("Sorry, but you have given wrong month name.") return - if month == 1 or month == 12: - if date >= 1 and date <= 19 or date >= 22 and date <= 31: - zodiac = "Capricorn" - final_embed = self.zodiac_sign_verify(zodiac) - await ctx.send(embed=final_embed) - return - try: - zodiac_sign_based_on_month_and_date = self.zodiac_date_verifer(datetime(2020, month, date)) - log.info("zodiac sign based on month and date received") - except ValueError as e: - await ctx.send(f'You cannot do that, {e}') - if zodiac_sign_based_on_month_and_date is None: - log.info("zodiac sign based on month and date returned None") - final_embed = discord.Embed() - final_embed.color = Colours.pink - final_embed.description = "You provided wrong date or month so i aren't able to find any zodiac sign" + if (month == 1 and (1 <= date <= 19)) or (month == 12 and (22 <= date <= 31)): + zodiac = "capricorn" + final_embed = self.zodiac_sign_verify(zodiac) else: - final_embed = self.zodiac_sign_verify(zodiac_sign_based_on_month_and_date) - log.info("zodiac sign embed based on month and date is now sent") + try: + zodiac_sign_based_on_month_and_date = self.zodiac_date_verifer(datetime(2020, month, date)) + log.info("zodiac sign based on month and date received") + except ValueError as e: + log.info("zodiac sign based on month and date returned None") + final_embed = discord.Embed() + final_embed.color = Colours.pink + final_embed.description = f"{e}, cannot find zodiac sign." + else: + final_embed = self.zodiac_sign_verify(zodiac_sign_based_on_month_and_date) + log.info("zodiac sign embed based on month and date is now sent.") + await ctx.send(embed=final_embed) @zodiac.command(name="partnerzodiac") -- cgit v1.2.3 From 7d98cdeadad5ad521312a3fc78830c837a4a479b Mon Sep 17 00:00:00 2001 From: Anubhav <57266248+Anubhav1603@users.noreply.github.com> Date: Fri, 25 Sep 2020 18:19:57 +0530 Subject: changed p1 to explanation file and p2 to compatible file Co-authored-by: PureFunctor --- bot/exts/valentines/valentine_zodiac.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bot/exts/valentines/valentine_zodiac.py b/bot/exts/valentines/valentine_zodiac.py index f15a2d8f..4344dbde 100644 --- a/bot/exts/valentines/valentine_zodiac.py +++ b/bot/exts/valentines/valentine_zodiac.py @@ -35,8 +35,8 @@ class ValentineZodiac(commands.Cog): @staticmethod def load_comp_json() -> dict: """Load zodiac compatibility from static JSON resource.""" - p1 = Path("bot/resources/valentines/zodiac_explanation.json") - p = Path("bot/resources/valentines/zodiac_compatibility.json") + explanation_file = Path("bot/resources/valentines/zodiac_explanation.json") + compatibility_file = Path("bot/resources/valentines/zodiac_compatibility.json") with p1.open(encoding="utf8") as json_data: zodiac_fact = load(json_data) with p.open(encoding="utf8") as json_data: -- cgit v1.2.3 From 01c4360a53fd4ce35344e83a9a7ea08c1a868d81 Mon Sep 17 00:00:00 2001 From: Anubhav <57266248+Anubhav1603@users.noreply.github.com> Date: Fri, 25 Sep 2020 18:20:32 +0530 Subject: changed p1 to explanation file and p2 to compatible file to work with code Co-authored-by: PureFunctor --- bot/exts/valentines/valentine_zodiac.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bot/exts/valentines/valentine_zodiac.py b/bot/exts/valentines/valentine_zodiac.py index 4344dbde..af1b3c0d 100644 --- a/bot/exts/valentines/valentine_zodiac.py +++ b/bot/exts/valentines/valentine_zodiac.py @@ -37,9 +37,9 @@ class ValentineZodiac(commands.Cog): """Load zodiac compatibility from static JSON resource.""" explanation_file = Path("bot/resources/valentines/zodiac_explanation.json") compatibility_file = Path("bot/resources/valentines/zodiac_compatibility.json") - with p1.open(encoding="utf8") as json_data: + with explanation_file.open(encoding="utf8") as json_data: zodiac_fact = load(json_data) - with p.open(encoding="utf8") as json_data: + with compatibility_file.open(encoding="utf8") as json_data: zodiacs = load(json_data) return zodiacs, zodiac_fact -- cgit v1.2.3 From f211cd27453578926f008f9a35735e23e7419e8f Mon Sep 17 00:00:00 2001 From: Anubhav <57266248+Anubhav1603@users.noreply.github.com> Date: Fri, 25 Sep 2020 18:21:36 +0530 Subject: changed zodiac sign to self.zodiac sign Co-authored-by: Rohan Reddy Alleti --- bot/exts/valentines/valentine_zodiac.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bot/exts/valentines/valentine_zodiac.py b/bot/exts/valentines/valentine_zodiac.py index af1b3c0d..5bdc39ec 100644 --- a/bot/exts/valentines/valentine_zodiac.py +++ b/bot/exts/valentines/valentine_zodiac.py @@ -49,7 +49,7 @@ class ValentineZodiac(commands.Cog): zodiac_fact = self.zodiac_fact embed = discord.Embed() embed.color = Colours.pink - if zodiac in ZODIAC_SIGNS: + if zodiac in self.zodiac_fact: log.info("Making zodiac embed") embed.title = f"__{zodiac}__" embed.description = zodiac_fact[f"{zodiac}"]["About"] -- cgit v1.2.3 From 8c17bb706eaae0ffc01fc499d812e9093ad5b433 Mon Sep 17 00:00:00 2001 From: Anubhav1603 Date: Fri, 25 Sep 2020 18:33:26 +0530 Subject: changed datetime to isoformat --- bot/resources/valentines/zodiac_explanation.json | 240 +++++++++++------------ 1 file changed, 120 insertions(+), 120 deletions(-) diff --git a/bot/resources/valentines/zodiac_explanation.json b/bot/resources/valentines/zodiac_explanation.json index c23d474d..6be1a481 100644 --- a/bot/resources/valentines/zodiac_explanation.json +++ b/bot/resources/valentines/zodiac_explanation.json @@ -1,122 +1,122 @@ { - "Aries": { - "start_at":[3, 21], - "end_at": [4, 19], - "About":"Amazing people born between **March 21** to **April 19**. Aries loves to be number one, so it’s no surprise that these audacious rams are the first sign of the zodiac. Bold and ambitious, Aries dives headfirst into even the most challenging situations.", - "Motto":"***“When you know yourself, you're empowered. When you accept yourself, you're invincible.”***", - "Strengths":"courageous, determined, confident, enthusiastic, optimistic, honest, passionate.", - "Weaknesses":"impatient, moody, short-tempered, impulsive, aggressive.", - "full_form":"__**A**__ssertive\n__**R**__efreshing\n__**I**__ndependent\n__**E**__nergetic\n__**S**__exy", - "url":"https://www.horoscope.com/images-US/signs/profile-aries.png" - }, - "Taurus": { - "start_at": [4, 20], - "end_at": [5, 20], - "About": "Amazing people born between **April 20** to **May 20**. Taurus is an earth sign represented by the bull. Like their celestial spirit animal, Taureans enjoy relaxing in serene, bucolic environments surrounded by soft sounds, soothing aromas, and succulent flavors", - "Motto": "***“Nothing worth having comes easy.”***", - "Strengths": "reliable, patient, practical, devoted, responsible, stable.", - "Weaknesses": "stubborn, possessive, uncompromising.", - "full_form": "__**T**__railblazing\n__**A**__mbitious\n__**U**__nwavering\n__**R**__eliable\n__**U**__nderstanding\n__**S**__table", - "url": "https://www.horoscope.com/images-US/signs/profile-taurus.png" - }, - "Gemini": { - "start_at": [5, 21], - "end_at": [6, 20], - "About": "Amazing people born between **May 21** to **June 20**. Have you ever been so busy that you wished you could clone yourself just to get everything done? That’s the Gemini experience in a nutshell. Appropriately symbolized by the celestial twins, this air sign was interested in so many pursuits that it had to double itself.", - "Motto": "***“I manifest my reality.”***", - "Strengths": "gentle, affectionate, curious, adaptable, ability to learn quickly and exchange ideas.", - "Weaknesses": "nervous, inconsistent, indecisive.", - "full_form": "__**G**__enerous\n__**E**__motionally in tune\n__**M**__otivated\n__**I**__maginative\n__**N**__ice\n__**I**__ntelligent", - "url": "https://www.horoscope.com/images-US/signs/profile-gemini.png" - }, - "Cancer": { - "start_at": [6, 21], - "end_at": [7, 22], - "About": "Amazing people born between **June 21 ** to **July 22**. Cancer is a cardinal water sign. Represented by the crab, this crustacean seamlessly weaves between the sea and shore representing Cancer’s ability to exist in both emotional and material realms. Cancers are highly intuitive and their psychic abilities manifest in tangible spaces: For instance, Cancers can effortlessly pick up the energies in a room.", - "Motto": "***“I feel, therefore I am.”***", - "Strengths": "tenacious, highly imaginative, loyal, emotional, sympathetic, persuasive.", - "Weaknesses": "moody, pessimistic, suspicious, manipulative, insecuremoody, pessimistic, suspicious, manipulative, insecure.", - "full_form": "__**C**__aring\n__**A**__mbitious\n__**N**__ourishing\n__**C**__reative\n__**E**__motionally intelligent\n__**R**__esilient", - "url": "https://www.horoscope.com/images-US/signs/profile-cancer.png" - }, - "Leo": { - "start_at": [7, 23], - "end_at": [8, 22], - "About": "Amazing people born between **July 23** to **August 22**. Roll out the red carpet because Leo has arrived. Leo is represented by the lion and these spirited fire signs are the kings and queens of the celestial jungle. They’re delighted to embrace their royal status: Vivacious, theatrical, and passionate, Leos love to bask in the spotlight and celebrate themselves.", - "Motto": "***“If you know the way, go the way and show the way—you're a leader.”***", - "Strengths": "creative, passionate, generous, warm-hearted, cheerful, humorous.", - "Weaknesses": "arrogant, stubborn, self-centered, lazy, inflexible.", - "full_form": "__**L**__eaders\n__**E**__nergetic\n__**O**__ptimistic", - "url": "https://www.horoscope.com/images-US/signs/profile-leo.png" - }, - "Virgo": { - "start_at": [8, 23], - "end_at": [9, 22], - "About": "Amazing people born between **August 23** to **September 22**. Virgo is an earth sign historically represented by the goddess of wheat and agriculture, an association that speaks to Virgo’s deep-rooted presence in the material world. Virgos are logical, practical, and systematic in their approach to life. This earth sign is a perfectionist at heart and isn’t afraid to improve skills through diligent and consistent practice.", - "Motto": "***“My best can always be better.”***", - "Strengths": "loyal, analytical, kind, hardworking, practical.", - "Weaknesses": "shyness, worry, overly critical of self and others, all work and no play.", - "full_form": "__**V**__irtuous\n__**I**__ntelligent\n__**R**__esponsible\n__**G**__enerous\n__**O**__ptimistic", - "url": "https://www.horoscope.com/images-US/signs/profile-virgo.png" - }, - "Libra": { - "start_at": [9, 23], - "end_at": [10, 22], - "About": "Amazing people born between **September 23** to **October 22**. Libra is an air sign represented by the scales (interestingly, the only inanimate object of the zodiac), an association that reflects Libra's fixation on balance and harmony. Libra is obsessed with symmetry and strives to create equilibrium in all areas of life.", - "Motto": "***“No person is an island.”***", - "Strengths": "cooperative, diplomatic, gracious, fair-minded, social.", - "Weaknesses": "indecisive, avoids confrontations, will carry a grudge, self-pity.", - "full_form": "__**L**__oyal\n__**I**__nquisitive\n__**B**__alanced\n__**R**__esponsible\n__**A**__ltruistic", - "url": "https://www.horoscope.com/images-US/signs/profile-libra.png" - }, - "Scorpio": { - "start_at": [10, 23], - "end_at": [11, 21], - "About": "Amazing people born between **October 23** to **November 21**. Scorpio is one of the most misunderstood signs of the zodiac. Because of its incredible passion and power, Scorpio is often mistaken for a fire sign. In fact, Scorpio is a water sign that derives its strength from the psychic, emotional realm.", - "Motto": "***“You never know what you are capable of until you try.”***", - "Strengths": "resourceful, brave, passionate, stubborn, a true friend.", - "Weaknesses": "distrusting, jealous, secretive, violent.", - "full_form": "__**S**__eductive\n__**C**__erebral\n__**O**__riginal\n__**R**__eactive\n__**P**__assionate\n__**I**__ntuitive\n__**O**__utstanding", - "url": "https://www.horoscope.com/images-US/signs/profile-scorpio.png" - }, - "Sagittarius": { - "start_at": [11, 22], - "end_at": [12, 21], - "About": "Amazing people born between **November 22** to **December 21**. Represented by the archer, Sagittarians are always on a quest for knowledge. The last fire sign of the zodiac, Sagittarius launches its many pursuits like blazing arrows, chasing after geographical, intellectual, and spiritual adventures.", - "Motto": "***“Towering genius disdains a beaten path.”***", - "Strengths": "generous, idealistic, great sense of humor.", - "Weaknesses": "promises more than can deliver, very impatient, will say anything no matter how undiplomatic.", - "full_form": "__**S**__eductive\n__**A**__dventurous\n__**G**__rateful\n__**I**__ntelligent\n__**T**__railblazing\n__**T**__enacious adept\n__**A**__dept\n__**R**__esponsible\n__**I**__dealistic\n__**U**__nparalled\n__**S**__ophisticated", - "url": "https://www.horoscope.com/images-US/signs/profile-sagittarius.png" - }, - "Capricorn": { - "start_at": [12, 22], - "end_at": [1, 19], - "About": "Amazing people born between **December 22** to **January 19**. The last earth sign of the zodiac, Capricorn is represented by the sea goat, a mythological creature with the body of a goat and tail of a fish. Accordingly, Capricorns are skilled at navigating both the material and emotional realms.", - "Motto": "***“I can succeed at anything I put my mind to.”***", - "Strengths": "responsible, disciplined, self-control, good managers.", - "Weaknesses": "know-it-all, unforgiving, condescending, expecting the worst.", - "full_form": "__**C**__onfident\n__**A**__nalytical\n__**P**__ractical\n__**R**__esponsible\n__**I**__ntelligent\n__**C**__aring\n__**O**__rganized\n__**R**__ealistic\n__**N**__eat", - "url": "https://www.horoscope.com/images-US/signs/profile-capricorn.png" - }, - "Aquarius": { - "start_at": [1, 20], - "end_at": [2,18], - "About": "Amazing people born between **January 20** to **February 18**. Despite the “aqua” in its name, Aquarius is actually the last air sign of the zodiac. Aquarius is represented by the water bearer, the mystical healer who bestows water, or life, upon the land. Accordingly, Aquarius is the most humanitarian astrological sign.", - "Motto": "***“There is no me, there is only we.”***", - "Strengths": "Progressive, original, independent, humanitarian.", - "Weaknesses": "Runs from emotional expression, temperamental, uncompromising, aloof.", - "full_form": "__**A**__nalytical\n__**Q**__uirky\n__**U**__ncompromising\n__**A**__ction-focused\n__**R**__espectful\n__**I**__ntelligent\n__**U**__nique\n__**S**__incere", - "url": "https://www.horoscope.com/images-US/signs/profile-aquarius.png" - }, - "Pisces": { - "start_at": [2, 19], - "end_at": [3, 20], - "About": "Amazing people born between **February 19** to **March 20**. Pisces, a water sign, is the last constellation of the zodiac. It's symbolized by two fish swimming in opposite directions, representing the constant division of Pisces' attention between fantasy and reality. As the final sign, Pisces has absorbed every lesson — the joys and the pain, the hopes and the fears — learned by all of the other signs.", - "Motto": "***“I have a lot of love to give, it only takes a little patience and those worth giving it all to.”***", - "Strengths": "Compassionate, artistic, intuitive, gentle, wise, musical.", - "Weaknesses": "Fearful, overly trusting, sad, desire to escape reality, can be a victim or a martyr.", - "full_form": "__**P**__sychic\n__**I**__ntelligent\n__**S**__urprising\n__**C**__reative\n__**E**__motionally-driven\n__**S**__ensitive", - "url": "https://www.horoscope.com/images-US/signs/profile-pisces.png" - } + "Aries": { + "start_at": "2020-03-21", + "end_at": "2020-04-19", + "About": "Amazing people born between **March 21** to **April 19**. Aries loves to be number one, so it\u2019s no surprise that these audacious rams are the first sign of the zodiac. Bold and ambitious, Aries dives headfirst into even the most challenging situations.", + "Motto": "***\u201cWhen you know yourself, you're empowered. When you accept yourself, you're invincible.\u201d***", + "Strengths": "courageous, determined, confident, enthusiastic, optimistic, honest, passionate.", + "Weaknesses": "impatient, moody, short-tempered, impulsive, aggressive.", + "full_form": "__**A**__ssertive\n__**R**__efreshing\n__**I**__ndependent\n__**E**__nergetic\n__**S**__exy", + "url": "https://www.horoscope.com/images-US/signs/profile-aries.png" + }, + "Taurus": { + "start_at": "2020-04-20", + "end_at": "2020-05-20", + "About": "Amazing people born between **April 20** to **May 20**. Taurus is an earth sign represented by the bull. Like their celestial spirit animal, Taureans enjoy relaxing in serene, bucolic environments surrounded by soft sounds, soothing aromas, and succulent flavors", + "Motto": "***\u201cNothing worth having comes easy.\u201d***", + "Strengths": "reliable, patient, practical, devoted, responsible, stable.", + "Weaknesses": "stubborn, possessive, uncompromising.", + "full_form": "__**T**__railblazing\n__**A**__mbitious\n__**U**__nwavering\n__**R**__eliable\n__**U**__nderstanding\n__**S**__table", + "url": "https://www.horoscope.com/images-US/signs/profile-taurus.png" + }, + "Gemini": { + "start_at": "2020-05-21", + "end_at": "2020-06-20", + "About": "Amazing people born between **May 21** to **June 20**. Have you ever been so busy that you wished you could clone yourself just to get everything done? That\u2019s the Gemini experience in a nutshell. Appropriately symbolized by the celestial twins, this air sign was interested in so many pursuits that it had to double itself.", + "Motto": "***\u201cI manifest my reality.\u201d***", + "Strengths": "gentle, affectionate, curious, adaptable, ability to learn quickly and exchange ideas.", + "Weaknesses": "nervous, inconsistent, indecisive.", + "full_form": "__**G**__enerous\n__**E**__motionally in tune\n__**M**__otivated\n__**I**__maginative\n__**N**__ice\n__**I**__ntelligent", + "url": "https://www.horoscope.com/images-US/signs/profile-gemini.png" + }, + "Cancer": { + "start_at": "2020-06-21", + "end_at": "2020-07-22", + "About": "Amazing people born between **June 21 ** to **July 22**. Cancer is a cardinal water sign. Represented by the crab, this crustacean seamlessly weaves between the sea and shore representing Cancer\u2019s ability to exist in both emotional and material realms. Cancers are highly intuitive and their psychic abilities manifest in tangible spaces: For instance, Cancers can effortlessly pick up the energies in a room.", + "Motto": "***\u201cI feel, therefore I am.\u201d***", + "Strengths": "tenacious, highly imaginative, loyal, emotional, sympathetic, persuasive.", + "Weaknesses": "moody, pessimistic, suspicious, manipulative, insecuremoody, pessimistic, suspicious, manipulative, insecure.", + "full_form": "__**C**__aring\n__**A**__mbitious\n__**N**__ourishing\n__**C**__reative\n__**E**__motionally intelligent\n__**R**__esilient", + "url": "https://www.horoscope.com/images-US/signs/profile-cancer.png" + }, + "Leo": { + "start_at": "2020-07-23", + "end_at": "2020-08-22", + "About": "Amazing people born between **July 23** to **August 22**. Roll out the red carpet because Leo has arrived. Leo is represented by the lion and these spirited fire signs are the kings and queens of the celestial jungle. They\u2019re delighted to embrace their royal status: Vivacious, theatrical, and passionate, Leos love to bask in the spotlight and celebrate themselves.", + "Motto": "***\u201cIf you know the way, go the way and show the way\u2014you're a leader.\u201d***", + "Strengths": "creative, passionate, generous, warm-hearted, cheerful, humorous.", + "Weaknesses": "arrogant, stubborn, self-centered, lazy, inflexible.", + "full_form": "__**L**__eaders\n__**E**__nergetic\n__**O**__ptimistic", + "url": "https://www.horoscope.com/images-US/signs/profile-leo.png" + }, + "Virgo": { + "start_at": "2020-08-23", + "end_at": "2020-09-22", + "About": "Amazing people born between **August 23** to **September 22**. Virgo is an earth sign historically represented by the goddess of wheat and agriculture, an association that speaks to Virgo\u2019s deep-rooted presence in the material world. Virgos are logical, practical, and systematic in their approach to life. This earth sign is a perfectionist at heart and isn\u2019t afraid to improve skills through diligent and consistent practice.", + "Motto": "***\u201cMy best can always be better.\u201d***", + "Strengths": "loyal, analytical, kind, hardworking, practical.", + "Weaknesses": "shyness, worry, overly critical of self and others, all work and no play.", + "full_form": "__**V**__irtuous\n__**I**__ntelligent\n__**R**__esponsible\n__**G**__enerous\n__**O**__ptimistic", + "url": "https://www.horoscope.com/images-US/signs/profile-virgo.png" + }, + "Libra": { + "start_at": "2020-09-23", + "end_at": "2020-10-22", + "About": "Amazing people born between **September 23** to **October 22**. Libra is an air sign represented by the scales (interestingly, the only inanimate object of the zodiac), an association that reflects Libra's fixation on balance and harmony. Libra is obsessed with symmetry and strives to create equilibrium in all areas of life.", + "Motto": "***\u201cNo person is an island.\u201d***", + "Strengths": "cooperative, diplomatic, gracious, fair-minded, social.", + "Weaknesses": "indecisive, avoids confrontations, will carry a grudge, self-pity.", + "full_form": "__**L**__oyal\n__**I**__nquisitive\n__**B**__alanced\n__**R**__esponsible\n__**A**__ltruistic", + "url": "https://www.horoscope.com/images-US/signs/profile-libra.png" + }, + "Scorpio": { + "start_at": "2020-10-23", + "end_at": "2020-11-21", + "About": "Amazing people born between **October 23** to **November 21**. Scorpio is one of the most misunderstood signs of the zodiac. Because of its incredible passion and power, Scorpio is often mistaken for a fire sign. In fact, Scorpio is a water sign that derives its strength from the psychic, emotional realm.", + "Motto": "***\u201cYou never know what you are capable of until you try.\u201d***", + "Strengths": "resourceful, brave, passionate, stubborn, a true friend.", + "Weaknesses": "distrusting, jealous, secretive, violent.", + "full_form": "__**S**__eductive\n__**C**__erebral\n__**O**__riginal\n__**R**__eactive\n__**P**__assionate\n__**I**__ntuitive\n__**O**__utstanding", + "url": "https://www.horoscope.com/images-US/signs/profile-scorpio.png" + }, + "Sagittarius": { + "start_at": "2020-11-22", + "end_at": "2020-12-21", + "About": "Amazing people born between **November 22** to **December 21**. Represented by the archer, Sagittarians are always on a quest for knowledge. The last fire sign of the zodiac, Sagittarius launches its many pursuits like blazing arrows, chasing after geographical, intellectual, and spiritual adventures.", + "Motto": "***\u201cTowering genius disdains a beaten path.\u201d***", + "Strengths": "generous, idealistic, great sense of humor.", + "Weaknesses": "promises more than can deliver, very impatient, will say anything no matter how undiplomatic.", + "full_form": "__**S**__eductive\n__**A**__dventurous\n__**G**__rateful\n__**I**__ntelligent\n__**T**__railblazing\n__**T**__enacious adept\n__**A**__dept\n__**R**__esponsible\n__**I**__dealistic\n__**U**__nparalled\n__**S**__ophisticated", + "url": "https://www.horoscope.com/images-US/signs/profile-sagittarius.png" + }, + "Capricorn": { + "start_at": "2020-12-22", + "end_at": "2020-01-19", + "About": "Amazing people born between **December 22** to **January 19**. The last earth sign of the zodiac, Capricorn is represented by the sea goat, a mythological creature with the body of a goat and tail of a fish. Accordingly, Capricorns are skilled at navigating both the material and emotional realms.", + "Motto": "***\u201cI can succeed at anything I put my mind to.\u201d***", + "Strengths": "responsible, disciplined, self-control, good managers.", + "Weaknesses": "know-it-all, unforgiving, condescending, expecting the worst.", + "full_form": "__**C**__onfident\n__**A**__nalytical\n__**P**__ractical\n__**R**__esponsible\n__**I**__ntelligent\n__**C**__aring\n__**O**__rganized\n__**R**__ealistic\n__**N**__eat", + "url": "https://www.horoscope.com/images-US/signs/profile-capricorn.png" + }, + "Aquarius": { + "start_at": "2020-01-20", + "end_at": "2020-02-18", + "About": "Amazing people born between **January 20** to **February 18**. Despite the \u201caqua\u201d in its name, Aquarius is actually the last air sign of the zodiac. Aquarius is represented by the water bearer, the mystical healer who bestows water, or life, upon the land. Accordingly, Aquarius is the most humanitarian astrological sign.", + "Motto": "***\u201cThere is no me, there is only we.\u201d***", + "Strengths": "Progressive, original, independent, humanitarian.", + "Weaknesses": "Runs from emotional expression, temperamental, uncompromising, aloof.", + "full_form": "__**A**__nalytical\n__**Q**__uirky\n__**U**__ncompromising\n__**A**__ction-focused\n__**R**__espectful\n__**I**__ntelligent\n__**U**__nique\n__**S**__incere", + "url": "https://www.horoscope.com/images-US/signs/profile-aquarius.png" + }, + "Pisces": { + "start_at": "2020-02-19", + "end_at": "2020-03-20", + "About": "Amazing people born between **February 19** to **March 20**. Pisces, a water sign, is the last constellation of the zodiac. It's symbolized by two fish swimming in opposite directions, representing the constant division of Pisces' attention between fantasy and reality. As the final sign, Pisces has absorbed every lesson \u2014 the joys and the pain, the hopes and the fears \u2014 learned by all of the other signs.", + "Motto": "***\u201cI have a lot of love to give, it only takes a little patience and those worth giving it all to.\u201d***", + "Strengths": "Compassionate, artistic, intuitive, gentle, wise, musical.", + "Weaknesses": "Fearful, overly trusting, sad, desire to escape reality, can be a victim or a martyr.", + "full_form": "__**P**__sychic\n__**I**__ntelligent\n__**S**__urprising\n__**C**__reative\n__**E**__motionally-driven\n__**S**__ensitive", + "url": "https://www.horoscope.com/images-US/signs/profile-pisces.png" + } } -- cgit v1.2.3 From 652d6878c98d5c338f6e50657d7f53fd546f1d04 Mon Sep 17 00:00:00 2001 From: Anubhav1603 Date: Fri, 25 Sep 2020 18:35:13 +0530 Subject: fixed typo --- bot/exts/valentines/valentine_zodiac.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bot/exts/valentines/valentine_zodiac.py b/bot/exts/valentines/valentine_zodiac.py index 60510377..c2085d8e 100644 --- a/bot/exts/valentines/valentine_zodiac.py +++ b/bot/exts/valentines/valentine_zodiac.py @@ -18,10 +18,10 @@ HEART_EMOJIS = [":heart:", ":gift_heart:", ":revolving_hearts:", ":sparkling_hea ZODIAC_SIGNS = ["Aries", "Taurus", "Gemini", "Cancer", "Leo", "Virgo", "Libra", "Scorpio", "Sagittarius", "Capricorn", "Aquarius", "Pisces"] -MONTH_NAME = {"January": 1, "Jan": 1, "Feburary": 2, "Feb": 2, "March": 3, "Mar": 3, +MONTH_NAME = {"January": 1, "Jan": 1, "February": 2, "Feb": 2, "March": 3, "Mar": 3, "April": 4, "Apr": 4, "May": 5, "June": 6, "Jun": 6, "July": 7, "Jul": 7, "August": 8, "Aug": 8, "September": 9, "Sept": 9, "October": 10, "Oct": 10, - "November": 11, "Nove": 11, "December": 12, "December": 12 + "November": 11, "Nov": 11, "December": 12, "Dec": 12 } -- cgit v1.2.3 From 73ce191c9e8c30cc4ecc677414cd3d826a336f28 Mon Sep 17 00:00:00 2001 From: Anubhav1603 Date: Fri, 25 Sep 2020 19:39:45 +0530 Subject: added fromisoformat and bugfix --- bot/exts/valentines/valentine_zodiac.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/bot/exts/valentines/valentine_zodiac.py b/bot/exts/valentines/valentine_zodiac.py index 970fa0f2..6e33e5a5 100644 --- a/bot/exts/valentines/valentine_zodiac.py +++ b/bot/exts/valentines/valentine_zodiac.py @@ -1,9 +1,10 @@ +import calendar import logging import random from datetime import datetime from json import load from pathlib import Path -from typing import Union +from typing import Tuple, Union import discord from discord.ext import commands @@ -33,12 +34,15 @@ class ValentineZodiac(commands.Cog): self.zodiacs, self.zodiac_fact = self.load_comp_json() @staticmethod - def load_comp_json() -> dict: + def load_comp_json() -> Tuple[dict, dict]: """Load zodiac compatibility from static JSON resource.""" explanation_file = Path("bot/resources/valentines/zodiac_explanation.json") compatibility_file = Path("bot/resources/valentines/zodiac_compatibility.json") with explanation_file.open(encoding="utf8") as json_data: zodiac_fact = load(json_data) + for _, zodiac_data in zodiac_fact.items(): + zodiac_data['start_at'] = datetime.fromisoformat(zodiac_data['start_at']) + zodiac_data['end_at'] = datetime.fromisoformat(zodiac_data['end_at']) with compatibility_file.open(encoding="utf8") as json_data: zodiacs = load(json_data) return zodiacs, zodiac_fact @@ -67,7 +71,7 @@ class ValentineZodiac(commands.Cog): def zodiac_date_verifer(self, query_datetime: datetime) -> str: """Returns zodiac sign by checking month and date.""" for zodiac_name, zodiac_data in self.zodiac_fact.items(): - if zodiac_data["start_at"] <= query_datetime.date() <= zodiac_data["end_at"]: + if zodiac_data["start_at"].date() <= query_datetime.date() <= zodiac_data["end_at"].date(): zodiac = zodiac_name break else: @@ -87,8 +91,8 @@ class ValentineZodiac(commands.Cog): async def date_and_month(self, ctx: commands.Context, date: int, month: Union[int, str]) -> None: """Provides information about zodiac sign by taking month and date as input.""" if isinstance(month, str): - month = month.capitalize() try: + month = month.capitalize() month = list(calendar.month_abbr).index(month[:3]) except ValueError: await ctx.send("Sorry, but you have given wrong month name.") -- cgit v1.2.3 From 8d343e3dbcc5678a074a8d304ea17ad58cfee035 Mon Sep 17 00:00:00 2001 From: Anubhav1603 Date: Fri, 25 Sep 2020 19:54:04 +0530 Subject: corrected typo --- bot/exts/valentines/valentine_zodiac.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bot/exts/valentines/valentine_zodiac.py b/bot/exts/valentines/valentine_zodiac.py index 6e33e5a5..fa3a353c 100644 --- a/bot/exts/valentines/valentine_zodiac.py +++ b/bot/exts/valentines/valentine_zodiac.py @@ -68,7 +68,7 @@ class ValentineZodiac(commands.Cog): log.info("Zodiac embed ready") return embed - def zodiac_date_verifer(self, query_datetime: datetime) -> str: + def zodiac_date_verifier(self, query_datetime: datetime) -> str: """Returns zodiac sign by checking month and date.""" for zodiac_name, zodiac_data in self.zodiac_fact.items(): if zodiac_data["start_at"].date() <= query_datetime.date() <= zodiac_data["end_at"].date(): @@ -102,7 +102,7 @@ class ValentineZodiac(commands.Cog): final_embed = self.zodiac_sign_verify(zodiac) else: try: - zodiac_sign_based_on_month_and_date = self.zodiac_date_verifer(datetime(2020, month, date)) + zodiac_sign_based_on_month_and_date = self.zodiac_date_verifier(datetime(2020, month, date)) log.info("zodiac sign based on month and date received") except ValueError as e: log.info("zodiac sign based on month and date returned None") @@ -127,7 +127,7 @@ class ValentineZodiac(commands.Cog): emoji1 = random.choice(HEART_EMOJIS) emoji2 = random.choice(HEART_EMOJIS) embed = discord.Embed( - title="Zodic Compatibility", + title="Zodiac Compatibility", description=f'{zodiac_sign.capitalize()}{emoji1}{compatible_zodiac["Zodiac"]}\n' f'{emoji2}Compatibility meter : {compatible_zodiac["compatibility_score"]}{emoji2}', color=Colours.pink -- cgit v1.2.3 From cc55da602cf16cd8c1018ee10c14de320c4943e5 Mon Sep 17 00:00:00 2001 From: Anubhav1603 Date: Fri, 25 Sep 2020 22:53:18 +0530 Subject: handled error for and corrected error for invalid input, removed unncessary list --- bot/exts/valentines/valentine_zodiac.py | 76 ++++++++++++++++----------------- 1 file changed, 36 insertions(+), 40 deletions(-) diff --git a/bot/exts/valentines/valentine_zodiac.py b/bot/exts/valentines/valentine_zodiac.py index fa3a353c..b182390b 100644 --- a/bot/exts/valentines/valentine_zodiac.py +++ b/bot/exts/valentines/valentine_zodiac.py @@ -16,15 +16,6 @@ log = logging.getLogger(__name__) LETTER_EMOJI = ':love_letter:' HEART_EMOJIS = [":heart:", ":gift_heart:", ":revolving_hearts:", ":sparkling_heart:", ":two_hearts:"] -ZODIAC_SIGNS = ["Aries", "Taurus", "Gemini", "Cancer", "Leo", "Virgo", "Libra", - "Scorpio", "Sagittarius", "Capricorn", "Aquarius", "Pisces"] - -MONTH_NAME = {"January": 1, "Jan": 1, "February": 2, "Feb": 2, "March": 3, "Mar": 3, - "April": 4, "Apr": 4, "May": 5, "June": 6, "Jun": 6, "July": 7, "Jul": 7, - "August": 8, "Aug": 8, "September": 9, "Sept": 9, "October": 10, "Oct": 10, - "November": 11, "Nov": 11, "December": 12, "Dec": 12 - } - class ValentineZodiac(commands.Cog): """A Cog that returns a counter compatible zodiac sign to the given user's zodiac sign.""" @@ -45,25 +36,27 @@ class ValentineZodiac(commands.Cog): zodiac_data['end_at'] = datetime.fromisoformat(zodiac_data['end_at']) with compatibility_file.open(encoding="utf8") as json_data: zodiacs = load(json_data) - return zodiacs, zodiac_fact + return zodiacs, zodiac_fact def zodiac_sign_verify(self, zodiac: str) -> discord.Embed: """Gives informative zodiac embed.""" zodiac = zodiac.capitalize() - zodiac_fact = self.zodiac_fact embed = discord.Embed() embed.color = Colours.pink - if zodiac in self.zodiac_fact: + if zodiac.capitalize() in self.zodiac_fact: log.info("Making zodiac embed") embed.title = f"__{zodiac}__" - embed.description = zodiac_fact[f"{zodiac}"]["About"] - embed.add_field(name='__Full form__', value=zodiac_fact[f"{zodiac}"]["full_form"], inline=False) - embed.add_field(name='__Motto__', value=zodiac_fact[f"{zodiac}"]["Motto"], inline=False) - embed.add_field(name='__Strengths__', value=zodiac_fact[f"{zodiac}"]["Strengths"], inline=False) - embed.add_field(name='__Weaknesses__', value=zodiac_fact[f"{zodiac}"]["Weaknesses"], inline=False) - embed.set_thumbnail(url=zodiac_fact[f"{zodiac}"]["url"]) + embed.description = self.zodiac_fact[zodiac]["About"] + embed.add_field(name='__Full form__', value=self.zodiac_fact[zodiac]["full_form"], inline=False) + embed.add_field(name='__Motto__', value=self.zodiac_fact[zodiac]["Motto"], inline=False) + embed.add_field(name='__Strengths__', value=self.zodiac_fact[zodiac]["Strengths"], inline=False) + embed.add_field(name='__Weaknesses__', value=self.zodiac_fact[zodiac]["Weaknesses"], inline=False) + embed.set_thumbnail(url=self.zodiac_fact[zodiac]["url"]) else: - embed.description = "Umm you gave wrong zodiac name so i aren't able to find any :sweat_smile:" + err_comp = [f"`{i}` {zod_name}" for i, zod_name in enumerate(self.zodiac_fact.keys(), start=1)] + error = ("\n").join(err_comp) + error_msg = f"`{zodiac}` is not a valid zodiac sign, here is the list of valid zodiac signs." + embed.description = f"{error_msg}\n{error}" log.info("Wrong Zodiac name provided") log.info("Zodiac embed ready") return embed @@ -73,16 +66,15 @@ class ValentineZodiac(commands.Cog): for zodiac_name, zodiac_data in self.zodiac_fact.items(): if zodiac_data["start_at"].date() <= query_datetime.date() <= zodiac_data["end_at"].date(): zodiac = zodiac_name - break - else: - zodiac = None - log.info("Wrong Zodiac date or month provided") log.info("Zodiac name sent") return zodiac @commands.group(name='zodiac', invoke_without_command=True) async def zodiac(self, ctx: commands.Context, zodiac_sign: str) -> None: """Provides information about zodiac sign by taking zodiac sign name as input.""" + if zodiac_sign.startswith("`"): + await ctx.send("Please don't include `") + return final_embed = self.zodiac_sign_verify(zodiac_sign) log.info("Embed successfully sent") await ctx.send(embed=final_embed) @@ -95,7 +87,7 @@ class ValentineZodiac(commands.Cog): month = month.capitalize() month = list(calendar.month_abbr).index(month[:3]) except ValueError: - await ctx.send("Sorry, but you have given wrong month name.") + await ctx.send(f"Sorry, but `{month}` is wrong month name.") return if (month == 1 and (1 <= date <= 19)) or (month == 12 and (22 <= date <= 31)): zodiac = "capricorn" @@ -108,7 +100,8 @@ class ValentineZodiac(commands.Cog): log.info("zodiac sign based on month and date returned None") final_embed = discord.Embed() final_embed.color = Colours.pink - final_embed.description = f"{e}, cannot find zodiac sign." + final_embed.description = f"Zodiac sign is not found because, {e}" + log.info(e) else: final_embed = self.zodiac_sign_verify(zodiac_sign_based_on_month_and_date) log.info("zodiac sign embed based on month and date is now sent.") @@ -118,24 +111,27 @@ class ValentineZodiac(commands.Cog): @zodiac.command(name="partnerzodiac") async def partner_zodiac(self, ctx: commands.Context, zodiac_sign: str) -> None: """Provides a counter compatible zodiac sign to the given user's zodiac sign.""" + embed = discord.Embed() + embed.color = Colours.pink + if zodiac_sign.startswith("`"): + await ctx.send("Please don't include `") + return try: compatible_zodiac = random.choice(self.zodiacs[zodiac_sign.lower()]) + emoji1 = random.choice(HEART_EMOJIS) + emoji2 = random.choice(HEART_EMOJIS) + embed.title = "Zodiac Compatibility" + embed.description = f"""{zodiac_sign.capitalize()}{emoji1}{compatible_zodiac["Zodiac"]} + {emoji2}Compatibility meter : {compatible_zodiac["compatibility_score"]}{emoji2}""" + embed.add_field( + name=f'A letter from Dr.Zodiac {LETTER_EMOJI}', + value=compatible_zodiac['description'] + ) except KeyError: - await ctx.send(f"`{zodiac_sign.capitalize()}` zodiac sign does not exist.") - return - - emoji1 = random.choice(HEART_EMOJIS) - emoji2 = random.choice(HEART_EMOJIS) - embed = discord.Embed( - title="Zodiac Compatibility", - description=f'{zodiac_sign.capitalize()}{emoji1}{compatible_zodiac["Zodiac"]}\n' - f'{emoji2}Compatibility meter : {compatible_zodiac["compatibility_score"]}{emoji2}', - color=Colours.pink - ) - embed.add_field( - name=f'A letter from Dr.Zodiac {LETTER_EMOJI}', - value=compatible_zodiac['description'] - ) + err_comp = [f"`{i}` {zod_name}" for i, zod_name in enumerate(self.zodiac_fact.keys(), start=1)] + error = ("\n").join(err_comp) + error_msg = f"`{zodiac_sign}` is not a valid zodiac sign, here is the list of valid zodiac signs." + embed.description = f"{error_msg}\n{error}" await ctx.send(embed=embed) -- cgit v1.2.3 From 626f2baa5ce5f3a551bb5f1a5406ce1d3afd5dbc Mon Sep 17 00:00:00 2001 From: Anubhav <57266248+Anubhav1603@users.noreply.github.com> Date: Sat, 26 Sep 2020 11:54:45 +0530 Subject: Changed item to values Co-authored-by: Rohan Reddy Alleti --- bot/exts/valentines/valentine_zodiac.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bot/exts/valentines/valentine_zodiac.py b/bot/exts/valentines/valentine_zodiac.py index b182390b..96d04947 100644 --- a/bot/exts/valentines/valentine_zodiac.py +++ b/bot/exts/valentines/valentine_zodiac.py @@ -31,7 +31,7 @@ class ValentineZodiac(commands.Cog): compatibility_file = Path("bot/resources/valentines/zodiac_compatibility.json") with explanation_file.open(encoding="utf8") as json_data: zodiac_fact = load(json_data) - for _, zodiac_data in zodiac_fact.items(): + for zodiac_data in zodiac_fact.values(): zodiac_data['start_at'] = datetime.fromisoformat(zodiac_data['start_at']) zodiac_data['end_at'] = datetime.fromisoformat(zodiac_data['end_at']) with compatibility_file.open(encoding="utf8") as json_data: -- cgit v1.2.3 From 0dc7cd1f4cd6f4b181dc9b9429d07de6413eb456 Mon Sep 17 00:00:00 2001 From: Anubhav1603 Date: Sat, 26 Sep 2020 15:29:17 +0530 Subject: changed capricorn end_at from 2020 to 2021 --- bot/resources/valentines/zodiac_explanation.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bot/resources/valentines/zodiac_explanation.json b/bot/resources/valentines/zodiac_explanation.json index 6be1a481..786392a3 100644 --- a/bot/resources/valentines/zodiac_explanation.json +++ b/bot/resources/valentines/zodiac_explanation.json @@ -91,7 +91,7 @@ }, "Capricorn": { "start_at": "2020-12-22", - "end_at": "2020-01-19", + "end_at": "2021-01-19", "About": "Amazing people born between **December 22** to **January 19**. The last earth sign of the zodiac, Capricorn is represented by the sea goat, a mythological creature with the body of a goat and tail of a fish. Accordingly, Capricorns are skilled at navigating both the material and emotional realms.", "Motto": "***\u201cI can succeed at anything I put my mind to.\u201d***", "Strengths": "responsible, disciplined, self-control, good managers.", -- cgit v1.2.3 From 905178cab28e1c4fa2a642cfc7e345cea43bc828 Mon Sep 17 00:00:00 2001 From: Anubhav1603 Date: Sat, 26 Sep 2020 15:30:24 +0530 Subject: changed error msg --- bot/exts/valentines/valentine_zodiac.py | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/bot/exts/valentines/valentine_zodiac.py b/bot/exts/valentines/valentine_zodiac.py index b182390b..90819688 100644 --- a/bot/exts/valentines/valentine_zodiac.py +++ b/bot/exts/valentines/valentine_zodiac.py @@ -1,7 +1,7 @@ import calendar import logging import random -from datetime import datetime +from datetime import date from json import load from pathlib import Path from typing import Tuple, Union @@ -32,8 +32,8 @@ class ValentineZodiac(commands.Cog): with explanation_file.open(encoding="utf8") as json_data: zodiac_fact = load(json_data) for _, zodiac_data in zodiac_fact.items(): - zodiac_data['start_at'] = datetime.fromisoformat(zodiac_data['start_at']) - zodiac_data['end_at'] = datetime.fromisoformat(zodiac_data['end_at']) + zodiac_data['start_at'] = date.fromisoformat(zodiac_data['start_at']) + zodiac_data['end_at'] = date.fromisoformat(zodiac_data['end_at']) with compatibility_file.open(encoding="utf8") as json_data: zodiacs = load(json_data) return zodiacs, zodiac_fact @@ -55,16 +55,16 @@ class ValentineZodiac(commands.Cog): else: err_comp = [f"`{i}` {zod_name}" for i, zod_name in enumerate(self.zodiac_fact.keys(), start=1)] error = ("\n").join(err_comp) - error_msg = f"`{zodiac}` is not a valid zodiac sign, here is the list of valid zodiac signs." + error_msg = f"**{zodiac}** is not a valid zodiac sign, here is the list of valid zodiac signs." embed.description = f"{error_msg}\n{error}" log.info("Wrong Zodiac name provided") log.info("Zodiac embed ready") return embed - def zodiac_date_verifier(self, query_datetime: datetime) -> str: + def zodiac_date_verifier(self, query_datetime: date) -> str: """Returns zodiac sign by checking month and date.""" for zodiac_name, zodiac_data in self.zodiac_fact.items(): - if zodiac_data["start_at"].date() <= query_datetime.date() <= zodiac_data["end_at"].date(): + if zodiac_data["start_at"] <= query_datetime <= zodiac_data["end_at"]: zodiac = zodiac_name log.info("Zodiac name sent") return zodiac @@ -72,15 +72,12 @@ class ValentineZodiac(commands.Cog): @commands.group(name='zodiac', invoke_without_command=True) async def zodiac(self, ctx: commands.Context, zodiac_sign: str) -> None: """Provides information about zodiac sign by taking zodiac sign name as input.""" - if zodiac_sign.startswith("`"): - await ctx.send("Please don't include `") - return final_embed = self.zodiac_sign_verify(zodiac_sign) log.info("Embed successfully sent") await ctx.send(embed=final_embed) @zodiac.command(name="date") - async def date_and_month(self, ctx: commands.Context, date: int, month: Union[int, str]) -> None: + async def date_and_month(self, ctx: commands.Context, query_date: int, month: Union[int, str]) -> None: """Provides information about zodiac sign by taking month and date as input.""" if isinstance(month, str): try: @@ -94,10 +91,10 @@ class ValentineZodiac(commands.Cog): final_embed = self.zodiac_sign_verify(zodiac) else: try: - zodiac_sign_based_on_month_and_date = self.zodiac_date_verifier(datetime(2020, month, date)) + zodiac_sign_based_on_month_and_date = self.zodiac_date_verifier(date(2020, month, query_date)) log.info("zodiac sign based on month and date received") except ValueError as e: - log.info("zodiac sign based on month and date returned None") + log.info("invalid date or month given") final_embed = discord.Embed() final_embed.color = Colours.pink final_embed.description = f"Zodiac sign is not found because, {e}" @@ -113,9 +110,6 @@ class ValentineZodiac(commands.Cog): """Provides a counter compatible zodiac sign to the given user's zodiac sign.""" embed = discord.Embed() embed.color = Colours.pink - if zodiac_sign.startswith("`"): - await ctx.send("Please don't include `") - return try: compatible_zodiac = random.choice(self.zodiacs[zodiac_sign.lower()]) emoji1 = random.choice(HEART_EMOJIS) @@ -130,7 +124,7 @@ class ValentineZodiac(commands.Cog): except KeyError: err_comp = [f"`{i}` {zod_name}" for i, zod_name in enumerate(self.zodiac_fact.keys(), start=1)] error = ("\n").join(err_comp) - error_msg = f"`{zodiac_sign}` is not a valid zodiac sign, here is the list of valid zodiac signs." + error_msg = f"**{zodiac_sign}** is not a valid zodiac sign, here is the list of valid zodiac signs." embed.description = f"{error_msg}\n{error}" await ctx.send(embed=embed) -- cgit v1.2.3 From a1ce0df145e7a49762a9363f92aeae2e716463b1 Mon Sep 17 00:00:00 2001 From: Anubhav1603 Date: Sat, 26 Sep 2020 15:46:51 +0530 Subject: fixed var name --- bot/exts/valentines/valentine_zodiac.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bot/exts/valentines/valentine_zodiac.py b/bot/exts/valentines/valentine_zodiac.py index 1e746ed7..963d130d 100644 --- a/bot/exts/valentines/valentine_zodiac.py +++ b/bot/exts/valentines/valentine_zodiac.py @@ -86,7 +86,7 @@ class ValentineZodiac(commands.Cog): except ValueError: await ctx.send(f"Sorry, but `{month}` is wrong month name.") return - if (month == 1 and (1 <= date <= 19)) or (month == 12 and (22 <= date <= 31)): + if (month == 1 and (1 <= query_date <= 19)) or (month == 12 and (22 <= query_date <= 31)): zodiac = "capricorn" final_embed = self.zodiac_sign_verify(zodiac) else: -- cgit v1.2.3 From d1e8c589b99aa8441a0bd911852870680de6d9b8 Mon Sep 17 00:00:00 2001 From: Anubhav1603 Date: Sat, 26 Sep 2020 17:53:57 +0530 Subject: added break and made separate error function --- bot/exts/valentines/valentine_zodiac.py | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/bot/exts/valentines/valentine_zodiac.py b/bot/exts/valentines/valentine_zodiac.py index 963d130d..c1c1aff8 100644 --- a/bot/exts/valentines/valentine_zodiac.py +++ b/bot/exts/valentines/valentine_zodiac.py @@ -38,6 +38,17 @@ class ValentineZodiac(commands.Cog): zodiacs = load(json_data) return zodiacs, zodiac_fact + def error(self, zodiac: str) -> discord.Embed: + """Returns error embed.""" + embed = discord.Embed() + embed.color = Colours.pink + err_comp = [f"`{i}` {zod_name}" for i, zod_name in enumerate(self.zodiac_fact.keys(), start=1)] + err = ("\n").join(err_comp) + error_msg = f"**{zodiac}** is not a valid zodiac sign, here is the list of valid zodiac signs." + embed.description = f"{error_msg}\n{err}" + log.info("Wrong Zodiac name provided") + return embed + def zodiac_sign_verify(self, zodiac: str) -> discord.Embed: """Gives informative zodiac embed.""" zodiac = zodiac.capitalize() @@ -53,11 +64,7 @@ class ValentineZodiac(commands.Cog): embed.add_field(name='__Weaknesses__', value=self.zodiac_fact[zodiac]["Weaknesses"], inline=False) embed.set_thumbnail(url=self.zodiac_fact[zodiac]["url"]) else: - err_comp = [f"`{i}` {zod_name}" for i, zod_name in enumerate(self.zodiac_fact.keys(), start=1)] - error = ("\n").join(err_comp) - error_msg = f"**{zodiac}** is not a valid zodiac sign, here is the list of valid zodiac signs." - embed.description = f"{error_msg}\n{error}" - log.info("Wrong Zodiac name provided") + embed = self.error(zodiac) log.info("Zodiac embed ready") return embed @@ -66,6 +73,7 @@ class ValentineZodiac(commands.Cog): for zodiac_name, zodiac_data in self.zodiac_fact.items(): if zodiac_data["start_at"] <= query_datetime <= zodiac_data["end_at"]: zodiac = zodiac_name + break log.info("Zodiac name sent") return zodiac @@ -122,10 +130,7 @@ class ValentineZodiac(commands.Cog): value=compatible_zodiac['description'] ) except KeyError: - err_comp = [f"`{i}` {zod_name}" for i, zod_name in enumerate(self.zodiac_fact.keys(), start=1)] - error = ("\n").join(err_comp) - error_msg = f"**{zodiac_sign}** is not a valid zodiac sign, here is the list of valid zodiac signs." - embed.description = f"{error_msg}\n{error}" + embed = self.error(zodiac_sign) await ctx.send(embed=embed) -- cgit v1.2.3 From e0443640e6711909c5e28419622c235b8da6b82b Mon Sep 17 00:00:00 2001 From: Anubhav <57266248+Anubhav1603@users.noreply.github.com> Date: Sun, 27 Sep 2020 13:53:06 +0530 Subject: Changed zodiac_sign_verify to zodiac_build_embed Co-authored-by: PureFunctor --- bot/exts/valentines/valentine_zodiac.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bot/exts/valentines/valentine_zodiac.py b/bot/exts/valentines/valentine_zodiac.py index c1c1aff8..71e5bae9 100644 --- a/bot/exts/valentines/valentine_zodiac.py +++ b/bot/exts/valentines/valentine_zodiac.py @@ -49,7 +49,7 @@ class ValentineZodiac(commands.Cog): log.info("Wrong Zodiac name provided") return embed - def zodiac_sign_verify(self, zodiac: str) -> discord.Embed: + def zodiac_build_embed(self, zodiac: str) -> discord.Embed: """Gives informative zodiac embed.""" zodiac = zodiac.capitalize() embed = discord.Embed() -- cgit v1.2.3 From e5f0eae51dc479e9f6fb5496ed20f672b9c2cdff Mon Sep 17 00:00:00 2001 From: Anubhav1603 Date: Sun, 27 Sep 2020 14:23:14 +0530 Subject: removed extra var from error method --- bot/exts/valentines/valentine_zodiac.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/bot/exts/valentines/valentine_zodiac.py b/bot/exts/valentines/valentine_zodiac.py index 71e5bae9..9315f304 100644 --- a/bot/exts/valentines/valentine_zodiac.py +++ b/bot/exts/valentines/valentine_zodiac.py @@ -42,10 +42,10 @@ class ValentineZodiac(commands.Cog): """Returns error embed.""" embed = discord.Embed() embed.color = Colours.pink - err_comp = [f"`{i}` {zod_name}" for i, zod_name in enumerate(self.zodiac_fact.keys(), start=1)] - err = ("\n").join(err_comp) - error_msg = f"**{zodiac}** is not a valid zodiac sign, here is the list of valid zodiac signs." - embed.description = f"{error_msg}\n{err}" + error_comp = ("\n").join([f"`{i}` {zod_name}" + for i, zod_name in enumerate(self.zodiac_fact.keys(), start=1)]) + embed.description = f"""**{zodiac}** is not a valid zodiac sign, here is the list of valid zodiac signs. + {error_comp}""" log.info("Wrong Zodiac name provided") return embed @@ -80,7 +80,7 @@ class ValentineZodiac(commands.Cog): @commands.group(name='zodiac', invoke_without_command=True) async def zodiac(self, ctx: commands.Context, zodiac_sign: str) -> None: """Provides information about zodiac sign by taking zodiac sign name as input.""" - final_embed = self.zodiac_sign_verify(zodiac_sign) + final_embed = self.zodiac_build_embed(zodiac_sign) log.info("Embed successfully sent") await ctx.send(embed=final_embed) @@ -96,7 +96,7 @@ class ValentineZodiac(commands.Cog): return if (month == 1 and (1 <= query_date <= 19)) or (month == 12 and (22 <= query_date <= 31)): zodiac = "capricorn" - final_embed = self.zodiac_sign_verify(zodiac) + final_embed = self.zodiac_build_embed(zodiac) else: try: zodiac_sign_based_on_month_and_date = self.zodiac_date_verifier(date(2020, month, query_date)) @@ -108,7 +108,7 @@ class ValentineZodiac(commands.Cog): final_embed.description = f"Zodiac sign is not found because, {e}" log.info(e) else: - final_embed = self.zodiac_sign_verify(zodiac_sign_based_on_month_and_date) + final_embed = self.zodiac_build_embed(zodiac_sign_based_on_month_and_date) log.info("zodiac sign embed based on month and date is now sent.") await ctx.send(embed=final_embed) -- cgit v1.2.3 From 5db5100290139fc66e85aaba2aa8314f336c8b0a Mon Sep 17 00:00:00 2001 From: Anubhav1603 Date: Sun, 27 Sep 2020 14:37:13 +0530 Subject: rewritten code of error method in better manner --- bot/exts/valentines/valentine_zodiac.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/bot/exts/valentines/valentine_zodiac.py b/bot/exts/valentines/valentine_zodiac.py index 9315f304..5a03a9e4 100644 --- a/bot/exts/valentines/valentine_zodiac.py +++ b/bot/exts/valentines/valentine_zodiac.py @@ -42,10 +42,13 @@ class ValentineZodiac(commands.Cog): """Returns error embed.""" embed = discord.Embed() embed.color = Colours.pink - error_comp = ("\n").join([f"`{i}` {zod_name}" - for i, zod_name in enumerate(self.zodiac_fact.keys(), start=1)]) - embed.description = f"""**{zodiac}** is not a valid zodiac sign, here is the list of valid zodiac signs. - {error_comp}""" + error_comp = "\n".join( + [f"`{i}` {zod_name}"for i, zod_name in enumerate(self.zodiac_fact.keys(), start=1)] + ) + embed.description = ( + f"**{zodiac}** is not a valid zodiac sign, here is the list of valid zodiac signs.\n" + f"{error_comp}" + ) log.info("Wrong Zodiac name provided") return embed -- cgit v1.2.3 From e1cb20edd802299e643e3a0a59269acf9cd1d6ee Mon Sep 17 00:00:00 2001 From: Anubhav1603 Date: Sun, 27 Sep 2020 14:41:36 +0530 Subject: removed triple quotes and made code readable --- bot/exts/valentines/valentine_zodiac.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bot/exts/valentines/valentine_zodiac.py b/bot/exts/valentines/valentine_zodiac.py index 5a03a9e4..d50a6288 100644 --- a/bot/exts/valentines/valentine_zodiac.py +++ b/bot/exts/valentines/valentine_zodiac.py @@ -126,8 +126,10 @@ class ValentineZodiac(commands.Cog): emoji1 = random.choice(HEART_EMOJIS) emoji2 = random.choice(HEART_EMOJIS) embed.title = "Zodiac Compatibility" - embed.description = f"""{zodiac_sign.capitalize()}{emoji1}{compatible_zodiac["Zodiac"]} - {emoji2}Compatibility meter : {compatible_zodiac["compatibility_score"]}{emoji2}""" + embed.description = ( + f'{zodiac_sign.capitalize()}{emoji1}{compatible_zodiac["Zodiac"]}' + f'{emoji2}Compatibility meter : {compatible_zodiac["compatibility_score"]}{emoji2}' + ) embed.add_field( name=f'A letter from Dr.Zodiac {LETTER_EMOJI}', value=compatible_zodiac['description'] -- cgit v1.2.3 From aa9d633b7a2442620b2622c493030a57aa57b117 Mon Sep 17 00:00:00 2001 From: Anubhav1603 Date: Sun, 27 Sep 2020 14:44:44 +0530 Subject: added \n --- bot/exts/valentines/valentine_zodiac.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bot/exts/valentines/valentine_zodiac.py b/bot/exts/valentines/valentine_zodiac.py index d50a6288..29f9ce76 100644 --- a/bot/exts/valentines/valentine_zodiac.py +++ b/bot/exts/valentines/valentine_zodiac.py @@ -127,7 +127,7 @@ class ValentineZodiac(commands.Cog): emoji2 = random.choice(HEART_EMOJIS) embed.title = "Zodiac Compatibility" embed.description = ( - f'{zodiac_sign.capitalize()}{emoji1}{compatible_zodiac["Zodiac"]}' + f'{zodiac_sign.capitalize()}{emoji1}{compatible_zodiac["Zodiac"]}\n' f'{emoji2}Compatibility meter : {compatible_zodiac["compatibility_score"]}{emoji2}' ) embed.add_field( -- cgit v1.2.3 From a98460aac0ffa3a9fd79a2dd8c09cdf00a0ce237 Mon Sep 17 00:00:00 2001 From: Anubhav1603 Date: Sun, 27 Sep 2020 15:14:06 +0530 Subject: added period in log statement and removed [] from list comp at error method --- bot/exts/valentines/valentine_zodiac.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/bot/exts/valentines/valentine_zodiac.py b/bot/exts/valentines/valentine_zodiac.py index 29f9ce76..4acfe59b 100644 --- a/bot/exts/valentines/valentine_zodiac.py +++ b/bot/exts/valentines/valentine_zodiac.py @@ -43,13 +43,13 @@ class ValentineZodiac(commands.Cog): embed = discord.Embed() embed.color = Colours.pink error_comp = "\n".join( - [f"`{i}` {zod_name}"for i, zod_name in enumerate(self.zodiac_fact.keys(), start=1)] + f"`{i}` {zod_name}"for i, zod_name in enumerate(self.zodiac_fact.keys(), start=1) ) embed.description = ( f"**{zodiac}** is not a valid zodiac sign, here is the list of valid zodiac signs.\n" f"{error_comp}" ) - log.info("Wrong Zodiac name provided") + log.info("Wrong Zodiac name provided.") return embed def zodiac_build_embed(self, zodiac: str) -> discord.Embed: @@ -58,7 +58,7 @@ class ValentineZodiac(commands.Cog): embed = discord.Embed() embed.color = Colours.pink if zodiac.capitalize() in self.zodiac_fact: - log.info("Making zodiac embed") + log.info("Making zodiac embed.") embed.title = f"__{zodiac}__" embed.description = self.zodiac_fact[zodiac]["About"] embed.add_field(name='__Full form__', value=self.zodiac_fact[zodiac]["full_form"], inline=False) @@ -68,7 +68,7 @@ class ValentineZodiac(commands.Cog): embed.set_thumbnail(url=self.zodiac_fact[zodiac]["url"]) else: embed = self.error(zodiac) - log.info("Zodiac embed ready") + log.info("Zodiac embed ready.") return embed def zodiac_date_verifier(self, query_datetime: date) -> str: @@ -77,14 +77,14 @@ class ValentineZodiac(commands.Cog): if zodiac_data["start_at"] <= query_datetime <= zodiac_data["end_at"]: zodiac = zodiac_name break - log.info("Zodiac name sent") + log.info("Zodiac name sent.") return zodiac @commands.group(name='zodiac', invoke_without_command=True) async def zodiac(self, ctx: commands.Context, zodiac_sign: str) -> None: """Provides information about zodiac sign by taking zodiac sign name as input.""" final_embed = self.zodiac_build_embed(zodiac_sign) - log.info("Embed successfully sent") + log.info("Embed successfully sent.") await ctx.send(embed=final_embed) @zodiac.command(name="date") @@ -103,13 +103,13 @@ class ValentineZodiac(commands.Cog): else: try: zodiac_sign_based_on_month_and_date = self.zodiac_date_verifier(date(2020, month, query_date)) - log.info("zodiac sign based on month and date received") + log.info("zodiac sign based on month and date received.") except ValueError as e: - log.info("invalid date or month given") + log.info("invalid date or month given.") final_embed = discord.Embed() final_embed.color = Colours.pink final_embed.description = f"Zodiac sign is not found because, {e}" - log.info(e) + log.info(f"error caused due to: {e}.") else: final_embed = self.zodiac_build_embed(zodiac_sign_based_on_month_and_date) log.info("zodiac sign embed based on month and date is now sent.") -- cgit v1.2.3 From 619eeab71047c8493be4d1f2c023bbbb1f3049aa Mon Sep 17 00:00:00 2001 From: Anubhav1603 Date: Sun, 27 Sep 2020 16:23:16 +0530 Subject: corrected grammer of logging statement ,imported json and add [] back --- bot/exts/valentines/valentine_zodiac.py | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/bot/exts/valentines/valentine_zodiac.py b/bot/exts/valentines/valentine_zodiac.py index 4acfe59b..69c3770c 100644 --- a/bot/exts/valentines/valentine_zodiac.py +++ b/bot/exts/valentines/valentine_zodiac.py @@ -1,8 +1,8 @@ import calendar +import json import logging import random from datetime import date -from json import load from pathlib import Path from typing import Tuple, Union @@ -30,12 +30,12 @@ class ValentineZodiac(commands.Cog): explanation_file = Path("bot/resources/valentines/zodiac_explanation.json") compatibility_file = Path("bot/resources/valentines/zodiac_compatibility.json") with explanation_file.open(encoding="utf8") as json_data: - zodiac_fact = load(json_data) + zodiac_fact = json.load(json_data) for zodiac_data in zodiac_fact.values(): zodiac_data['start_at'] = date.fromisoformat(zodiac_data['start_at']) zodiac_data['end_at'] = date.fromisoformat(zodiac_data['end_at']) with compatibility_file.open(encoding="utf8") as json_data: - zodiacs = load(json_data) + zodiacs = json.load(json_data) return zodiacs, zodiac_fact def error(self, zodiac: str) -> discord.Embed: @@ -43,13 +43,13 @@ class ValentineZodiac(commands.Cog): embed = discord.Embed() embed.color = Colours.pink error_comp = "\n".join( - f"`{i}` {zod_name}"for i, zod_name in enumerate(self.zodiac_fact.keys(), start=1) + [f"`{i}` {zod_name}" for i, zod_name in enumerate(self.zodiac_fact.keys(), start=1)] ) embed.description = ( f"**{zodiac}** is not a valid zodiac sign, here is the list of valid zodiac signs.\n" f"{error_comp}" ) - log.info("Wrong Zodiac name provided.") + log.info("Invalid zodiac name provided.") return embed def zodiac_build_embed(self, zodiac: str) -> discord.Embed: @@ -57,7 +57,7 @@ class ValentineZodiac(commands.Cog): zodiac = zodiac.capitalize() embed = discord.Embed() embed.color = Colours.pink - if zodiac.capitalize() in self.zodiac_fact: + if zodiac in self.zodiac_fact: log.info("Making zodiac embed.") embed.title = f"__{zodiac}__" embed.description = self.zodiac_fact[zodiac]["About"] @@ -75,27 +75,25 @@ class ValentineZodiac(commands.Cog): """Returns zodiac sign by checking month and date.""" for zodiac_name, zodiac_data in self.zodiac_fact.items(): if zodiac_data["start_at"] <= query_datetime <= zodiac_data["end_at"]: - zodiac = zodiac_name - break - log.info("Zodiac name sent.") - return zodiac + log.info("Zodiac name sent.") + return zodiac_name @commands.group(name='zodiac', invoke_without_command=True) async def zodiac(self, ctx: commands.Context, zodiac_sign: str) -> None: """Provides information about zodiac sign by taking zodiac sign name as input.""" final_embed = self.zodiac_build_embed(zodiac_sign) - log.info("Embed successfully sent.") await ctx.send(embed=final_embed) + log.info("Embed successfully sent.") @zodiac.command(name="date") async def date_and_month(self, ctx: commands.Context, query_date: int, month: Union[int, str]) -> None: """Provides information about zodiac sign by taking month and date as input.""" if isinstance(month, str): + month = month.capitalize() try: - month = month.capitalize() month = list(calendar.month_abbr).index(month[:3]) except ValueError: - await ctx.send(f"Sorry, but `{month}` is wrong month name.") + await ctx.send(f"Sorry, but `{month}` is not a valid month name.") return if (month == 1 and (1 <= query_date <= 19)) or (month == 12 and (22 <= query_date <= 31)): zodiac = "capricorn" @@ -105,16 +103,15 @@ class ValentineZodiac(commands.Cog): zodiac_sign_based_on_month_and_date = self.zodiac_date_verifier(date(2020, month, query_date)) log.info("zodiac sign based on month and date received.") except ValueError as e: - log.info("invalid date or month given.") final_embed = discord.Embed() final_embed.color = Colours.pink final_embed.description = f"Zodiac sign is not found because, {e}" log.info(f"error caused due to: {e}.") else: final_embed = self.zodiac_build_embed(zodiac_sign_based_on_month_and_date) - log.info("zodiac sign embed based on month and date is now sent.") await ctx.send(embed=final_embed) + log.info("Zodiac sign embed based on month and date is now sent.") @zodiac.command(name="partnerzodiac") async def partner_zodiac(self, ctx: commands.Context, zodiac_sign: str) -> None: -- cgit v1.2.3 From e56b8b9cd6713a30b1349a28d761293f2357d684 Mon Sep 17 00:00:00 2001 From: Anubhav <57266248+Anubhav1603@users.noreply.github.com> Date: Sun, 27 Sep 2020 20:07:22 +0530 Subject: Update bot/exts/valentines/valentine_zodiac.py Co-authored-by: wookie184 --- bot/exts/valentines/valentine_zodiac.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bot/exts/valentines/valentine_zodiac.py b/bot/exts/valentines/valentine_zodiac.py index 69c3770c..6e6ad2f6 100644 --- a/bot/exts/valentines/valentine_zodiac.py +++ b/bot/exts/valentines/valentine_zodiac.py @@ -43,7 +43,7 @@ class ValentineZodiac(commands.Cog): embed = discord.Embed() embed.color = Colours.pink error_comp = "\n".join( - [f"`{i}` {zod_name}" for i, zod_name in enumerate(self.zodiac_fact.keys(), start=1)] + f"`{i}` {zod_name}" for i, zod_name in enumerate(self.zodiac_fact.keys(), start=1) ) embed.description = ( f"**{zodiac}** is not a valid zodiac sign, here is the list of valid zodiac signs.\n" -- cgit v1.2.3 From 87d30073e42750f143239f47ed4a125fb6e7486a Mon Sep 17 00:00:00 2001 From: Anubhav1603 Date: Mon, 28 Sep 2020 11:45:57 +0530 Subject: changed date -> datetime and added aliases partner --- bot/exts/valentines/valentine_zodiac.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/bot/exts/valentines/valentine_zodiac.py b/bot/exts/valentines/valentine_zodiac.py index 6e6ad2f6..a495cbe1 100644 --- a/bot/exts/valentines/valentine_zodiac.py +++ b/bot/exts/valentines/valentine_zodiac.py @@ -2,7 +2,7 @@ import calendar import json import logging import random -from datetime import date +from datetime import datetime from pathlib import Path from typing import Tuple, Union @@ -32,8 +32,8 @@ class ValentineZodiac(commands.Cog): with explanation_file.open(encoding="utf8") as json_data: zodiac_fact = json.load(json_data) for zodiac_data in zodiac_fact.values(): - zodiac_data['start_at'] = date.fromisoformat(zodiac_data['start_at']) - zodiac_data['end_at'] = date.fromisoformat(zodiac_data['end_at']) + zodiac_data['start_at'] = datetime.fromisoformat(zodiac_data['start_at']) + zodiac_data['end_at'] = datetime.fromisoformat(zodiac_data['end_at']) with compatibility_file.open(encoding="utf8") as json_data: zodiacs = json.load(json_data) return zodiacs, zodiac_fact @@ -71,10 +71,10 @@ class ValentineZodiac(commands.Cog): log.info("Zodiac embed ready.") return embed - def zodiac_date_verifier(self, query_datetime: date) -> str: + def zodiac_date_verifier(self, query_datetime: datetime) -> str: """Returns zodiac sign by checking month and date.""" for zodiac_name, zodiac_data in self.zodiac_fact.items(): - if zodiac_data["start_at"] <= query_datetime <= zodiac_data["end_at"]: + if zodiac_data["start_at"].date() <= query_datetime.date() <= zodiac_data["end_at"].date(): log.info("Zodiac name sent.") return zodiac_name @@ -86,7 +86,7 @@ class ValentineZodiac(commands.Cog): log.info("Embed successfully sent.") @zodiac.command(name="date") - async def date_and_month(self, ctx: commands.Context, query_date: int, month: Union[int, str]) -> None: + async def date_and_month(self, ctx: commands.Context, date: int, month: Union[int, str]) -> None: """Provides information about zodiac sign by taking month and date as input.""" if isinstance(month, str): month = month.capitalize() @@ -95,12 +95,12 @@ class ValentineZodiac(commands.Cog): except ValueError: await ctx.send(f"Sorry, but `{month}` is not a valid month name.") return - if (month == 1 and (1 <= query_date <= 19)) or (month == 12 and (22 <= query_date <= 31)): + if (month == 1 and (1 <= date <= 19)) or (month == 12 and (22 <= date <= 31)): zodiac = "capricorn" final_embed = self.zodiac_build_embed(zodiac) else: try: - zodiac_sign_based_on_month_and_date = self.zodiac_date_verifier(date(2020, month, query_date)) + zodiac_sign_based_on_month_and_date = self.zodiac_date_verifier(datetime(2020, month, date)) log.info("zodiac sign based on month and date received.") except ValueError as e: final_embed = discord.Embed() @@ -113,7 +113,7 @@ class ValentineZodiac(commands.Cog): await ctx.send(embed=final_embed) log.info("Zodiac sign embed based on month and date is now sent.") - @zodiac.command(name="partnerzodiac") + @zodiac.command(name="partnerzodiac", aliases=['partner']) async def partner_zodiac(self, ctx: commands.Context, zodiac_sign: str) -> None: """Provides a counter compatible zodiac sign to the given user's zodiac sign.""" embed = discord.Embed() -- cgit v1.2.3 From d9be29e006d9b381b1563b344a2c212574ce62ae Mon Sep 17 00:00:00 2001 From: Anubhav <57266248+Anubhav1603@users.noreply.github.com> Date: Mon, 28 Sep 2020 13:31:22 +0530 Subject: Update bot/exts/valentines/valentine_zodiac.py Co-authored-by: Thomas Petersson <61778143+thomaspet@users.noreply.github.com> --- bot/exts/valentines/valentine_zodiac.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bot/exts/valentines/valentine_zodiac.py b/bot/exts/valentines/valentine_zodiac.py index a495cbe1..1874856a 100644 --- a/bot/exts/valentines/valentine_zodiac.py +++ b/bot/exts/valentines/valentine_zodiac.py @@ -111,7 +111,7 @@ class ValentineZodiac(commands.Cog): final_embed = self.zodiac_build_embed(zodiac_sign_based_on_month_and_date) await ctx.send(embed=final_embed) - log.info("Zodiac sign embed based on month and date is now sent.") + log.info("Zodiac sign embed based on date is now sent.") @zodiac.command(name="partnerzodiac", aliases=['partner']) async def partner_zodiac(self, ctx: commands.Context, zodiac_sign: str) -> None: -- cgit v1.2.3 From bf981acadeaf19bf1845f3b7969de5a23d4098e5 Mon Sep 17 00:00:00 2001 From: Anubhav <57266248+Anubhav1603@users.noreply.github.com> Date: Mon, 28 Sep 2020 13:34:26 +0530 Subject: Update bot/exts/valentines/valentine_zodiac.py Co-authored-by: Thomas Petersson <61778143+thomaspet@users.noreply.github.com> --- bot/exts/valentines/valentine_zodiac.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bot/exts/valentines/valentine_zodiac.py b/bot/exts/valentines/valentine_zodiac.py index 1874856a..e56fbebd 100644 --- a/bot/exts/valentines/valentine_zodiac.py +++ b/bot/exts/valentines/valentine_zodiac.py @@ -106,7 +106,7 @@ class ValentineZodiac(commands.Cog): final_embed = discord.Embed() final_embed.color = Colours.pink final_embed.description = f"Zodiac sign is not found because, {e}" - log.info(f"error caused due to: {e}.") + log.info(f"Error in "zodiac date" command:\n{e}.") else: final_embed = self.zodiac_build_embed(zodiac_sign_based_on_month_and_date) -- cgit v1.2.3 From c661081c09faf6d2628a55c051e15910d0384e96 Mon Sep 17 00:00:00 2001 From: Anubhav1603 Date: Tue, 29 Sep 2020 11:28:35 +0530 Subject: solved the invalid syntax issue --- bot/exts/valentines/valentine_zodiac.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bot/exts/valentines/valentine_zodiac.py b/bot/exts/valentines/valentine_zodiac.py index e56fbebd..55e9085d 100644 --- a/bot/exts/valentines/valentine_zodiac.py +++ b/bot/exts/valentines/valentine_zodiac.py @@ -106,7 +106,7 @@ class ValentineZodiac(commands.Cog): final_embed = discord.Embed() final_embed.color = Colours.pink final_embed.description = f"Zodiac sign is not found because, {e}" - log.info(f"Error in "zodiac date" command:\n{e}.") + log.info(f'Error in "zodiac date" command:\n{e}.') else: final_embed = self.zodiac_build_embed(zodiac_sign_based_on_month_and_date) -- cgit v1.2.3 From 242fb70a3c76db5593cf596a3d7a234792b134f9 Mon Sep 17 00:00:00 2001 From: Anubhav1603 Date: Tue, 29 Sep 2020 11:44:24 +0530 Subject: changed errore method to genrate_error method,changed error embed colour to red and minor tweaks --- bot/exts/valentines/valentine_zodiac.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/bot/exts/valentines/valentine_zodiac.py b/bot/exts/valentines/valentine_zodiac.py index 55e9085d..9da49447 100644 --- a/bot/exts/valentines/valentine_zodiac.py +++ b/bot/exts/valentines/valentine_zodiac.py @@ -38,10 +38,10 @@ class ValentineZodiac(commands.Cog): zodiacs = json.load(json_data) return zodiacs, zodiac_fact - def error(self, zodiac: str) -> discord.Embed: + def generate_invalidname_embed(self, zodiac: str) -> discord.Embed: """Returns error embed.""" embed = discord.Embed() - embed.color = Colours.pink + embed.color = Colours.soft_red error_comp = "\n".join( f"`{i}` {zod_name}" for i, zod_name in enumerate(self.zodiac_fact.keys(), start=1) ) @@ -67,7 +67,7 @@ class ValentineZodiac(commands.Cog): embed.add_field(name='__Weaknesses__', value=self.zodiac_fact[zodiac]["Weaknesses"], inline=False) embed.set_thumbnail(url=self.zodiac_fact[zodiac]["url"]) else: - embed = self.error(zodiac) + embed = self.generate_invalidname_embed(zodiac) log.info("Zodiac embed ready.") return embed @@ -95,12 +95,12 @@ class ValentineZodiac(commands.Cog): except ValueError: await ctx.send(f"Sorry, but `{month}` is not a valid month name.") return - if (month == 1 and (1 <= date <= 19)) or (month == 12 and (22 <= date <= 31)): + if (month == 1 and 1 <= date <= 19) or (month == 12 and 22 <= date <= 31): zodiac = "capricorn" final_embed = self.zodiac_build_embed(zodiac) else: try: - zodiac_sign_based_on_month_and_date = self.zodiac_date_verifier(datetime(2020, month, date)) + zodiac_sign_based_on_date = self.zodiac_date_verifier(datetime(2020, month, date)) log.info("zodiac sign based on month and date received.") except ValueError as e: final_embed = discord.Embed() @@ -108,7 +108,7 @@ class ValentineZodiac(commands.Cog): final_embed.description = f"Zodiac sign is not found because, {e}" log.info(f'Error in "zodiac date" command:\n{e}.') else: - final_embed = self.zodiac_build_embed(zodiac_sign_based_on_month_and_date) + final_embed = self.zodiac_build_embed(zodiac_sign_based_on_date) await ctx.send(embed=final_embed) log.info("Zodiac sign embed based on date is now sent.") @@ -132,7 +132,7 @@ class ValentineZodiac(commands.Cog): value=compatible_zodiac['description'] ) except KeyError: - embed = self.error(zodiac_sign) + embed = self.generate_invalidname_embed(zodiac_sign) await ctx.send(embed=embed) -- cgit v1.2.3 From 10aa93109dfe2550f89d86e89cf3b35fa2371f92 Mon Sep 17 00:00:00 2001 From: Anubhav1603 Date: Tue, 29 Sep 2020 13:43:38 +0530 Subject: changed pink colour embed to soft_red --- bot/exts/valentines/valentine_zodiac.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bot/exts/valentines/valentine_zodiac.py b/bot/exts/valentines/valentine_zodiac.py index 9da49447..58b6c8d3 100644 --- a/bot/exts/valentines/valentine_zodiac.py +++ b/bot/exts/valentines/valentine_zodiac.py @@ -104,7 +104,7 @@ class ValentineZodiac(commands.Cog): log.info("zodiac sign based on month and date received.") except ValueError as e: final_embed = discord.Embed() - final_embed.color = Colours.pink + final_embed.color = Colours.soft_red final_embed.description = f"Zodiac sign is not found because, {e}" log.info(f'Error in "zodiac date" command:\n{e}.') else: -- cgit v1.2.3 From b4fba778deb7c6832dc75e856600e9367c47dd8d Mon Sep 17 00:00:00 2001 From: Anubhav <57266248+Anubhav1603@users.noreply.github.com> Date: Tue, 29 Sep 2020 14:18:53 +0530 Subject: cleaned code Co-authored-by: Thomas Petersson <61778143+thomaspet@users.noreply.github.com> --- bot/exts/valentines/valentine_zodiac.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bot/exts/valentines/valentine_zodiac.py b/bot/exts/valentines/valentine_zodiac.py index 58b6c8d3..f48acde4 100644 --- a/bot/exts/valentines/valentine_zodiac.py +++ b/bot/exts/valentines/valentine_zodiac.py @@ -34,8 +34,10 @@ class ValentineZodiac(commands.Cog): for zodiac_data in zodiac_fact.values(): zodiac_data['start_at'] = datetime.fromisoformat(zodiac_data['start_at']) zodiac_data['end_at'] = datetime.fromisoformat(zodiac_data['end_at']) + with compatibility_file.open(encoding="utf8") as json_data: zodiacs = json.load(json_data) + return zodiacs, zodiac_fact def generate_invalidname_embed(self, zodiac: str) -> discord.Embed: -- cgit v1.2.3 From e34e3eb2667be82c7a69ced10684b0e0d02357b8 Mon Sep 17 00:00:00 2001 From: Anubhav1603 Date: Thu, 1 Oct 2020 10:33:50 +0530 Subject: adjusted logging level,corrected grammer and small bugfix --- bot/exts/valentines/valentine_zodiac.py | 46 +++++++++++----------- bot/resources/valentines/zodiac_compatibility.json | 24 +++++------ 2 files changed, 35 insertions(+), 35 deletions(-) diff --git a/bot/exts/valentines/valentine_zodiac.py b/bot/exts/valentines/valentine_zodiac.py index 58b6c8d3..044951b4 100644 --- a/bot/exts/valentines/valentine_zodiac.py +++ b/bot/exts/valentines/valentine_zodiac.py @@ -68,14 +68,14 @@ class ValentineZodiac(commands.Cog): embed.set_thumbnail(url=self.zodiac_fact[zodiac]["url"]) else: embed = self.generate_invalidname_embed(zodiac) - log.info("Zodiac embed ready.") + log.trace("Successfully created zodiac information embed.") return embed - def zodiac_date_verifier(self, query_datetime: datetime) -> str: + def zodiac_date_verifier(self, date: datetime) -> str: """Returns zodiac sign by checking month and date.""" for zodiac_name, zodiac_data in self.zodiac_fact.items(): - if zodiac_data["start_at"].date() <= query_datetime.date() <= zodiac_data["end_at"].date(): - log.info("Zodiac name sent.") + if zodiac_data["start_at"].date() <= date.date() <= zodiac_data["end_at"].date(): + log.trace("Zodiac name sent.") return zodiac_name @commands.group(name='zodiac', invoke_without_command=True) @@ -83,7 +83,7 @@ class ValentineZodiac(commands.Cog): """Provides information about zodiac sign by taking zodiac sign name as input.""" final_embed = self.zodiac_build_embed(zodiac_sign) await ctx.send(embed=final_embed) - log.info("Embed successfully sent.") + log.trace("Embed successfully sent.") @zodiac.command(name="date") async def date_and_month(self, ctx: commands.Context, date: int, month: Union[int, str]) -> None: @@ -92,7 +92,9 @@ class ValentineZodiac(commands.Cog): month = month.capitalize() try: month = list(calendar.month_abbr).index(month[:3]) + log.info('Valid month name entered by user') except ValueError: + log.info('Invalid month name entered by user') await ctx.send(f"Sorry, but `{month}` is not a valid month name.") return if (month == 1 and 1 <= date <= 19) or (month == 12 and 22 <= date <= 31): @@ -105,35 +107,33 @@ class ValentineZodiac(commands.Cog): except ValueError as e: final_embed = discord.Embed() final_embed.color = Colours.soft_red - final_embed.description = f"Zodiac sign is not found because, {e}" + final_embed.description = f"Zodiac sign could not be found because.\n`{e}`" log.info(f'Error in "zodiac date" command:\n{e}.') else: final_embed = self.zodiac_build_embed(zodiac_sign_based_on_date) await ctx.send(embed=final_embed) - log.info("Zodiac sign embed based on date is now sent.") + log.trace("Embed from date successfully sent.") @zodiac.command(name="partnerzodiac", aliases=['partner']) async def partner_zodiac(self, ctx: commands.Context, zodiac_sign: str) -> None: - """Provides a counter compatible zodiac sign to the given user's zodiac sign.""" + """Provides a random counter compatible zodiac sign to the given user's zodiac sign.""" embed = discord.Embed() embed.color = Colours.pink - try: - compatible_zodiac = random.choice(self.zodiacs[zodiac_sign.lower()]) - emoji1 = random.choice(HEART_EMOJIS) - emoji2 = random.choice(HEART_EMOJIS) - embed.title = "Zodiac Compatibility" - embed.description = ( - f'{zodiac_sign.capitalize()}{emoji1}{compatible_zodiac["Zodiac"]}\n' - f'{emoji2}Compatibility meter : {compatible_zodiac["compatibility_score"]}{emoji2}' - ) - embed.add_field( - name=f'A letter from Dr.Zodiac {LETTER_EMOJI}', - value=compatible_zodiac['description'] - ) - except KeyError: - embed = self.generate_invalidname_embed(zodiac_sign) + compatible_zodiac = random.choice(self.zodiacs[zodiac_sign.capitalize()]) + emoji1 = random.choice(HEART_EMOJIS) + emoji2 = random.choice(HEART_EMOJIS) + embed.title = "Zodiac Compatibility" + embed.description = ( + f'{zodiac_sign.capitalize()}{emoji1}{compatible_zodiac["Zodiac"]}\n' + f'{emoji2}Compatibility meter : {compatible_zodiac["compatibility_score"]}{emoji2}' + ) + embed.add_field( + name=f'A letter from Dr.Zodiac {LETTER_EMOJI}', + value=compatible_zodiac['description'] + ) await ctx.send(embed=embed) + log.trace("Embed from date successfully sent.") def setup(bot: commands.Bot) -> None: diff --git a/bot/resources/valentines/zodiac_compatibility.json b/bot/resources/valentines/zodiac_compatibility.json index 3971d40d..ea9a7b37 100644 --- a/bot/resources/valentines/zodiac_compatibility.json +++ b/bot/resources/valentines/zodiac_compatibility.json @@ -1,5 +1,5 @@ { - "aries":[ + "Aries":[ { "Zodiac" : "Sagittarius", "description" : "The Archer is one of the most compatible signs Aries should consider when searching out relationships that will bear fruit. Sagittarians share a certain love of freedom with Aries that will help the two of them conquer new territory together.", @@ -21,7 +21,7 @@ "compatibility_score" : "74%" } ], - "taurus":[ + "Taurus":[ { "Zodiac" : "Virgo", "description" : "Although these signs have their set of differences, the Virgo Taurus compatibility is usually pretty strong. This is because both the signs want the same thing ultimately and have generally synchronous ways of reaching those points. This helps them complement each other and create a healthy relationship between them.", @@ -43,7 +43,7 @@ "compatibility_score" : "91%" } ], - "gemini":[ + "Gemini":[ { "Zodiac" : "Aries", "description" : "The theorem of astrology says that Aries and Gemini have a zero tolerance for boredom and will at once get rid of anything dull. An Arian will let a Geminian enjoy his personal freedom and the Gemini will respect his individuality.", @@ -65,7 +65,7 @@ "compatibility_score" : "91%" } ], - "cancer":[ + "Cancer":[ { "Zodiac" : "Taurus", "description" : "The Cancer Taurus zodiac relationship compatibility is strong because of their mutual love for safety, stability, and comfort. Their mutual understanding will always be powerful, which will be the pillar of strength of their relationship.", @@ -82,7 +82,7 @@ "compatibility_score" : "77%" } ], - "leo":[ + "Leo":[ { "Zodiac" : "Aries", "description" : "A Leo is generous and an Arian is open to life. Sharing the same likes and dislikes, they both crave for fun, romance and excitement. A Leo respects an Arian's need for freedom because an Arian does not interfere much in the life of a Leo. Aries will love the charisma and ideas of the Leo.", @@ -104,7 +104,7 @@ "compatibility_score" : "75%" } ], - "virgo":[ + "Virgo":[ { "Zodiac" : "Taurus", "description" : "Although these signs have their set of differences, the Virgo Taurus compatibility is usually pretty strong. This is because both the signs want the same thing ultimately and have generally synchronous ways of reaching those points. This helps them complement each other and create a healthy relationship between them.", @@ -126,7 +126,7 @@ "compatibility_score" : "77%" } ], - "libra":[ + "Libra":[ { "Zodiac" : "Leo", "description" : "Libra and Leo love match can work well for both the partners and truly help them learn from each other and grow individually, as well as together. Libra and Leo, when in the right frame of mind, form a formidable couple that attracts admiration and respect everywhere it goes.", @@ -148,7 +148,7 @@ "compatibility_score" : "71%" } ], - "scorpio":[ + "Scorpio":[ { "Zodiac" : "Cancer", "description" : "This union is not unusual, but will take a fair share of work in the start. A strong foundation of clear cut communication is mandatory to make this a loving and stress free relationship!", @@ -170,7 +170,7 @@ "compatibility_score" : "81%" } ], - "sagittarius":[ + "Sagittarius":[ { "Zodiac" : "Aries", "description" : "Sagittarius and Aries can make a very compatible pair. Their relationship will have a lot of passion, enthusiasm, and energy. These are very good traits to make their relationship deeper and stronger. Both Aries and Sagittarius will enjoy each other's company and their energy level rises as the relationship grows. Both will support and help in fighting hardships and failures.", @@ -192,7 +192,7 @@ "compatibility_score" : "83%" } ], - "capricorn":[ + "Capricorn":[ { "Zodiac" : "Taurus", "description" : "This is one of the most grounded and reliable bonds of the zodiac chart. If Capricorn and Taurus do find a way to handle their minor issues, they have a good chance of making it together and that too, in a happy, peaceful, and healthy relationship.", @@ -214,7 +214,7 @@ "compatibility_score" : "76%" } ], - "aquarius":[ + "Aquarius":[ { "Zodiac" : "Aries", "description" : "The relationship of Aries and Aquarius is very exciting, adventurous and interesting. They will enjoy each other's company as both of them love fun and freedom.This is a couple that lacks tenderness. They are not two brutes who let their relationship fade as soon as their passion does.", @@ -236,7 +236,7 @@ "compatibility_score" : "83%" } ], - "pisces":[ + "Pisces":[ { "Zodiac" : "Taurus", "description" : "This relationship will survive the test of time if both parties involved have unbreakable trust in each other and nurture that connection they have painstakingly built over the years. They must remember to be honest and committed to their partner through all times.If natural communication flows between them like clockwork, this will be a beautiful love story with a prominent tag of ‘happily-ever-after’ pinned right to it!", -- cgit v1.2.3 From 345ceba65872eab79bc28f34ef805cca91ce4cae Mon Sep 17 00:00:00 2001 From: Anubhav1603 Date: Thu, 1 Oct 2020 13:47:14 +0530 Subject: changed trace to info in except block --- bot/exts/valentines/valentine_zodiac.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bot/exts/valentines/valentine_zodiac.py b/bot/exts/valentines/valentine_zodiac.py index 19cb10fc..433947a1 100644 --- a/bot/exts/valentines/valentine_zodiac.py +++ b/bot/exts/valentines/valentine_zodiac.py @@ -94,7 +94,7 @@ class ValentineZodiac(commands.Cog): month = month.capitalize() try: month = list(calendar.month_abbr).index(month[:3]) - log.info('Valid month name entered by user') + log.trace('Valid month name entered by user') except ValueError: log.info('Invalid month name entered by user') await ctx.send(f"Sorry, but `{month}` is not a valid month name.") @@ -105,7 +105,7 @@ class ValentineZodiac(commands.Cog): else: try: zodiac_sign_based_on_date = self.zodiac_date_verifier(datetime(2020, month, date)) - log.info("zodiac sign based on month and date received.") + log.trace("zodiac sign based on month and date received.") except ValueError as e: final_embed = discord.Embed() final_embed.color = Colours.soft_red -- cgit v1.2.3 From d446cee6614ee333a65e671109012648a3e56628 Mon Sep 17 00:00:00 2001 From: Anubhav1603 Date: Thu, 1 Oct 2020 13:50:37 +0530 Subject: changed ` to codeblock --- bot/exts/valentines/valentine_zodiac.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bot/exts/valentines/valentine_zodiac.py b/bot/exts/valentines/valentine_zodiac.py index 433947a1..0925bf06 100644 --- a/bot/exts/valentines/valentine_zodiac.py +++ b/bot/exts/valentines/valentine_zodiac.py @@ -109,7 +109,7 @@ class ValentineZodiac(commands.Cog): except ValueError as e: final_embed = discord.Embed() final_embed.color = Colours.soft_red - final_embed.description = f"Zodiac sign could not be found because.\n`{e}`" + final_embed.description = f"Zodiac sign could not be found because.\n```{e}```" log.info(f'Error in "zodiac date" command:\n{e}.') else: final_embed = self.zodiac_build_embed(zodiac_sign_based_on_date) -- cgit v1.2.3 From ca463a739fd132489f44ed96fb8a8ffdde6e547e Mon Sep 17 00:00:00 2001 From: Anubhav1603 Date: Thu, 1 Oct 2020 13:53:51 +0530 Subject: corrected doc string and changed date to query_date --- bot/exts/valentines/valentine_zodiac.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bot/exts/valentines/valentine_zodiac.py b/bot/exts/valentines/valentine_zodiac.py index 0925bf06..67f57f94 100644 --- a/bot/exts/valentines/valentine_zodiac.py +++ b/bot/exts/valentines/valentine_zodiac.py @@ -73,10 +73,10 @@ class ValentineZodiac(commands.Cog): log.trace("Successfully created zodiac information embed.") return embed - def zodiac_date_verifier(self, date: datetime) -> str: - """Returns zodiac sign by checking month and date.""" + def zodiac_date_verifier(self, query_date: datetime) -> str: + """Returns zodiac sign by checking date.""" for zodiac_name, zodiac_data in self.zodiac_fact.items(): - if zodiac_data["start_at"].date() <= date.date() <= zodiac_data["end_at"].date(): + if zodiac_data["start_at"].date() <= query_date.date() <= zodiac_data["end_at"].date(): log.trace("Zodiac name sent.") return zodiac_name -- cgit v1.2.3 From a2943dac69237a754b7efc4e972462dbc969dc15 Mon Sep 17 00:00:00 2001 From: Anubhav1603 Date: Thu, 1 Oct 2020 14:17:49 +0530 Subject: added check for partnerzodiac to validate --- bot/exts/valentines/valentine_zodiac.py | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/bot/exts/valentines/valentine_zodiac.py b/bot/exts/valentines/valentine_zodiac.py index 67f57f94..3f1a6337 100644 --- a/bot/exts/valentines/valentine_zodiac.py +++ b/bot/exts/valentines/valentine_zodiac.py @@ -122,18 +122,22 @@ class ValentineZodiac(commands.Cog): """Provides a random counter compatible zodiac sign to the given user's zodiac sign.""" embed = discord.Embed() embed.color = Colours.pink - compatible_zodiac = random.choice(self.zodiacs[zodiac_sign.capitalize()]) - emoji1 = random.choice(HEART_EMOJIS) - emoji2 = random.choice(HEART_EMOJIS) - embed.title = "Zodiac Compatibility" - embed.description = ( - f'{zodiac_sign.capitalize()}{emoji1}{compatible_zodiac["Zodiac"]}\n' - f'{emoji2}Compatibility meter : {compatible_zodiac["compatibility_score"]}{emoji2}' - ) - embed.add_field( - name=f'A letter from Dr.Zodiac {LETTER_EMOJI}', - value=compatible_zodiac['description'] - ) + zodiac_check = self.zodiacs.get(zodiac_sign.capitalize()) + if zodiac_check: + compatible_zodiac = random.choice(self.zodiacs[zodiac_sign.capitalize()]) + emoji1 = random.choice(HEART_EMOJIS) + emoji2 = random.choice(HEART_EMOJIS) + embed.title = "Zodiac Compatibility" + embed.description = ( + f'{zodiac_sign.capitalize()}{emoji1}{compatible_zodiac["Zodiac"]}\n' + f'{emoji2}Compatibility meter : {compatible_zodiac["compatibility_score"]}{emoji2}' + ) + embed.add_field( + name=f'A letter from Dr.Zodiac {LETTER_EMOJI}', + value=compatible_zodiac['description'] + ) + else: + embed = self.generate_invalidname_embed(zodiac_sign) await ctx.send(embed=embed) log.trace("Embed from date successfully sent.") -- cgit v1.2.3 From 5418dd70fd3a75ff161970b5abd2c4b39f9275b7 Mon Sep 17 00:00:00 2001 From: Anubhav1603 Date: Thu, 1 Oct 2020 14:28:04 +0530 Subject: removed \n and added , --- bot/resources/valentines/zodiac_explanation.json | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/bot/resources/valentines/zodiac_explanation.json b/bot/resources/valentines/zodiac_explanation.json index 786392a3..9bb1d99d 100644 --- a/bot/resources/valentines/zodiac_explanation.json +++ b/bot/resources/valentines/zodiac_explanation.json @@ -6,7 +6,7 @@ "Motto": "***\u201cWhen you know yourself, you're empowered. When you accept yourself, you're invincible.\u201d***", "Strengths": "courageous, determined, confident, enthusiastic, optimistic, honest, passionate.", "Weaknesses": "impatient, moody, short-tempered, impulsive, aggressive.", - "full_form": "__**A**__ssertive\n__**R**__efreshing\n__**I**__ndependent\n__**E**__nergetic\n__**S**__exy", + "full_form": "__**A**__ssertive, __**R**__efreshing, __**I**__ndependent, __**E**__nergetic, __**S**__exy", "url": "https://www.horoscope.com/images-US/signs/profile-aries.png" }, "Taurus": { @@ -16,7 +16,7 @@ "Motto": "***\u201cNothing worth having comes easy.\u201d***", "Strengths": "reliable, patient, practical, devoted, responsible, stable.", "Weaknesses": "stubborn, possessive, uncompromising.", - "full_form": "__**T**__railblazing\n__**A**__mbitious\n__**U**__nwavering\n__**R**__eliable\n__**U**__nderstanding\n__**S**__table", + "full_form": "__**T**__railblazing, __**A**__mbitious, __**U**__nwavering, __**R**__eliable, __**U**__nderstanding, __**S**__table", "url": "https://www.horoscope.com/images-US/signs/profile-taurus.png" }, "Gemini": { @@ -26,7 +26,7 @@ "Motto": "***\u201cI manifest my reality.\u201d***", "Strengths": "gentle, affectionate, curious, adaptable, ability to learn quickly and exchange ideas.", "Weaknesses": "nervous, inconsistent, indecisive.", - "full_form": "__**G**__enerous\n__**E**__motionally in tune\n__**M**__otivated\n__**I**__maginative\n__**N**__ice\n__**I**__ntelligent", + "full_form": "__**G**__enerous, __**E**__motionally in tune, __**M**__otivated, __**I**__maginative, __**N**__ice, __**I**__ntelligent", "url": "https://www.horoscope.com/images-US/signs/profile-gemini.png" }, "Cancer": { @@ -36,7 +36,7 @@ "Motto": "***\u201cI feel, therefore I am.\u201d***", "Strengths": "tenacious, highly imaginative, loyal, emotional, sympathetic, persuasive.", "Weaknesses": "moody, pessimistic, suspicious, manipulative, insecuremoody, pessimistic, suspicious, manipulative, insecure.", - "full_form": "__**C**__aring\n__**A**__mbitious\n__**N**__ourishing\n__**C**__reative\n__**E**__motionally intelligent\n__**R**__esilient", + "full_form": "__**C**__aring, __**A**__mbitious, __**N**__ourishing, __**C**__reative, __**E**__motionally intelligent, __**R**__esilient", "url": "https://www.horoscope.com/images-US/signs/profile-cancer.png" }, "Leo": { @@ -46,7 +46,7 @@ "Motto": "***\u201cIf you know the way, go the way and show the way\u2014you're a leader.\u201d***", "Strengths": "creative, passionate, generous, warm-hearted, cheerful, humorous.", "Weaknesses": "arrogant, stubborn, self-centered, lazy, inflexible.", - "full_form": "__**L**__eaders\n__**E**__nergetic\n__**O**__ptimistic", + "full_form": "__**L**__eaders, __**E**__nergetic, __**O**__ptimistic", "url": "https://www.horoscope.com/images-US/signs/profile-leo.png" }, "Virgo": { @@ -56,7 +56,7 @@ "Motto": "***\u201cMy best can always be better.\u201d***", "Strengths": "loyal, analytical, kind, hardworking, practical.", "Weaknesses": "shyness, worry, overly critical of self and others, all work and no play.", - "full_form": "__**V**__irtuous\n__**I**__ntelligent\n__**R**__esponsible\n__**G**__enerous\n__**O**__ptimistic", + "full_form": "__**V**__irtuous, __**I**__ntelligent, __**R**__esponsible, __**G**__enerous, __**O**__ptimistic", "url": "https://www.horoscope.com/images-US/signs/profile-virgo.png" }, "Libra": { @@ -66,7 +66,7 @@ "Motto": "***\u201cNo person is an island.\u201d***", "Strengths": "cooperative, diplomatic, gracious, fair-minded, social.", "Weaknesses": "indecisive, avoids confrontations, will carry a grudge, self-pity.", - "full_form": "__**L**__oyal\n__**I**__nquisitive\n__**B**__alanced\n__**R**__esponsible\n__**A**__ltruistic", + "full_form": "__**L**__oyal, __**I**__nquisitive, __**B**__alanced, __**R**__esponsible, __**A**__ltruistic", "url": "https://www.horoscope.com/images-US/signs/profile-libra.png" }, "Scorpio": { @@ -76,7 +76,7 @@ "Motto": "***\u201cYou never know what you are capable of until you try.\u201d***", "Strengths": "resourceful, brave, passionate, stubborn, a true friend.", "Weaknesses": "distrusting, jealous, secretive, violent.", - "full_form": "__**S**__eductive\n__**C**__erebral\n__**O**__riginal\n__**R**__eactive\n__**P**__assionate\n__**I**__ntuitive\n__**O**__utstanding", + "full_form": "__**S**__eductive, __**C**__erebral, __**O**__riginal, __**R**__eactive, __**P**__assionate, __**I**__ntuitive, __**O**__utstanding", "url": "https://www.horoscope.com/images-US/signs/profile-scorpio.png" }, "Sagittarius": { @@ -86,7 +86,7 @@ "Motto": "***\u201cTowering genius disdains a beaten path.\u201d***", "Strengths": "generous, idealistic, great sense of humor.", "Weaknesses": "promises more than can deliver, very impatient, will say anything no matter how undiplomatic.", - "full_form": "__**S**__eductive\n__**A**__dventurous\n__**G**__rateful\n__**I**__ntelligent\n__**T**__railblazing\n__**T**__enacious adept\n__**A**__dept\n__**R**__esponsible\n__**I**__dealistic\n__**U**__nparalled\n__**S**__ophisticated", + "full_form": "__**S**__eductive, __**A**__dventurous, __**G**__rateful, __**I**__ntelligent, __**T**__railblazing, __**T**__enacious adept, __**A**__dept, __**R**__esponsible, __**I**__dealistic, __**U**__nparalled, __**S**__ophisticated", "url": "https://www.horoscope.com/images-US/signs/profile-sagittarius.png" }, "Capricorn": { @@ -96,7 +96,7 @@ "Motto": "***\u201cI can succeed at anything I put my mind to.\u201d***", "Strengths": "responsible, disciplined, self-control, good managers.", "Weaknesses": "know-it-all, unforgiving, condescending, expecting the worst.", - "full_form": "__**C**__onfident\n__**A**__nalytical\n__**P**__ractical\n__**R**__esponsible\n__**I**__ntelligent\n__**C**__aring\n__**O**__rganized\n__**R**__ealistic\n__**N**__eat", + "full_form": "__**C**__onfident, __**A**__nalytical, __**P**__ractical, __**R**__esponsible, __**I**__ntelligent, __**C**__aring, __**O**__rganized, __**R**__ealistic, __**N**__eat", "url": "https://www.horoscope.com/images-US/signs/profile-capricorn.png" }, "Aquarius": { @@ -106,7 +106,7 @@ "Motto": "***\u201cThere is no me, there is only we.\u201d***", "Strengths": "Progressive, original, independent, humanitarian.", "Weaknesses": "Runs from emotional expression, temperamental, uncompromising, aloof.", - "full_form": "__**A**__nalytical\n__**Q**__uirky\n__**U**__ncompromising\n__**A**__ction-focused\n__**R**__espectful\n__**I**__ntelligent\n__**U**__nique\n__**S**__incere", + "full_form": "__**A**__nalytical, __**Q**__uirky, __**U**__ncompromising, __**A**__ction-focused, __**R**__espectful, __**I**__ntelligent, __**U**__nique, __**S**__incere", "url": "https://www.horoscope.com/images-US/signs/profile-aquarius.png" }, "Pisces": { @@ -116,7 +116,7 @@ "Motto": "***\u201cI have a lot of love to give, it only takes a little patience and those worth giving it all to.\u201d***", "Strengths": "Compassionate, artistic, intuitive, gentle, wise, musical.", "Weaknesses": "Fearful, overly trusting, sad, desire to escape reality, can be a victim or a martyr.", - "full_form": "__**P**__sychic\n__**I**__ntelligent\n__**S**__urprising\n__**C**__reative\n__**E**__motionally-driven\n__**S**__ensitive", + "full_form": "__**P**__sychic, __**I**__ntelligent, __**S**__urprising, __**C**__reative, __**E**__motionally-driven, __**S**__ensitive", "url": "https://www.horoscope.com/images-US/signs/profile-pisces.png" } } -- cgit v1.2.3 From 2224f08b88be2681faaba55ca56cac418a5a219c Mon Sep 17 00:00:00 2001 From: Anubhav1603 Date: Thu, 1 Oct 2020 15:04:12 +0530 Subject: rearranged order of embed --- bot/exts/valentines/valentine_zodiac.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bot/exts/valentines/valentine_zodiac.py b/bot/exts/valentines/valentine_zodiac.py index 3f1a6337..56831060 100644 --- a/bot/exts/valentines/valentine_zodiac.py +++ b/bot/exts/valentines/valentine_zodiac.py @@ -63,10 +63,10 @@ class ValentineZodiac(commands.Cog): log.info("Making zodiac embed.") embed.title = f"__{zodiac}__" embed.description = self.zodiac_fact[zodiac]["About"] - embed.add_field(name='__Full form__', value=self.zodiac_fact[zodiac]["full_form"], inline=False) embed.add_field(name='__Motto__', value=self.zodiac_fact[zodiac]["Motto"], inline=False) embed.add_field(name='__Strengths__', value=self.zodiac_fact[zodiac]["Strengths"], inline=False) embed.add_field(name='__Weaknesses__', value=self.zodiac_fact[zodiac]["Weaknesses"], inline=False) + embed.add_field(name='__Full form__', value=self.zodiac_fact[zodiac]["full_form"], inline=False) embed.set_thumbnail(url=self.zodiac_fact[zodiac]["url"]) else: embed = self.generate_invalidname_embed(zodiac) -- cgit v1.2.3 From ea554e53f6218d70ea932c7445edd7a3e442a977 Mon Sep 17 00:00:00 2001 From: Anubhav1603 Date: Thu, 1 Oct 2020 15:08:49 +0530 Subject: capitalised first letter from weaknesses and strengths --- bot/resources/valentines/zodiac_explanation.json | 40 ++++++++++++------------ 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/bot/resources/valentines/zodiac_explanation.json b/bot/resources/valentines/zodiac_explanation.json index 9bb1d99d..33864ea5 100644 --- a/bot/resources/valentines/zodiac_explanation.json +++ b/bot/resources/valentines/zodiac_explanation.json @@ -4,8 +4,8 @@ "end_at": "2020-04-19", "About": "Amazing people born between **March 21** to **April 19**. Aries loves to be number one, so it\u2019s no surprise that these audacious rams are the first sign of the zodiac. Bold and ambitious, Aries dives headfirst into even the most challenging situations.", "Motto": "***\u201cWhen you know yourself, you're empowered. When you accept yourself, you're invincible.\u201d***", - "Strengths": "courageous, determined, confident, enthusiastic, optimistic, honest, passionate.", - "Weaknesses": "impatient, moody, short-tempered, impulsive, aggressive.", + "Strengths": "Courageous, determined, confident, enthusiastic, optimistic, honest, passionate.", + "Weaknesses": "Impatient, moody, short-tempered, impulsive, aggressive.", "full_form": "__**A**__ssertive, __**R**__efreshing, __**I**__ndependent, __**E**__nergetic, __**S**__exy", "url": "https://www.horoscope.com/images-US/signs/profile-aries.png" }, @@ -14,8 +14,8 @@ "end_at": "2020-05-20", "About": "Amazing people born between **April 20** to **May 20**. Taurus is an earth sign represented by the bull. Like their celestial spirit animal, Taureans enjoy relaxing in serene, bucolic environments surrounded by soft sounds, soothing aromas, and succulent flavors", "Motto": "***\u201cNothing worth having comes easy.\u201d***", - "Strengths": "reliable, patient, practical, devoted, responsible, stable.", - "Weaknesses": "stubborn, possessive, uncompromising.", + "Strengths": "Reliable, patient, practical, devoted, responsible, stable.", + "Weaknesses": "Stubborn, possessive, uncompromising.", "full_form": "__**T**__railblazing, __**A**__mbitious, __**U**__nwavering, __**R**__eliable, __**U**__nderstanding, __**S**__table", "url": "https://www.horoscope.com/images-US/signs/profile-taurus.png" }, @@ -24,8 +24,8 @@ "end_at": "2020-06-20", "About": "Amazing people born between **May 21** to **June 20**. Have you ever been so busy that you wished you could clone yourself just to get everything done? That\u2019s the Gemini experience in a nutshell. Appropriately symbolized by the celestial twins, this air sign was interested in so many pursuits that it had to double itself.", "Motto": "***\u201cI manifest my reality.\u201d***", - "Strengths": "gentle, affectionate, curious, adaptable, ability to learn quickly and exchange ideas.", - "Weaknesses": "nervous, inconsistent, indecisive.", + "Strengths": "Gentle, affectionate, curious, adaptable, ability to learn quickly and exchange ideas.", + "Weaknesses": "Nervous, inconsistent, indecisive.", "full_form": "__**G**__enerous, __**E**__motionally in tune, __**M**__otivated, __**I**__maginative, __**N**__ice, __**I**__ntelligent", "url": "https://www.horoscope.com/images-US/signs/profile-gemini.png" }, @@ -34,8 +34,8 @@ "end_at": "2020-07-22", "About": "Amazing people born between **June 21 ** to **July 22**. Cancer is a cardinal water sign. Represented by the crab, this crustacean seamlessly weaves between the sea and shore representing Cancer\u2019s ability to exist in both emotional and material realms. Cancers are highly intuitive and their psychic abilities manifest in tangible spaces: For instance, Cancers can effortlessly pick up the energies in a room.", "Motto": "***\u201cI feel, therefore I am.\u201d***", - "Strengths": "tenacious, highly imaginative, loyal, emotional, sympathetic, persuasive.", - "Weaknesses": "moody, pessimistic, suspicious, manipulative, insecuremoody, pessimistic, suspicious, manipulative, insecure.", + "Strengths": "Tenacious, highly imaginative, loyal, emotional, sympathetic, persuasive.", + "Weaknesses": "Moody, pessimistic, suspicious, manipulative, insecuremoody, pessimistic, suspicious, manipulative, insecure.", "full_form": "__**C**__aring, __**A**__mbitious, __**N**__ourishing, __**C**__reative, __**E**__motionally intelligent, __**R**__esilient", "url": "https://www.horoscope.com/images-US/signs/profile-cancer.png" }, @@ -44,8 +44,8 @@ "end_at": "2020-08-22", "About": "Amazing people born between **July 23** to **August 22**. Roll out the red carpet because Leo has arrived. Leo is represented by the lion and these spirited fire signs are the kings and queens of the celestial jungle. They\u2019re delighted to embrace their royal status: Vivacious, theatrical, and passionate, Leos love to bask in the spotlight and celebrate themselves.", "Motto": "***\u201cIf you know the way, go the way and show the way\u2014you're a leader.\u201d***", - "Strengths": "creative, passionate, generous, warm-hearted, cheerful, humorous.", - "Weaknesses": "arrogant, stubborn, self-centered, lazy, inflexible.", + "Strengths": "Creative, passionate, generous, warm-hearted, cheerful, humorous.", + "Weaknesses": "Arrogant, stubborn, self-centered, lazy, inflexible.", "full_form": "__**L**__eaders, __**E**__nergetic, __**O**__ptimistic", "url": "https://www.horoscope.com/images-US/signs/profile-leo.png" }, @@ -54,8 +54,8 @@ "end_at": "2020-09-22", "About": "Amazing people born between **August 23** to **September 22**. Virgo is an earth sign historically represented by the goddess of wheat and agriculture, an association that speaks to Virgo\u2019s deep-rooted presence in the material world. Virgos are logical, practical, and systematic in their approach to life. This earth sign is a perfectionist at heart and isn\u2019t afraid to improve skills through diligent and consistent practice.", "Motto": "***\u201cMy best can always be better.\u201d***", - "Strengths": "loyal, analytical, kind, hardworking, practical.", - "Weaknesses": "shyness, worry, overly critical of self and others, all work and no play.", + "Strengths": "Loyal, analytical, kind, hardworking, practical.", + "Weaknesses": "Shyness, worry, overly critical of self and others, all work and no play.", "full_form": "__**V**__irtuous, __**I**__ntelligent, __**R**__esponsible, __**G**__enerous, __**O**__ptimistic", "url": "https://www.horoscope.com/images-US/signs/profile-virgo.png" }, @@ -64,8 +64,8 @@ "end_at": "2020-10-22", "About": "Amazing people born between **September 23** to **October 22**. Libra is an air sign represented by the scales (interestingly, the only inanimate object of the zodiac), an association that reflects Libra's fixation on balance and harmony. Libra is obsessed with symmetry and strives to create equilibrium in all areas of life.", "Motto": "***\u201cNo person is an island.\u201d***", - "Strengths": "cooperative, diplomatic, gracious, fair-minded, social.", - "Weaknesses": "indecisive, avoids confrontations, will carry a grudge, self-pity.", + "Strengths": "Cooperative, diplomatic, gracious, fair-minded, social.", + "Weaknesses": "Indecisive, avoids confrontations, will carry a grudge, self-pity.", "full_form": "__**L**__oyal, __**I**__nquisitive, __**B**__alanced, __**R**__esponsible, __**A**__ltruistic", "url": "https://www.horoscope.com/images-US/signs/profile-libra.png" }, @@ -74,8 +74,8 @@ "end_at": "2020-11-21", "About": "Amazing people born between **October 23** to **November 21**. Scorpio is one of the most misunderstood signs of the zodiac. Because of its incredible passion and power, Scorpio is often mistaken for a fire sign. In fact, Scorpio is a water sign that derives its strength from the psychic, emotional realm.", "Motto": "***\u201cYou never know what you are capable of until you try.\u201d***", - "Strengths": "resourceful, brave, passionate, stubborn, a true friend.", - "Weaknesses": "distrusting, jealous, secretive, violent.", + "Strengths": "Resourceful, brave, passionate, stubborn, a true friend.", + "Weaknesses": "Distrusting, jealous, secretive, violent.", "full_form": "__**S**__eductive, __**C**__erebral, __**O**__riginal, __**R**__eactive, __**P**__assionate, __**I**__ntuitive, __**O**__utstanding", "url": "https://www.horoscope.com/images-US/signs/profile-scorpio.png" }, @@ -84,8 +84,8 @@ "end_at": "2020-12-21", "About": "Amazing people born between **November 22** to **December 21**. Represented by the archer, Sagittarians are always on a quest for knowledge. The last fire sign of the zodiac, Sagittarius launches its many pursuits like blazing arrows, chasing after geographical, intellectual, and spiritual adventures.", "Motto": "***\u201cTowering genius disdains a beaten path.\u201d***", - "Strengths": "generous, idealistic, great sense of humor.", - "Weaknesses": "promises more than can deliver, very impatient, will say anything no matter how undiplomatic.", + "Strengths": "Generous, idealistic, great sense of humor.", + "Weaknesses": "Promises more than can deliver, very impatient, will say anything no matter how undiplomatic.", "full_form": "__**S**__eductive, __**A**__dventurous, __**G**__rateful, __**I**__ntelligent, __**T**__railblazing, __**T**__enacious adept, __**A**__dept, __**R**__esponsible, __**I**__dealistic, __**U**__nparalled, __**S**__ophisticated", "url": "https://www.horoscope.com/images-US/signs/profile-sagittarius.png" }, @@ -94,8 +94,8 @@ "end_at": "2021-01-19", "About": "Amazing people born between **December 22** to **January 19**. The last earth sign of the zodiac, Capricorn is represented by the sea goat, a mythological creature with the body of a goat and tail of a fish. Accordingly, Capricorns are skilled at navigating both the material and emotional realms.", "Motto": "***\u201cI can succeed at anything I put my mind to.\u201d***", - "Strengths": "responsible, disciplined, self-control, good managers.", - "Weaknesses": "know-it-all, unforgiving, condescending, expecting the worst.", + "Strengths": "Responsible, disciplined, self-control, good managers.", + "Weaknesses": "Know-it-all, unforgiving, condescending, expecting the worst.", "full_form": "__**C**__onfident, __**A**__nalytical, __**P**__ractical, __**R**__esponsible, __**I**__ntelligent, __**C**__aring, __**O**__rganized, __**R**__ealistic, __**N**__eat", "url": "https://www.horoscope.com/images-US/signs/profile-capricorn.png" }, -- cgit v1.2.3 From f5d572f45b507537c10217b9c4f25b2fc733bd20 Mon Sep 17 00:00:00 2001 From: Anubhav1603 Date: Thu, 1 Oct 2020 19:20:02 +0530 Subject: changed line 64 logging to trace and in error description added date also --- bot/exts/valentines/valentine_zodiac.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bot/exts/valentines/valentine_zodiac.py b/bot/exts/valentines/valentine_zodiac.py index 56831060..29888bcf 100644 --- a/bot/exts/valentines/valentine_zodiac.py +++ b/bot/exts/valentines/valentine_zodiac.py @@ -45,7 +45,8 @@ class ValentineZodiac(commands.Cog): embed = discord.Embed() embed.color = Colours.soft_red error_comp = "\n".join( - f"`{i}` {zod_name}" for i, zod_name in enumerate(self.zodiac_fact.keys(), start=1) + f"`{i}` {name}: {zodiac['start_at'].date()} - {zodiac['end_at'].date()}" + for i, (name, zodiac) in enumerate(sorted(self.zodiac_fact.items()), start=1) ) embed.description = ( f"**{zodiac}** is not a valid zodiac sign, here is the list of valid zodiac signs.\n" @@ -60,7 +61,7 @@ class ValentineZodiac(commands.Cog): embed = discord.Embed() embed.color = Colours.pink if zodiac in self.zodiac_fact: - log.info("Making zodiac embed.") + log.trace("Making zodiac embed.") embed.title = f"__{zodiac}__" embed.description = self.zodiac_fact[zodiac]["About"] embed.add_field(name='__Motto__', value=self.zodiac_fact[zodiac]["Motto"], inline=False) -- cgit v1.2.3 From f052fb9c629f080729bfdf9942b08983bb1fa613 Mon Sep 17 00:00:00 2001 From: Anubhav1603 Date: Thu, 1 Oct 2020 19:52:46 +0530 Subject: formated date and month of error in better way --- bot/exts/valentines/valentine_zodiac.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bot/exts/valentines/valentine_zodiac.py b/bot/exts/valentines/valentine_zodiac.py index 29888bcf..36572729 100644 --- a/bot/exts/valentines/valentine_zodiac.py +++ b/bot/exts/valentines/valentine_zodiac.py @@ -45,7 +45,7 @@ class ValentineZodiac(commands.Cog): embed = discord.Embed() embed.color = Colours.soft_red error_comp = "\n".join( - f"`{i}` {name}: {zodiac['start_at'].date()} - {zodiac['end_at'].date()}" + f"`{i}` {name}: {zodiac['start_at'].strftime('%B `%d`')} - {zodiac['end_at'].strftime('%B `%d`')}" for i, (name, zodiac) in enumerate(sorted(self.zodiac_fact.items()), start=1) ) embed.description = ( -- cgit v1.2.3 From c350c1c252d53e17c9ecd527760a345741a8ef46 Mon Sep 17 00:00:00 2001 From: Anubhav1603 Date: Thu, 1 Oct 2020 21:12:12 +0530 Subject: modified error msg --- bot/exts/valentines/valentine_zodiac.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/bot/exts/valentines/valentine_zodiac.py b/bot/exts/valentines/valentine_zodiac.py index 36572729..660bc092 100644 --- a/bot/exts/valentines/valentine_zodiac.py +++ b/bot/exts/valentines/valentine_zodiac.py @@ -44,14 +44,16 @@ class ValentineZodiac(commands.Cog): """Returns error embed.""" embed = discord.Embed() embed.color = Colours.soft_red - error_comp = "\n".join( - f"`{i}` {name}: {zodiac['start_at'].strftime('%B `%d`')} - {zodiac['end_at'].strftime('%B `%d`')}" - for i, (name, zodiac) in enumerate(sorted(self.zodiac_fact.items()), start=1) - ) - embed.description = ( - f"**{zodiac}** is not a valid zodiac sign, here is the list of valid zodiac signs.\n" - f"{error_comp}" - ) + error_msg = f"**{zodiac}** is not a valid zodiac sign, here is the list of valid zodiac signs.\n" + valid_zodiac_name = '' + for name in sorted(self.zodiac_fact.keys()): + if name == "Leo": + valid_zodiac_name += f'{name}\n ' + elif name == 'Virgo': + valid_zodiac_name += name + else: + valid_zodiac_name += f'{name}, ' + embed.description = error_msg + valid_zodiac_name log.info("Invalid zodiac name provided.") return embed -- cgit v1.2.3 From db66d4f79fc0ffacec0d36b3868afed8776f1a7c Mon Sep 17 00:00:00 2001 From: Anubhav <57266248+Anubhav1603@users.noreply.github.com> Date: Thu, 1 Oct 2020 21:54:35 +0530 Subject: Update bot/exts/valentines/valentine_zodiac.py Co-authored-by: Thomas Petersson <61778143+thomaspet@users.noreply.github.com> --- bot/exts/valentines/valentine_zodiac.py | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/bot/exts/valentines/valentine_zodiac.py b/bot/exts/valentines/valentine_zodiac.py index 660bc092..688bb8eb 100644 --- a/bot/exts/valentines/valentine_zodiac.py +++ b/bot/exts/valentines/valentine_zodiac.py @@ -45,14 +45,7 @@ class ValentineZodiac(commands.Cog): embed = discord.Embed() embed.color = Colours.soft_red error_msg = f"**{zodiac}** is not a valid zodiac sign, here is the list of valid zodiac signs.\n" - valid_zodiac_name = '' - for name in sorted(self.zodiac_fact.keys()): - if name == "Leo": - valid_zodiac_name += f'{name}\n ' - elif name == 'Virgo': - valid_zodiac_name += name - else: - valid_zodiac_name += f'{name}, ' + valid_zodiac_name = ", ".join(self.zodiac_fact).replace("Leo, ", "Leo,\n") embed.description = error_msg + valid_zodiac_name log.info("Invalid zodiac name provided.") return embed -- cgit v1.2.3 From 9be31c8d5aa5c5aba06340b4f646b82855635a54 Mon Sep 17 00:00:00 2001 From: Anubhav1603 Date: Thu, 1 Oct 2020 22:43:05 +0530 Subject: modified error message --- bot/exts/valentines/valentine_zodiac.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bot/exts/valentines/valentine_zodiac.py b/bot/exts/valentines/valentine_zodiac.py index 688bb8eb..3049540d 100644 --- a/bot/exts/valentines/valentine_zodiac.py +++ b/bot/exts/valentines/valentine_zodiac.py @@ -45,8 +45,9 @@ class ValentineZodiac(commands.Cog): embed = discord.Embed() embed.color = Colours.soft_red error_msg = f"**{zodiac}** is not a valid zodiac sign, here is the list of valid zodiac signs.\n" - valid_zodiac_name = ", ".join(self.zodiac_fact).replace("Leo, ", "Leo,\n") - embed.description = error_msg + valid_zodiac_name + first_part_of_valid_name_list = ", ".join(name for name in list(self.zodiac_fact.keys())[:7]) + end_part_of_valid_name_list = ", ".join(name for name in list(self.zodiac_fact.keys())[7:]) + embed.description = error_msg + first_part_of_valid_name_list + ",\n" + end_part_of_valid_name_list log.info("Invalid zodiac name provided.") return embed -- cgit v1.2.3 From e949e54f0e0d3a3d5233799e837b12505d38ad5e Mon Sep 17 00:00:00 2001 From: Anubhav1603 Date: Fri, 2 Oct 2020 18:02:34 +0530 Subject: modified error message --- bot/exts/valentines/valentine_zodiac.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/bot/exts/valentines/valentine_zodiac.py b/bot/exts/valentines/valentine_zodiac.py index 3049540d..2696999f 100644 --- a/bot/exts/valentines/valentine_zodiac.py +++ b/bot/exts/valentines/valentine_zodiac.py @@ -45,9 +45,11 @@ class ValentineZodiac(commands.Cog): embed = discord.Embed() embed.color = Colours.soft_red error_msg = f"**{zodiac}** is not a valid zodiac sign, here is the list of valid zodiac signs.\n" - first_part_of_valid_name_list = ", ".join(name for name in list(self.zodiac_fact.keys())[:7]) - end_part_of_valid_name_list = ", ".join(name for name in list(self.zodiac_fact.keys())[7:]) - embed.description = error_msg + first_part_of_valid_name_list + ",\n" + end_part_of_valid_name_list + names = list(self.zodiac_fact) + middle_index = len(names) // 2 + first_half_names = ", ".join(names[:middle_index]) + second_half_names = ", ".join(names[middle_index:]) + embed.description = error_msg + first_half_names + ",\n" + second_half_names log.info("Invalid zodiac name provided.") return embed -- cgit v1.2.3