diff --git a/deploy/roles/deploy_bot_container/templates/Dockerfile.j2 b/deploy/roles/deploy_bot_container/templates/Dockerfile.j2 index 8f64122..ffaf29e 100644 --- a/deploy/roles/deploy_bot_container/templates/Dockerfile.j2 +++ b/deploy/roles/deploy_bot_container/templates/Dockerfile.j2 @@ -1,6 +1,6 @@ FROM almalinux:9 ENV TZ="{{ timezone_output.stdout }}" -RUN dnf install python39 -y +RUN dnf install python39 git -y RUN mkdir -p /code/sources WORKDIR /code COPY req.txt sources/req.txt diff --git a/sources/main.py b/sources/main.py index 21f0c7e..ca8f669 100644 --- a/sources/main.py +++ b/sources/main.py @@ -96,9 +96,17 @@ async def select_callback( name='get-timestamp', description='Get formatted timestamp for any date and/or time', ) -@discord.app_commands.describe(time='HH:MM') -@discord.app_commands.describe(date='dd.mm.YYYY') -async def get_timestamp(interaction, time: str = '', date: str = ''): +@discord.app_commands.describe( + time='Please input a time in any suitable format in your region' +) +@discord.app_commands.describe( + date='Please input a date in any suitable format in your region' +) +async def get_timestamp( + interaction: discord.Interaction, + time: str = '', + date: str = '', +): """ Send any text by the bot :param time: an input time for converting @@ -106,7 +114,10 @@ async def get_timestamp(interaction, time: str = '', date: str = ''): :param interaction: the command's interaction :return: None """ - time_date = dateparser.parse(f'{time} {date}') + time_date = dateparser.parse( + f'{time} {date}', + locales=[interaction.locale.value], + ) if time_date is None: await interaction.response.send_message( 'You sent a date/time in incorrect format', diff --git a/sources/req.txt b/sources/req.txt index e2da31a..68770fa 100644 --- a/sources/req.txt +++ b/sources/req.txt @@ -1,3 +1,3 @@ discord==2.3.2 tldextract==5.1.1 -dateparser==1.2.0 +git+https://github.com/ZelGray/dateparser.git@master