reciple 1.1.0 → 1.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,8 @@
1
- import { Client, ClientEvents, ClientOptions, Interaction, Message } from 'discord.js';
1
+ import { ApplicationCommandDataResolvable, Client, ClientEvents, ClientOptions, Interaction, Message } from 'discord.js';
2
2
  import { Logger as LoggerConstructor } from 'fallout-utility';
3
3
  import { MessageCommandBuilder, RecipleMessageCommandExecute } from './builders/MessageCommandBuilder';
4
4
  import { InteractionCommandBuilder, RecipleInteractionCommandExecute } from './builders/InteractionCommandBuilder';
5
+ import { commandBuilders } from '../registerInteractionCommands';
5
6
  import { RecipleScript } from '../modules';
6
7
  import { Config } from './Config';
7
8
  export interface RecipleClientOptions extends ClientOptions {
@@ -22,6 +23,7 @@ export interface RecipleClientEvents extends ClientEvents {
22
23
  export declare class RecipleClient extends Client {
23
24
  config?: Config;
24
25
  commands: RecipleClientCommands;
26
+ otherApplicationCommandData: (commandBuilders | ApplicationCommandDataResolvable)[];
25
27
  modules: RecipleScript[];
26
28
  logger: LoggerConstructor;
27
29
  version: string;
@@ -22,6 +22,7 @@ class RecipleClient extends discord_js_1.Client {
22
22
  constructor(options) {
23
23
  super(options);
24
24
  this.commands = { MESSAGE_COMMANDS: {}, INTERACTION_COMMANDS: {} };
25
+ this.otherApplicationCommandData = [];
25
26
  this.modules = [];
26
27
  this.version = version_1.version;
27
28
  this.logger = (0, logger_1.logger)(!!options.config.fileLogging.stringifyLoggedJSON, !!options.config.fileLogging.debugmode);
@@ -63,7 +64,7 @@ class RecipleClient extends discord_js_1.Client {
63
64
  }
64
65
  this.logger.info(`${this.modules.length} modules loaded.`);
65
66
  if ((_a = this.config) === null || _a === void 0 ? void 0 : _a.commands.interactionCommand.registerCommands)
66
- yield (0, registerInteractionCommands_1.registerInteractionCommands)(this);
67
+ yield (0, registerInteractionCommands_1.registerInteractionCommands)(this, [...Object.values(this.commands.INTERACTION_COMMANDS), ...this.otherApplicationCommandData]);
67
68
  return this;
68
69
  });
69
70
  }
@@ -1,4 +1,4 @@
1
- import { ClientOptions, InteractionReplyOptions, MessageOptions, PermissionResolvable } from 'discord.js';
1
+ import { ClientOptions, MessagePayload, PermissionResolvable } from 'discord.js';
2
2
  export interface Config {
3
3
  token: string;
4
4
  prefix: string;
@@ -44,7 +44,7 @@ export interface Config {
44
44
  };
45
45
  client: ClientOptions;
46
46
  messages: {
47
- [key: string]: MessageOptions | InteractionReplyOptions | string;
47
+ [key: string]: MessagePayload | string;
48
48
  };
49
49
  modulesFolder: string;
50
50
  version?: string;
@@ -1,13 +1,7 @@
1
1
  import { Message, PermissionFlags } from 'discord.js';
2
2
  import { Command } from 'fallout-utility';
3
3
  import { RecipleClient } from '../Client';
4
- export interface CommandMessage extends Command {
5
- command?: string;
6
- args?: string[];
7
- raw?: string;
8
- prefix?: string;
9
- separator?: string;
10
- }
4
+ export declare type CommandMessage = Command;
11
5
  export interface RecipleMessageCommandExecute {
12
6
  message: Message;
13
7
  command: CommandMessage;
@@ -1,5 +1,6 @@
1
1
  import { InteractionCommandBuilder } from './classes/builders/InteractionCommandBuilder';
2
- import { SlashCommandBuilder } from '@discordjs/builders';
3
2
  import { RecipleClient } from "./classes/Client";
4
- import { ApplicationCommandData } from 'discord.js';
5
- export declare function registerInteractionCommands(client: RecipleClient, cmds?: (InteractionCommandBuilder | SlashCommandBuilder | ApplicationCommandData)[]): Promise<void>;
3
+ import { ApplicationCommandDataResolvable } from 'discord.js';
4
+ import { ContextMenuCommandBuilder, SlashCommandBuilder, SlashCommandSubcommandBuilder, SlashCommandOptionsOnlyBuilder, SlashCommandSubcommandGroupBuilder, SlashCommandSubcommandsOnlyBuilder } from '@discordjs/builders';
5
+ export declare type commandBuilders = InteractionCommandBuilder | ContextMenuCommandBuilder | SlashCommandBuilder | SlashCommandSubcommandBuilder | SlashCommandOptionsOnlyBuilder | SlashCommandSubcommandGroupBuilder | SlashCommandSubcommandsOnlyBuilder;
6
+ export declare function registerInteractionCommands(client: RecipleClient, cmds?: (commandBuilders | ApplicationCommandDataResolvable)[]): Promise<void>;
@@ -11,26 +11,26 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.registerInteractionCommands = void 0;
13
13
  function registerInteractionCommands(client, cmds) {
14
- var _a, _b, _c, _d;
14
+ var _a, _b, _c, _d, _e, _f;
15
15
  return __awaiter(this, void 0, void 0, function* () {
16
16
  const commands = (_a = Object.values(cmds !== null && cmds !== void 0 ? cmds : client.commands.INTERACTION_COMMANDS).map(c => {
17
17
  if (typeof c.toJSON !== 'undefined')
18
18
  return c.toJSON();
19
19
  return c;
20
20
  })) !== null && _a !== void 0 ? _a : [];
21
- if (!commands.length) {
21
+ if (!commands || !commands.length) {
22
22
  client.logger.warn('No interaction commands found.');
23
23
  return;
24
24
  }
25
25
  if (!((_b = client.config) === null || _b === void 0 ? void 0 : _b.commands.interactionCommand.guilds.length)) {
26
- yield ((_c = client.application) === null || _c === void 0 ? void 0 : _c.commands.set(commands).catch(e => client.logger.error(e)));
26
+ yield ((_d = (_c = client.application) === null || _c === void 0 ? void 0 : _c.commands.set(commands)) === null || _d === void 0 ? void 0 : _d.catch(e => client.logger.error(e)));
27
27
  client.logger.warn('No guilds were specified for interaction commands. Registered commands for all guilds.');
28
28
  }
29
29
  else {
30
30
  const guilds = typeof client.config.commands.interactionCommand.guilds === 'string' ? [client.config.commands.interactionCommand.guilds] : client.config.commands.interactionCommand.guilds;
31
31
  client.logger.warn(`Registering ${commands.length} interaction commands for ${guilds.length} guild(s).`);
32
32
  for (const guild of guilds) {
33
- yield ((_d = client.application) === null || _d === void 0 ? void 0 : _d.commands.set(commands, guild).catch(e => client.logger.error(e)));
33
+ yield ((_f = (_e = client.application) === null || _e === void 0 ? void 0 : _e.commands.set(commands, guild)) === null || _f === void 0 ? void 0 : _f.catch(e => client.logger.error(e)));
34
34
  client.logger.warn(`Registered ${commands.length} interaction commands for ${guild}.`);
35
35
  }
36
36
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "reciple",
3
- "version": "1.1.0",
3
+ "version": "1.1.3",
4
4
  "description": "A Discord.js bot",
5
5
  "author": "FalloutStudios",
6
6
  "license": "GPL-3.0",
@@ -19,19 +19,19 @@
19
19
  "clean": "rimraf bin",
20
20
  "compile": "yarn clean && tsc",
21
21
  "build": "yarn compile && npm un reciple -g && npm i ./ -g",
22
- "build:publish": "yarn run build && npm publish",
22
+ "build:publish": "yarn run build && yarn publish",
23
23
  "test": "cd test && reciple",
24
24
  "test:compile": "yarn run build && yarn test:run"
25
25
  },
26
26
  "dependencies": {
27
27
  "commander": "^9.2.0",
28
- "discord.js": "^13.6.0",
29
- "dotenv": "^16.0.0",
30
- "fallout-utility": "^1.3.13",
31
- "yaml": "^2.0.1"
28
+ "discord.js": "^13.7.0",
29
+ "dotenv": "^16.0.1",
30
+ "fallout-utility": "^1.3.14",
31
+ "yaml": "^2.1.0"
32
32
  },
33
33
  "devDependencies": {
34
- "@types/node": "^17.0.24",
35
- "typescript": "^4.6.3"
34
+ "@types/node": "^17.0.33",
35
+ "typescript": "^4.6.4"
36
36
  }
37
37
  }
@@ -1,41 +1,69 @@
1
+ # Your bot token here
2
+ # To use env variable as a token just do it like this env:TOKEN_ENV
1
3
  token: TOKEN
4
+
5
+ # Message command prefix
2
6
  prefix: '!'
3
7
 
8
+
9
+ # Commands options
4
10
  commands:
5
11
  messageCommand:
12
+ # enable message commands
6
13
  enabled: true
14
+ # reply when an error occured
7
15
  replyOnError: false
16
+ # command argument separator
8
17
  commandArgumentSeparator: ' '
9
18
  interactionCommand:
19
+ # enable interaction commands
10
20
  enabled: true
21
+ # reply when an error occured
11
22
  replyOnError: false
23
+ # register interaction commands on bot ready
12
24
  registerCommands: true
25
+ # register commands to specific guild(s) empty to make it global
13
26
  guilds: []
14
27
 
28
+
29
+ # Commands permissions
15
30
  permissions:
16
31
  messageCommands:
32
+ # enable command permissions
17
33
  enabled: true
18
34
  commands:
19
35
  - command: 'stop'
20
36
  permissions: ['ADMINISTRATOR']
21
37
  interactionCommands:
38
+ # enable command permissions
22
39
  enabled: true
23
40
  commands:
24
41
  - command: 'stop'
25
42
  permissions: ['ADMINISTRATOR']
26
43
 
27
44
 
45
+ # Ignored channel IDs
28
46
  ignoredChannels:
47
+ # enable ignored channels
29
48
  enabled: false
49
+ # convert to only allowed channels
30
50
  convertToAllowList: false
51
+ # channel IDs
31
52
  channels: []
32
53
 
54
+
55
+ # Logger options
33
56
  fileLogging:
57
+ # enable console output to file
34
58
  enabled: true
59
+ # enable debug mode
35
60
  debugmode: false
61
+ # stringify logged JSONs
36
62
  stringifyLoggedJSON: false
63
+ # log file path
37
64
  logFilePath: './logs/latest.log'
38
65
 
66
+ # Client options
39
67
  client:
40
68
  intents:
41
69
  - 'GUILDS'
@@ -45,6 +73,7 @@ client:
45
73
  - 'GUILD_MESSAGES'
46
74
  - 'GUILD_MESSAGE_REACTIONS'
47
75
 
76
+ # Bot replies
48
77
  messages:
49
78
  notEnoughArguments: 'Not enough arguments.'
50
79
  noPermissions:
@@ -54,6 +83,20 @@ messages:
54
83
  content: 'An error occurred.'
55
84
  ephemeral: true
56
85
 
86
+
87
+ ###################################################
88
+ # #
89
+ # ##### ##### # # ### ##### #### #
90
+ # # # # # # # # # # # # #
91
+ # # # ##### # # # # ### ### #### #
92
+ # # # # # # # # # # # # #
93
+ # ### # # # # ### ##### # # #
94
+ # #
95
+ ###################################################
96
+ ## Modifying these values below can cause errors ##
97
+
98
+ # Modules folder
57
99
  modulesFolder: 'modules'
58
100
 
59
- version: VERSION
101
+ # Current version
102
+ version: VERSION