backtracking nowtimestamp method

This commit is contained in:
Mylloon 2021-06-03 12:33:43 +02:00
parent c296bb35a9
commit 81f865b102

View file

@ -39,7 +39,7 @@ class Utils(commands.Cog):
if arg == 'help': if arg == 'help':
return await ctx.send(embed = discord.Embed(color = discord.Colour.random(), description = ":hourglass: correspond au temps entre deux battements de cœurs\n\n:stopwatch: correspond au temps que met le client a calculer le ping\n\n:heartbeat: correspond au temps que met le client a réagir au messages")) return await ctx.send(embed = discord.Embed(color = discord.Colour.random(), description = ":hourglass: correspond au temps entre deux battements de cœurs\n\n:stopwatch: correspond au temps que met le client a calculer le ping\n\n:heartbeat: correspond au temps que met le client a réagir au messages"))
else: else:
now = int(nowTimestamp()) now = int(round(time.time() * 1000))
if fromSlash != True: if fromSlash != True:
ping = now - int(round(ctx.message.created_at.timestamp() * 1000)) ping = now - int(round(ctx.message.created_at.timestamp() * 1000))
else: else:
@ -52,7 +52,7 @@ class Utils(commands.Cog):
await ctx.message.add_reaction(emoji = '') await ctx.message.add_reaction(emoji = '')
@cog_ext.cog_slash(name="ping", description = "Affiche mon ping.") @cog_ext.cog_slash(name="ping", description = "Affiche mon ping.")
async def __ping(self, ctx, arg = None): async def __ping(self, ctx, arg = None):
ctx.slash_created_at = int(nowTimestamp()) ctx.slash_created_at = int(datetime.now(timezone(self.customTimezone)).timestamp())
if arg == None: if arg == None:
return await self._ping(ctx, True) return await self._ping(ctx, True)
else: else:
@ -226,7 +226,7 @@ class Utils(commands.Cog):
await ctx.message.delete() await ctx.message.delete()
embed = discord.Embed(description = text, color = discord.Colour.random()) embed = discord.Embed(description = text, color = discord.Colour.random())
embed.set_author(name = f"Mémo noté depuis {ctx.guild.name}", icon_url = ctx.author.avatar_url) embed.set_author(name = f"Mémo noté depuis {ctx.guild.name}", icon_url = ctx.author.avatar_url)
embed.set_footer(text = f'📝 le {nowTimestamp().strftime("%d/%m/%Y à %H:%M:%S")}') embed.set_footer(text = f'📝 le {datetime.now(timezone(self.customTimezone)).strftime("%d/%m/%Y à %H:%M:%S")}')
await ctx.author.send(embed = embed) await ctx.author.send(embed = embed)
return await ctx.send("Tu viens de recevoir ton mémo !", delete_after = 5) return await ctx.send("Tu viens de recevoir ton mémo !", delete_after = 5)
@_memo.error @_memo.error