fix tz in whois command
This commit is contained in:
parent
ea2c6d725a
commit
5bdeb7a4d7
2 changed files with 8 additions and 7 deletions
|
@ -6,7 +6,7 @@ from random import randint, shuffle
|
||||||
from discord_slash import cog_ext
|
from discord_slash import cog_ext
|
||||||
from utils.reminder import Reminder
|
from utils.reminder import Reminder
|
||||||
from utils.core import map_list_among_us, getURLsInString, getMentionInString, cleanCodeStringWithMentionAndURLs, cleanUser, userOrNick
|
from utils.core import map_list_among_us, getURLsInString, getMentionInString, cleanCodeStringWithMentionAndURLs, cleanUser, userOrNick
|
||||||
from utils.time import stringTempsVersSecondes, nowUTC, intToDatetime, timedeltaToString, timestampScreen, getAge, ageLayout, nowCustom, UTCDatetimeToCustomDatetime
|
from utils.time import stringTempsVersSecondes, nowUTC, intToDatetime, timedeltaToString, timestampScreen, getAge, ageLayout, nowCustom
|
||||||
|
|
||||||
def setup(client):
|
def setup(client):
|
||||||
client.add_cog(Utils(client))
|
client.add_cog(Utils(client))
|
||||||
|
@ -362,13 +362,13 @@ class Utils(commands.Cog):
|
||||||
|
|
||||||
embed.add_field(name = "Compte créé le", value = timestampScreen(user[0].created_at))
|
embed.add_field(name = "Compte créé le", value = timestampScreen(user[0].created_at))
|
||||||
|
|
||||||
embed.add_field(name = "Âge du compte", value = ageLayout(getAge(UTCDatetimeToCustomDatetime(user[0].created_at))))
|
embed.add_field(name = "Âge du compte", value = ageLayout(getAge(user[0].created_at)))
|
||||||
|
|
||||||
embed.add_field(name = "Mention", value = user[0].mention)
|
embed.add_field(name = "Mention", value = user[0].mention)
|
||||||
|
|
||||||
embed.add_field(name = "Serveur rejoint le", value = timestampScreen(user[0].joined_at))
|
embed.add_field(name = "Serveur rejoint le", value = timestampScreen(user[0].joined_at))
|
||||||
|
|
||||||
embed.add_field(name = "Est sur le serveur depuis", value = ageLayout(getAge(UTCDatetimeToCustomDatetime(user[0].joined_at))))
|
embed.add_field(name = "Est sur le serveur depuis", value = ageLayout(getAge(user[0].joined_at)))
|
||||||
if fromSlash != True:
|
if fromSlash != True:
|
||||||
await ctx.message.add_reaction(emoji = '✅')
|
await ctx.message.add_reaction(emoji = '✅')
|
||||||
return await ctx.send(embed = embed)
|
return await ctx.send(embed = embed)
|
||||||
|
|
|
@ -72,18 +72,19 @@ def timedeltaToString(time):
|
||||||
return ''.join(age)
|
return ''.join(age)
|
||||||
|
|
||||||
def getAge(date):
|
def getAge(date):
|
||||||
"""Recupère un age précisément à la seconde près"""
|
"""Recupère un âge précisément à la seconde près"""
|
||||||
joursRestants = intToDatetime(nowCustom()) - date
|
heureAjouter = int(str(UTCDatetimeToCustomDatetime(intToDatetime(nowUTC()))).split('+')[1].split(':')[0])
|
||||||
|
joursRestants = intToDatetime(nowUTC()) - date
|
||||||
years = joursRestants.total_seconds() / (365.242 * 24 * 3600)
|
years = joursRestants.total_seconds() / (365.242 * 24 * 3600)
|
||||||
months = (years - int(years)) * 12
|
months = (years - int(years)) * 12
|
||||||
days = (months - int(months)) * (365.242 / 12)
|
days = (months - int(months)) * (365.242 / 12)
|
||||||
hours = (days - int(days)) * 24
|
hours = (days - int(days)) * 24
|
||||||
minutes = (hours - int(hours)) * 60
|
minutes = (hours - int(hours)) * 60
|
||||||
seconds = (minutes - int(minutes)) * 60
|
seconds = (minutes - int(minutes)) * 60
|
||||||
return (int(years), int(months), int(days), int(hours), int(minutes), int(seconds))
|
return (int(years), int(months), int(days), int(hours) + heureAjouter, int(minutes), int(seconds))
|
||||||
|
|
||||||
def ageLayout(tuple):
|
def ageLayout(tuple):
|
||||||
"""avec la méthode 'getAge', permet de mettre en forme un âge"""
|
"""Avec la méthode `getAge`, permet de mettre en forme un âge"""
|
||||||
time = {}
|
time = {}
|
||||||
time[0], time[1], time[2], time[3], time[4], time[5] = "an", "mois", "jour", "heure", "minute", "seconde"
|
time[0], time[1], time[2], time[3], time[4], time[5] = "an", "mois", "jour", "heure", "minute", "seconde"
|
||||||
for i in range(len(tuple)):
|
for i in range(len(tuple)):
|
||||||
|
|
Reference in a new issue