Fix train timestamps

This commit is contained in:
Stijn De Clercq 2020-10-23 16:34:02 +02:00
parent c8946fdc49
commit f6c324d656
3 changed files with 7 additions and 7 deletions

View file

@ -94,7 +94,7 @@ class Corona(commands.Cog):
inline=False)
# Timestamp of last update
timeFormatted = timeFormatters.epochToDate(dic["today"]["updated"])
timeFormatted = timeFormatters.epochToDate(int(dic["today"]["updated"])/1000)
embed.set_footer(text="Laatst geüpdatet op {} ({} geleden)".format(
timeFormatted["date"], timeFormatted["timeAgo"]))
await ctx.send(embed=embed)
@ -146,7 +146,7 @@ class Corona(commands.Cog):
distribution[0], distribution[1], distribution[2]), inline=False)
# Timestamp of last update
timeFormatted = timeFormatters.epochToDate(dic["today"]["updated"])
timeFormatted = timeFormatters.epochToDate(int(dic["today"]["updated"])/1000)
embed.set_footer(text="Laatst geüpdatet op {} ({} geleden)".format(
timeFormatted["date"], timeFormatted["timeAgo"]))
await ctx.send(embed=embed)

View file

@ -4,7 +4,7 @@ from decorators import help
import discord
from discord.ext import commands, menus
from enums.help_categories import Category
from functions import checks
from functions import checks, timeFormatters
import requests
@ -69,7 +69,7 @@ class Train(commands.Cog):
return str(minutes) + "m"
return "{}h{:02}m".format(minutes // 60, minutes % 60)
else:
return datetime.datetime.fromtimestamp(int(timestamp)).strftime("%H:%M")
return timeFormatters.epochToDate(int(timestamp), "%H:%M")["date"]
def formatDelay(self, seconds):
seconds = int(seconds)