general.ping: use editedTimestamp if avaliable

This commit is contained in:
Cynthia Foxwell 2021-03-14 20:22:40 -06:00
parent a7a8b90854
commit 93b9939066

View file

@ -125,7 +125,9 @@ ping.description = "Measures response times to Discord.";
ping.addAlias("p"); ping.addAlias("p");
ping.callback = async function (msg) { ping.callback = async function (msg) {
const newMsg = await msg.channel.createMessage("Pong."); const newMsg = await msg.channel.createMessage("Pong.");
const rtt = Math.floor(newMsg.timestamp - msg.timestamp); const rtt = Math.floor(
newMsg.timestamp - (msg.editedTimestamp || msg.timestamp)
);
const gateway = hf.bot.shards.get( const gateway = hf.bot.shards.get(
hf.bot.guildShardMap[hf.bot.channelGuildMap[msg.channel.id]] || 0 hf.bot.guildShardMap[hf.bot.channelGuildMap[msg.channel.id]] || 0
).latency; ).latency;