diff options
author | 2020-10-01 10:33:50 +0530 | |
---|---|---|
committer | 2020-10-01 10:33:50 +0530 | |
commit | e34e3eb2667be82c7a69ced10684b0e0d02357b8 (patch) | |
tree | 6fef48d56160ba8acf68b341d5172a5ab691276a /bot | |
parent | changed pink colour embed to soft_red (diff) |
adjusted logging level,corrected grammer and small bugfix
Diffstat (limited to 'bot')
-rw-r--r-- | bot/exts/valentines/valentine_zodiac.py | 46 | ||||
-rw-r--r-- | 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!", |