const { SlashCommandBuilder } = require("discord.js");
//const { execute } = require("../../events/client/ready");

function getUserFromMention(mention) {
  if (!mention) return;

  if (mention.startsWith("<@") && mention.endsWith(">")) {
    mention = mention.slice(2, -1);

    if (mention.startsWith("!")) {
      mention = mention.slice(1);
    }

    return client.users.cache.get(mention);
  }
}

module.exports = {
  data: new SlashCommandBuilder()
    .setName("ping")
    .setDescription("return ping!"),
  async execute(interaction, client) {
    const message = await interaction.deferReply({
      fetchReply: true,
    });

    const newMessage = `API Latency: ${client.ws.ping}\nClient Ping: ${
      message.createdTimestamp - interaction.createdTimestamp
    }`;

    await interaction.editReply({
      content: newMessage,
    });
  },
};
