Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Apr 5, 2024
1 parent 6d35fc5 commit 38d36cb
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ POKE_CHANNEL=
POKE_ROLE=
POKEBALL_EMOJI=
# Birthdays notif
BIRTHDAY_CHANNEL=
BIRTHDAY_CHANNEL=

# Hypixel API key
HYPIXEL_KEY=
Expand Down
4 changes: 3 additions & 1 deletion commands/birthdays.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,6 @@ async def remove_birthday(interaction: discord.Interaction[ChouetteBot]):
save_birthdays(birthdays)
await interaction.response.send_message("Anniversaire supprimé !")
else:
await interaction.response.send_message("Vous n'avez pas d'anniversaire enregistré.", ephemeral=True)
await interaction.response.send_message(
"Vous n'avez pas d'anniversaire enregistré.", ephemeral=True
)
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
aiohttp ~= 3.9.3
discord.py[speed] ~= 2.3.2
python-dotenv ~= 1.0.1
tomlkit ~= 0.12.4
tomlkit ~= 0.12.4
8 changes: 5 additions & 3 deletions tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,20 @@ async def poke_ping():
pokeball = client.get_emoji(int(client.config["POKEBALL_EMOJI"]))
msg_poke = f"{dresseurs.mention} C'est l'heure d'attraper des pokémons {pokeball}"
await client.get_channel(int(client.config["POKE_CHANNEL"])).send(msg_poke)

# Loop to check if it's 8:00 and send a message if it's someone's birthday
@tasks.loop(hours=24)
async def check_birthdays():
now = time.now()
if now.hour == 8 and now.minute == 0:
today = now.strftime('%d/%m')
today = now.strftime("%d/%m")
for user_id, birthday in birthdays.items():
if birthday == today:
user = await bot.fetch_user(int(user_id))
msg_birthday = f":tada: {user.mention} is a year older now! Wish them a happy birthday! :tada:"
await client.get_channel(int(client.config["BIRTHDAY_CHANNEL"])).send(msg_birthday)
await client.get_channel(int(client.config["BIRTHDAY_CHANNEL"])).send(
msg_birthday
)

# Start loop
poke_ping.start()
Expand Down

0 comments on commit 38d36cb

Please sign in to comment.