2022-07-31 17:08:00 +05:00
|
|
|
const { SlashCommandBuilder } = require("discord.js");
|
2022-10-02 23:40:05 +05:00
|
|
|
const BaseCommand = require("../../base/BaseCommand"),
|
|
|
|
fetch = require("node-fetch");
|
2022-07-31 17:08:00 +05:00
|
|
|
|
|
|
|
class LMGTFY extends BaseCommand {
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @param {import("../base/JaBa")} client
|
|
|
|
*/
|
|
|
|
constructor(client) {
|
|
|
|
super({
|
|
|
|
command: new SlashCommandBuilder()
|
|
|
|
.setName("lmgtfy")
|
|
|
|
.setDescription(client.translate("fun/lmgtfy:DESCRIPTION"))
|
2022-10-02 23:40:05 +05:00
|
|
|
.addStringOption(option => option.setName("query")
|
|
|
|
.setDescription(client.translate("fun/lmgtfy:QUERY"))
|
|
|
|
.setRequired(true))
|
|
|
|
.addBooleanOption(option => option.setName("short")
|
|
|
|
.setDescription(client.translate("fun/lmgtfy:SHORT"))
|
|
|
|
.setRequired(true)),
|
2022-07-31 17:08:00 +05:00
|
|
|
aliases: [],
|
|
|
|
dirname: __dirname,
|
|
|
|
guildOnly: true,
|
|
|
|
ownerOnly: false
|
|
|
|
});
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @param {import("../../base/JaBa")} client
|
|
|
|
*/
|
|
|
|
async onLoad() {
|
|
|
|
//...
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @param {import("../../base/JaBa")} client
|
2022-08-01 20:06:09 +05:00
|
|
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
2022-08-09 23:48:33 +05:00
|
|
|
* @param {Object} data
|
2022-07-31 17:08:00 +05:00
|
|
|
*/
|
|
|
|
async execute(client, interaction) {
|
2022-10-02 23:40:05 +05:00
|
|
|
const query = interaction.options.getString("query").replace(/[' '_]/g, "+"),
|
|
|
|
short = interaction.options.getBoolean("short"),
|
|
|
|
url = `https://letmegooglethat.com/?q=${query}`;
|
2022-07-31 17:08:00 +05:00
|
|
|
|
2022-10-02 23:40:05 +05:00
|
|
|
if (short) {
|
|
|
|
const res = await fetch(`https://is.gd/create.php?format=simple&url=${encodeURIComponent(url)}`).then(res => res.text());
|
|
|
|
|
|
|
|
interaction.reply({
|
|
|
|
content: `<${res}>`,
|
|
|
|
ephemeral: true
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
interaction.reply({
|
|
|
|
content: `<${url}>`,
|
|
|
|
ephemeral: true
|
|
|
|
});
|
|
|
|
}
|
2022-07-31 17:08:00 +05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = LMGTFY;
|