general.ping: use messageReference

This commit is contained in:
Cynthia Foxwell 2021-05-26 12:49:42 -06:00
parent 5980e832de
commit 85b81c5106

View file

@ -124,7 +124,15 @@ ping.helpText = "Pong";
ping.description = "Measures response times to Discord."; 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({
content: "Pong.",
allowedMentions: {
repliedUser: false,
},
messageReference: {
messageID: msg.id,
},
});
const rtt = Math.floor( const rtt = Math.floor(
newMsg.timestamp - (msg.editedTimestamp || msg.timestamp) newMsg.timestamp - (msg.editedTimestamp || msg.timestamp)
); );
@ -132,7 +140,12 @@ ping.callback = async function (msg) {
hf.bot.guildShardMap[hf.bot.channelGuildMap[msg.channel.id]] || 0 hf.bot.guildShardMap[hf.bot.channelGuildMap[msg.channel.id]] || 0
).latency; ).latency;
newMsg.edit(`Pong. RTT: \`${rtt}ms\`, Gateway: \`${gateway}ms\``); newMsg.edit({
content: `Pong. RTT: \`${rtt}ms\`, Gateway: \`${gateway}ms\``,
allowedMentions: {
repliedUser: false,
},
});
}; };
hf.registerCommand(ping); hf.registerCommand(ping);