Fix stuff up and add .env to .gitignore
This commit is contained in:
parent
e743f70128
commit
e66197568e
4976 changed files with 539387 additions and 6 deletions
53
node_modules/load-slash-commands/README.md
generated
vendored
Normal file
53
node_modules/load-slash-commands/README.md
generated
vendored
Normal file
|
@ -0,0 +1,53 @@
|
|||
# load-slash-commands
|
||||
This module is a module for quickly loading commands from main file without needing any mess in the root directory.
|
||||
|
||||
## Usage
|
||||
Using this module is pretty simple, here is an example using Discord.JS:
|
||||
```js
|
||||
const registerCommands = require("register-slash-commands");
|
||||
const {Client, Intents} = require("discord.js");
|
||||
const client = new Client({intents: [Intents.flags.GUILDS]});
|
||||
|
||||
const commands = [
|
||||
{
|
||||
name: "ping",
|
||||
description: "Sends the client's WebSocket latency."
|
||||
}
|
||||
];
|
||||
client.on("ready", () => {
|
||||
registerCommands(client, commands);
|
||||
});
|
||||
|
||||
client.on("interactionCreate", (int) => {
|
||||
if(!int.isCommand()) return;
|
||||
if(int.commandName == "ping"){
|
||||
int.reply(`My latency is ${client.ws.ping} ms.`);
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
Or if you want to use guild specific commands:
|
||||
|
||||
```js
|
||||
const registerCommands = require("register-slash-commands");
|
||||
const {Client, Intents} = require("discord.js");
|
||||
const client = new Client({intents: [Intents.flags.GUILDS]});
|
||||
const guildId = "846496831533088768";
|
||||
|
||||
const commands = [
|
||||
{
|
||||
name: "ping",
|
||||
description: "Sends the client's WebSocket latency."
|
||||
}
|
||||
];
|
||||
client.on("ready", () => {
|
||||
registerCommands(client, commands, guildId);
|
||||
});
|
||||
|
||||
client.on("interactionCreate", (int) => {
|
||||
if(!int.isCommand()) return;
|
||||
if(int.commandName == "ping"){
|
||||
int.reply(`My latency is ${client.ws.ping} ms.`);
|
||||
}
|
||||
});
|
||||
```
|
19
node_modules/load-slash-commands/index.js
generated
vendored
Normal file
19
node_modules/load-slash-commands/index.js
generated
vendored
Normal file
|
@ -0,0 +1,19 @@
|
|||
const { REST } = require('@discordjs/rest');
|
||||
const { Routes } = require('discord-api-types/v9');
|
||||
|
||||
module.exports = async function(client, commands, guildId){
|
||||
const rest = new REST({ version: '9' }).setToken(client.token);
|
||||
try {
|
||||
var userId = client.id || client.user.id;
|
||||
var route = !!guildId ? Routes.applicationGuildCommands(userId, guildId) : Routes.applicationCommands(client.user.id);
|
||||
await rest.put(
|
||||
route,
|
||||
{ body: commands },
|
||||
);
|
||||
return true;
|
||||
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
return false
|
||||
}
|
||||
}
|
42
node_modules/load-slash-commands/package.json
generated
vendored
Normal file
42
node_modules/load-slash-commands/package.json
generated
vendored
Normal file
|
@ -0,0 +1,42 @@
|
|||
{
|
||||
"_from": "load-slash-commands",
|
||||
"_id": "load-slash-commands@2.5.6",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-MG66MVxTuiAszkLfJewVzYbkwbO1ELXkv4vUZ7AC7TKeVPIKqGuE6/0FdZqPo2+n22S8pr2a7y1+zQdgrvJkag==",
|
||||
"_location": "/load-slash-commands",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "tag",
|
||||
"registry": true,
|
||||
"raw": "load-slash-commands",
|
||||
"name": "load-slash-commands",
|
||||
"escapedName": "load-slash-commands",
|
||||
"rawSpec": "",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "latest"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"#USER",
|
||||
"/"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/load-slash-commands/-/load-slash-commands-2.5.6.tgz",
|
||||
"_shasum": "d7b50330c07402902890ed4fbb2cfa3327eb6c4d",
|
||||
"_spec": "load-slash-commands",
|
||||
"_where": "/home/runner/EcoBotv2",
|
||||
"author": "",
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"@discordjs/rest": "^0.1.0-canary.0",
|
||||
"discord-api-types": "^0.24.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "This module is a module for quickly loading commands from main file without needing any mess in the root directory.",
|
||||
"keywords": [],
|
||||
"license": "ISC",
|
||||
"main": "index.js",
|
||||
"name": "load-slash-commands",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"version": "2.5.6"
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue