general.ping: use messageReference
This commit is contained in:
		
							parent
							
								
									5980e832de
								
							
						
					
					
						commit
						85b81c5106
					
				
					 1 changed files with 15 additions and 2 deletions
				
			
		| 
						 | 
					@ -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);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue