-
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.
- Loading branch information
Showing
37 changed files
with
178 additions
and
569 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
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
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
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,23 @@ | ||
import config from '../data/config.js'; | ||
import chalk from 'chalk'; | ||
import { REST, Routes } from 'discord.js'; | ||
const rest = new REST({ version: '10' }).setToken(config.bot.token); | ||
|
||
async function registerApplicationCommands(client) { | ||
try { | ||
let commands = new Map(); | ||
for (const [key, value] of client.interaction) { | ||
if (key.startsWith('slashCommand-') || key.startsWith('contextMenu-')) commands.set(key, value); | ||
} | ||
|
||
await rest.put( | ||
Routes.applicationCommands(client.user.id), | ||
{ body: [...commands.values()].map(command => command.data.toJSON()) }, | ||
); | ||
console.log(chalk.greenBright('[APPLICATION] Successfully registered application commands.')); | ||
} catch (err) { | ||
console.error(err); | ||
} | ||
} | ||
|
||
export default registerApplicationCommands; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -11,4 +11,4 @@ async function loadEvents(client) { | |
} | ||
} | ||
|
||
export default { loadEvents }; | ||
export default loadEvents; |
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,39 @@ | ||
import fs from 'fs'; | ||
import chalk from 'chalk'; | ||
|
||
async function loadInteractions(folderPath, client) { | ||
try { | ||
let files = fs.readdirSync(folderPath); | ||
|
||
for (let i = 0; i < files.length; i++) { | ||
let file = files[i]; | ||
let filePath = folderPath + '/' + file; | ||
let stats = fs.statSync(filePath); | ||
|
||
if (stats.isDirectory()) { | ||
await loadInteractions(filePath, client); | ||
} else { | ||
let interactionPath = '.' + filePath; | ||
let interaction = await import(`../${interactionPath}?${Date.now()}`); | ||
|
||
if (interaction.default.disabled === true) return; | ||
if (interaction.default.type === 'messageCommand') { | ||
client.interaction.set(`messageCommand-${interaction.default.id}`, interaction.default); | ||
console.log(chalk.greenBright(`[${interaction.default.type.toUpperCase()}] Successfully Loaded ${(chalk.yellow(file))} ${(chalk.yellow(interaction.default.id))}`)); | ||
if (interaction.default.aliases) { | ||
for (let i = 0; i < interaction.default.aliases.length; i++) { | ||
client.interaction.set(`messageCommand-${interaction.default.aliases[i]}`, interaction.default); | ||
} | ||
} | ||
} else { | ||
client.interaction.set(`${interaction.default.type}-${interaction.default.id}`, interaction.default); | ||
console.log(chalk.greenBright(`[${interaction.default.type.toUpperCase()}] Successfully Loaded ${(chalk.yellow(file))} ${(chalk.yellow(interaction.default.id))}`)); | ||
} | ||
} | ||
} | ||
} catch (err) { | ||
console.error(err); | ||
} | ||
} | ||
|
||
export default loadInteractions; |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.