-
Notifications
You must be signed in to change notification settings - Fork 1
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
0 parents
commit e2031ea
Showing
4,361 changed files
with
565,605 additions
and
0 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
There are no files selected for viewing
Binary file not shown.
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,13 @@ | ||
{ | ||
"extends": "eslint:recommended", | ||
"env": { | ||
"node": true, | ||
"es6": true | ||
}, | ||
"parserOptions": { | ||
"ecmaVersion": 2021 | ||
}, | ||
"rules": { | ||
|
||
} | ||
} |
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,2 @@ | ||
config.json | ||
.env |
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,14 @@ | ||
|
||
const { SlashCommandBuilder } = require('discord.js'); | ||
|
||
module.exports = { | ||
data: new SlashCommandBuilder() | ||
.setName('ping') | ||
.setDescription('Replies with Pong!'), | ||
async execute(interaction) { | ||
await interaction.reply('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,12 @@ | ||
const { SlashCommandBuilder } = require('discord.js'); | ||
|
||
module.exports = { | ||
data: new SlashCommandBuilder() | ||
.setName('user') | ||
.setDescription('Provides information about the user.'), | ||
async execute(interaction) { | ||
// interaction.user is the object representing the User who ran the command | ||
// interaction.member is the GuildMember object, which represents the user in the specific guild | ||
await interaction.reply(`This command was run by ${interaction.user.username}, who joined on ${interaction.member.joinedAt}.`); | ||
}, | ||
}; |
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,48 @@ | ||
const { REST, Routes } = require('discord.js'); | ||
const { clientId, guildId, token } = require('./config.json'); | ||
const fs = require('node:fs'); | ||
const path = require('node:path'); | ||
|
||
|
||
const commands = []; | ||
// Grab all the command folders from the commands directory you created earlier | ||
const foldersPath = path.join(__dirname, 'commands'); | ||
const commandFolders = fs.readdirSync(foldersPath); | ||
|
||
for (const folder of commandFolders) { | ||
// Grab all the command files from the commands directory you created earlier | ||
const commandsPath = path.join(foldersPath, folder); | ||
const commandFiles = fs.readdirSync(commandsPath).filter(file => file.endsWith('.js')); | ||
// Grab the SlashCommandBuilder#toJSON() output of each command's data for deployment | ||
for (const file of commandFiles) { | ||
const filePath = path.join(commandsPath, file); | ||
const command = require(filePath); | ||
if ('data' in command && 'execute' in command) { | ||
commands.push(command.data.toJSON()); | ||
} else { | ||
console.log(`[WARNING] The command at ${filePath} is missing a required "data" or "execute" property.`); | ||
} | ||
} | ||
} | ||
|
||
// Construct and prepare an instance of the REST module | ||
const rest = new REST().setToken(token); | ||
|
||
// and deploy your commands! | ||
(async () => { | ||
try { | ||
console.log(`Started refreshing ${commands.length} application (/) commands.`); | ||
|
||
// The put method is used to fully refresh all commands in the guild with the current set | ||
const data = await rest.put( | ||
Routes.applicationGuildCommands(clientId, guildId), | ||
{ body: commands }, | ||
); | ||
|
||
console.log(`Successfully reloaded ${data.length} application (/) commands.`); | ||
} catch (error) { | ||
// And of course, make sure you catch and log any errors! | ||
console.error(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,80 @@ | ||
// Require the necessary discord.js classes | ||
|
||
const fs = require('node:fs'); | ||
const path = require('node:path'); | ||
const { Client, Collection, Events, GatewayIntentBits } = require('discord.js'); | ||
const { token } = require('./config.json'); | ||
|
||
|
||
const client = new Client({ intents: [GatewayIntentBits.Guilds] }); | ||
|
||
client.commands = new Collection(); | ||
|
||
|
||
client.once(Events.ClientReady, readyClient => { | ||
console.log(`Ready! Logged in as ${readyClient.user.tag}`); | ||
}); | ||
|
||
client.login(token); | ||
|
||
const foldersPath = path.join(__dirname, 'commands'); | ||
const commandFolders = fs.readdirSync(foldersPath); | ||
|
||
for (const folder of commandFolders) { | ||
const commandsPath = path.join(foldersPath, folder); | ||
const commandFiles = fs.readdirSync(commandsPath).filter(file => file.endsWith('.js')); | ||
|
||
|
||
for (const file of commandFiles) { | ||
const filePath = path.join(commandsPath, file); | ||
const command = require(filePath); | ||
|
||
if ('data' in command && 'execute' in command) { | ||
client.commands.set(command.data.name, command); | ||
} else { | ||
console.log(`[WARNING] The command at ${filePath} is missing a required "data" or "execute" property.`); | ||
} | ||
} | ||
} | ||
|
||
|
||
client.on(Events.InteractionCreate, async interaction => { | ||
if (!interaction.isChatInputCommand()) return; | ||
|
||
const command = interaction.client.commands.get(interaction.commandName); | ||
|
||
if (!command) { | ||
console.error(`No command matching ${interaction.commandName} was found.`); | ||
return; | ||
} | ||
|
||
try { | ||
await command.execute(interaction); | ||
} catch (error) { | ||
console.error(error); | ||
if (interaction.replied || interaction.deferred) { | ||
await interaction.followUp({ content: 'There was an error while executing this command!', ephemeral: true }); | ||
} else { | ||
await interaction.reply({ content: 'There was an error while executing this command!', ephemeral: true }); | ||
} | ||
} | ||
}); | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.