Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added horoscope command #34

Merged
merged 3 commits into from
Oct 11, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions cogs/fun.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,37 @@
import discord
from discord.ext import commands
import random
import requests
from datetime import datetime


def get_zodiac(date, month):
if month == 12:
astro_sign = 'sagittarius' if (date < 22) else 'capricorn'
elif month == 1:
astro_sign = 'capricorn' if (date < 20) else 'aquarius'
elif month == 2:
astro_sign = 'aquarius' if (date < 19) else 'pisces'
elif month == 3:
astro_sign = 'pisces' if (date < 21) else 'aries'
elif month == 4:
astro_sign = 'aries' if (date < 20) else 'taurus'
elif month == 5:
astro_sign = 'taurus' if (date < 21) else 'gemini'
elif month == 6:
astro_sign = 'gemini' if (date < 21) else 'cancer'
elif month == 7:
astro_sign = 'cancer' if (date < 23) else 'leo'
elif month == 8:
astro_sign = 'leo' if (date < 23) else 'virgo'
elif month == 9:
astro_sign = 'virgo' if (date < 23) else 'libra'
elif month == 10:
astro_sign = 'libra' if (date < 23) else 'scorpio'
elif month == 11:
astro_sign = 'scorpio' if (date < 22) else 'sagittarius'
return astro_sign

class Fun(commands.Cog):
def __init__(self, client):
self.client = client
Expand Down Expand Up @@ -46,10 +75,38 @@ async def roll(self, ctx, sides: int = 6):
embed=discord.Embed(title="Rolling...", description=f"You rolled a {random.randint(1, sides)}",
colour=discord.Colour.blurple()))

@commands.command(name='horoscope', help='Get your horoscope for today based on your *discord birthday*')
async def horoscope(self, ctx):
dob = ctx.message.author.created_at
date = dob.day
month = dob.month
zodiac = get_zodiac(date, month)
# print(date, month, zodiac)
params = (
('sign', zodiac),
('day', 'today'),
)

content = requests.post('https://aztro.sameerkumar.website/', params=params)
content = content.json()

embed = discord.Embed(title=f"Horoscope: {zodiac.capitalize()}", description=f"{content['description']}", color=discord.Colour.blurple())
embed.add_field(name="Compatibility", value=f"{content['compatibility']}", inline=True)
embed.add_field(name="Mood", value=f"{content['mood']}", inline=True)
embed.add_field(name="Color", value=f"{content['color']}", inline=False)
embed.add_field(name="Lucky Number", value=f"{content['lucky_number']}", inline=True)
embed.add_field(name="Lucky Time", value=f"{content['lucky_time']}", inline=True)

embed.set_footer(text=f"Requested by {ctx.message.author.display_name}")
embed.timestamp = datetime.utcnow()

await ctx.send(embed=embed)

@commands.command(help='Emoji-fy your text')
async def emoji(self, ctx, *, text):
await ctx.send(embed=discord.Embed(title="Emoji-fied Text",
description=f"{' '.join([f':regional_indicator_{char.lower()}:' for char in text if char.isalpha()])}",
colour=discord.Colour.blurple()))

async def setup(client):
await client.add_cog(Fun(client))