Fix time formatter date string, remove useless field from whois

pull/21/head
Stijn De Clercq 2020-12-23 00:32:33 +01:00
parent d8663bed38
commit 416b13c9ac
2 changed files with 4 additions and 6 deletions

View File

@ -165,12 +165,12 @@ class ModCommands(commands.Cog):
embed.set_author(name=user.display_name, icon_url=user.avatar_url) embed.set_author(name=user.display_name, icon_url=user.avatar_url)
embed.add_field(name="Discriminator", value="#{}".format(user.discriminator)) embed.add_field(name="Discriminator", value="#{}".format(user.discriminator))
embed.add_field(name="Discord Id", value=user.id) embed.add_field(name="Discord id", value=user.id)
embed.add_field(name="Bot", value="Nee" if not user.bot else "Ja") embed.add_field(name="Bot", value="Nee" if not user.bot else "Ja")
created_local = timeFormatters.epochToDate(user.created_at.timestamp()) created_local = timeFormatters.epochToDate(user.created_at.timestamp())
embed.add_field(name="Account Aangemaakt", value="{}\n({} geleden)".format( embed.add_field(name="Account aangemaakt", value="{}\n({} geleden)".format(
created_local["date"], timeFormatters.diffYearBasisString(round(created_local["dateDT"].timestamp())) created_local["date"], timeFormatters.diffYearBasisString(round(created_local["dateDT"].timestamp()))
), inline=False) ), inline=False)
@ -178,12 +178,10 @@ class ModCommands(commands.Cog):
if ctx.guild is not None: if ctx.guild is not None:
member_instance = ctx.guild.get_member(user.id) member_instance = ctx.guild.get_member(user.id)
embed.add_field(name="Lid van {}".format(ctx.guild.name), value="Nee" if member_instance is None else "Ja")
if member_instance is not None: if member_instance is not None:
joined_local = timeFormatters.epochToDate(member_instance.joined_at.timestamp()) joined_local = timeFormatters.epochToDate(member_instance.joined_at.timestamp())
embed.add_field(name="Lid Geworden Op", value="{}\n({} Geleden)".format( embed.add_field(name="Lid geworden van {} op".format(ctx.guild.name), value="{}\n({} Geleden)".format(
joined_local["date"], timeFormatters.diffYearBasisString(round(joined_local["dateDT"].timestamp())) joined_local["date"], timeFormatters.diffYearBasisString(round(joined_local["dateDT"].timestamp()))
)) ))

View File

@ -5,7 +5,7 @@ import dateutil.relativedelta
import pytz import pytz
def epochToDate(epochTimeStamp, strFormat="%m/%d/%Y om %H:%M:%S"): def epochToDate(epochTimeStamp, strFormat="%d/%m/%Y om %H:%M:%S"):
now = dateTimeNow() now = dateTimeNow()
updateTime = datetime.datetime.fromtimestamp(int(epochTimeStamp), pytz.timezone("Europe/Brussels")) updateTime = datetime.datetime.fromtimestamp(int(epochTimeStamp), pytz.timezone("Europe/Brussels"))
diff = now - updateTime diff = now - updateTime