-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moved commands into new files in command folder
- Loading branch information
1 parent
fd48112
commit 4bf9234
Showing
5 changed files
with
108 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,20 @@ | ||
// import { Message } from "discord.js"; | ||
// import { i18n } from "../utils/i18n"; | ||
// import { canModifyQueue } from "../utils/queue"; | ||
// import { bot } from "../index"; | ||
const { SlashCommandBuilder } = require("@discordjs/builders"); | ||
const { EmbedBuilder } = require("discord.js"); | ||
const fs = require("fs"); | ||
const { parse } = require("csv-parse"); | ||
|
||
// export default { | ||
// name: "loop", | ||
// aliases: ["l"], | ||
// description: i18n.__("loop.description"), | ||
// execute(message: Message) { | ||
// const queue = bot.queues.get(message.guild!.id); | ||
module.exports = { | ||
data: new SlashCommandBuilder() | ||
.setName("journal") | ||
.setDescription("Replies with pong"), | ||
async execute(interaction, options) { | ||
num = Math.floor(Math.random() * options.length); | ||
|
||
// if (!queue) return message.reply(i18n.__("loop.errorNotQueue")).catch(console.error); | ||
// if (!canModifyQueue(message.member!)) return i18n.__("common.errorNotChannel"); | ||
const embed = new EmbedBuilder() | ||
.setColor(0x0099ff) | ||
.setTitle(options[num]) | ||
.setDescription("answer this journal prompt"); | ||
|
||
// queue.loop = !queue.loop; | ||
|
||
// return message | ||
// .reply(i18n.__mf("loop.result", { loop: queue.loop ? i18n.__("common.on") : i18n.__("common.off") })) | ||
// .catch(console.error); | ||
// } | ||
// }; | ||
const messageId = interaction.reply({ embeds: [embed] }); | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
const { SlashCommandBuilder } = require('@discordjs/builders'); | ||
|
||
module.exports = { | ||
data: new SlashCommandBuilder() | ||
.setName('ping') | ||
.setDescription('Replies with pong'), | ||
async execute(interaction) { | ||
interaction.reply({ content: 'Pong' }) | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
const { REST, SlashCommandBuilder, Routes } = require('discord.js'); | ||
const { clientId, guildId, token } = require('./config.json'); | ||
|
||
const commands = [ | ||
new SlashCommandBuilder().setName('ping').setDescription('Replies with pong!'), | ||
new SlashCommandBuilder().setName('server').setDescription('Replies with server info!'), | ||
new SlashCommandBuilder().setName('user').setDescription('Replies with user info!'), | ||
] | ||
.map(command => command.toJSON()); | ||
|
||
const rest = new REST({ version: '10' }).setToken(token); | ||
|
||
rest.put(Routes.applicationGuildCommands(clientId, guildId), { body: commands }) | ||
.then((data) => console.log(`Successfully registered ${data.length} application commands.`)) | ||
.catch(console.error); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
module.exports = (client, message) => { | ||
// Ignore all bots | ||
if (message.author.bot) return; | ||
|
||
// Ignore messages not starting with the prefix (in config.json) | ||
if (message.content.indexOf(client.config.prefix) !== 0) return; | ||
|
||
// Our standard argument/command name definition. | ||
const args = message.content.slice(client.config.prefix.length).trim().split(/ +/g); | ||
const command = args.shift().toLowerCase(); | ||
|
||
// Grab the command data from the client.commands Enmap | ||
const cmd = client.commands.get(command); | ||
|
||
// If that command doesn't exist, silently exit and do nothing | ||
if (!cmd) return; | ||
|
||
// Run the command | ||
cmd.run(client, message, args); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters