nyx/events/slash.js

36 lines
1,006 B
JavaScript
Raw Permalink Normal View History

2021-06-12 12:53:51 +02:00
const { Client, Message, MessageEmbed } = require("discord.js");
2021-06-24 09:53:19 +02:00
const client = require("../bot");
2021-06-12 12:53:51 +02:00
async function createApiMessage(interaction, content) {
const apiMessage = await APIMessage.create(
client.channels.resolve(interaction.channel_id),
content
)
.resolveData()
.resolveFiles();
return { ...apiMessage.data, files: apiMessage.files };
}
client.on("ready", async () => {
const a = client.api.applications(client.user.id);
a.commands.post({
data: {
name: "help",
description: "Get some support!",
},
});
});
2021-06-24 09:53:19 +02:00
client.ws.on("INTERACTION_CREATE", async interaction => {
2021-06-12 12:53:51 +02:00
let command = interaction.data.name.toLowerCase();
let args = interaction.data.options;
if (command === "help") {
client.api.interactions(interaction.id, interaction.token).callback.post({
data: {
type: 4,
data: {
content:
"Website: https://cath.gq/\n Support: https://discord.gg/SbQHChmGcp",
},
},
});
}
});