Skip to content

Commit

Permalink
update time zone
Browse files Browse the repository at this point in the history
  • Loading branch information
0xEthamin committed Jun 13, 2024
1 parent cef32d5 commit b8d1f85
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/GarageBot.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import discord
import asyncio
import os
import pytz
from discord.ext import commands

from SerrureNDL import *

paris_timezone = pytz.timezone('Europe/Paris')

class Bot(commands.Bot):
def __init__(self) -> None:
Expand Down Expand Up @@ -89,7 +91,7 @@ async def code_ndl(interaction: discord.Interaction):
code = AddOTP_D(name, int(os.getenv("OTP_DURATION")))
with open("./log/CodeLog.txt", "a") as f:
#append a log line as csv, with time, name, pseudo, id, code, valid time
f.write(f"{datetime.now()},{interaction.user.display_name},{interaction.user.name},{interaction.user.id},{code},{os.getenv('OTP_DURATION')}\n")
f.write(f"{datetime.now(paris_timezone)},{interaction.user.display_name},{interaction.user.name},{interaction.user.id},{code},{os.getenv('OTP_DURATION')}\n")

await interaction.user.send(f"Le code est {code}, il est valide pour {os.getenv('OTP_DURATION')} minutes.")
await interaction.response.send_message(f"Le code est {code}", ephemeral=True)
Expand Down
1 change: 1 addition & 0 deletions utils/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ discord.py
asyncio
requests
datetime
pytz

0 comments on commit b8d1f85

Please sign in to comment.