Socket
Socket
Sign inDemoInstall

goated.js

Package Overview
Dependencies
23
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.1.0 to 1.1.1

9

classes/client.js

@@ -15,2 +15,3 @@ const discord = require("discord.js");

* @param {string} options.commandsPath the path for commands
* @param {Array<string>} options.commandsFilter any command names you don't want to be ran by the command handler
*/

@@ -24,2 +25,3 @@ constructor(options) {

this.path = options.commandsPath;
this.filter = options.commandsFilter;

@@ -49,2 +51,9 @@ /**

if (
this.filter.find(
(commandName) => commandName === interaction.commandName
)
)
return;
try {

@@ -51,0 +60,0 @@ let command = require(`${this.path}/${interaction.commandName}`);

2

package.json

@@ -10,3 +10,3 @@ {

"description": "a minimal discord API wrapper",
"version": "1.1.0",
"version": "1.1.1",
"main": "index.js",

@@ -13,0 +13,0 @@ "devDependencies": {},

@@ -8,3 +8,4 @@ # goated

- unintrusive
- automatically reads from .env with Client#env/1
- automatically reads from .env
- automatic command handling
- command registration

@@ -15,1 +16,44 @@

When making discord-trolling and using discord.js, I found that their environments quickly became too bloated and complicated. That's why I'm making goated, to simplify the ecosystem even more.
## usage
To use goated.js, start with the following code:
```js
const { Client, Intents } = require("goated.js");
const client = new Client({
intents: [Intents.Guilds], // bot intents
commandsPath: `${__dirname}/commands` // path to folder with commands in it
});
client.env("./.env"); // login and read TOKEN and all other environment variables from .env
client.createCommand([
{
name: "test-command",
description: "A test command",
options: [
{
name: "test-option",
description: "A test option",
required: true,
type: Client.types.STRING,
}
],
}
], {
id: process.env.APPLICATION_ID, // the bot ID in
token: process.env.TOKEN, // the bot token
guildId: process.env.GUILD_ID, // optional for registering guild-specific commands
});
```
Then, create a file with the same command name in the commands directory:
```js
module.exports.run = (interaction) => { // the interaction parameter is from the discord.js library
const option = interaction.options.getString("test-option");
interaction.reply(`You provided the option: ${option}`)';
};
```
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc