Updating from v4 to v5

Changes in v5

+ docs
+ command classes
+ event classes
+ cooldown bypass for app owner/team
+ typings
+ gpayload
+ ginteraction
+ support ws (raw) events
+ normal arguments
+ inhibitors major change

- SlashCommand.
+ CommandType.

+ <interaction>.createdTimestamp
+ interaction.think() in cmd

- client.commands
- client.aliases
- client.events
+ client.gcommands
+ client.galiases
+ client.gevents

- guild.prefix
- guild.language
+ guild.getCommandPrefix()
+ guild.getLanguage()

+ setDisabled() to MessageSelectMenu
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30

Command

const { Command } = require("gcommands");
const wait = require("util").promisify(setTimeout);

module.exports = class extends Command {
  constructor(client) {
    super(client, {
      name: "ping",
      description: "Pongs the bot",
    });
  }

  async run(
    { client, interaction, member, message, guild, channel, respond, edit },
    args
  ) {
    interaction.think();
    await wait(2000);
    edit(`Pong! WS: **${client.ws.ping}ms**`);
  }
};
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

Event

const { Event } = require("gcommands");

module.exports = class extends Event {
  constructor(client) {
    super(client, {
      name: "message",
      once: false,
      ws: false,
    });
  }

  async run(client, message) {
    console.log(message);
  }
};
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

More Changes