@spatulox/simplediscordbot 1.0.6 → 1.0.7

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.
Files changed (73) hide show
  1. package/.env.example +2 -0
  2. package/LICENSE.md +21 -21
  3. package/README.md +44 -44
  4. package/dist/bot/BotMessage.js +54 -28
  5. package/dist/index.js +6 -2
  6. package/dist/manager/builder/SendableComponentBuilder.js +62 -0
  7. package/dist/manager/direct/UserManager.js +16 -5
  8. package/dist/manager/guild/ChannelManager/GuildMessageManager.js +12 -4
  9. package/dist/manager/guild/ChannelManager/ThreadChannelManager.js +15 -0
  10. package/dist/manager/interactions/InteractionManager.js +68 -0
  11. package/dist/manager/{handlers/builder → interactions}/ModalManager.js +2 -2
  12. package/dist/manager/interactions/SelectMenuManager.js +123 -0
  13. package/dist/manager/messages/WebhookManager.js +8 -5
  14. package/package.json +36 -42
  15. package/dist/bot/Bot.d.ts +0 -32
  16. package/dist/bot/BotEnv.d.ts +0 -5
  17. package/dist/bot/BotLog.d.ts +0 -51
  18. package/dist/bot/BotMessage.d.ts +0 -16
  19. package/dist/cli/BaseCLI.d.ts +0 -25
  20. package/dist/cli/BaseCLI.js +0 -166
  21. package/dist/cli/GenerationCLI/ContextMenuGeneratorCLI.d.ts +0 -6
  22. package/dist/cli/GenerationCLI/ContextMenuGeneratorCLI.js +0 -109
  23. package/dist/cli/GenerationCLI/GenerationCLI.d.ts +0 -6
  24. package/dist/cli/GenerationCLI/GenerationCLI.js +0 -25
  25. package/dist/cli/GenerationCLI/ModalGeneratorCLI.d.ts +0 -44
  26. package/dist/cli/GenerationCLI/ModalGeneratorCLI.js +0 -166
  27. package/dist/cli/GenerationCLI/SlashCommandsGeneratorCLI.d.ts +0 -12
  28. package/dist/cli/GenerationCLI/SlashCommandsGeneratorCLI.js +0 -221
  29. package/dist/cli/GuildListManager.d.ts +0 -24
  30. package/dist/cli/GuildListManager.js +0 -61
  31. package/dist/cli/InteractionCLI/InteractionCLI.d.ts +0 -8
  32. package/dist/cli/InteractionCLI/InteractionCLI.js +0 -30
  33. package/dist/cli/InteractionCLI/InteractionCLIManager.d.ts +0 -17
  34. package/dist/cli/InteractionCLI/InteractionCLIManager.js +0 -80
  35. package/dist/cli/MainCLI.d.ts +0 -12
  36. package/dist/cli/MainCLI.js +0 -32
  37. package/dist/cli/type/ContextMenuConfig.d.ts +0 -12
  38. package/dist/cli/type/ContextMenuConfig.js +0 -2
  39. package/dist/cli/type/InteractionType.d.ts +0 -9
  40. package/dist/cli/type/InteractionType.js +0 -14
  41. package/dist/cli/type/SlashCommandConfig.d.ts +0 -43
  42. package/dist/cli/type/SlashCommandConfig.js +0 -2
  43. package/dist/index.d.ts +0 -14
  44. package/dist/manager/FileManager.d.ts +0 -36
  45. package/dist/manager/direct/UserManager.d.ts +0 -23
  46. package/dist/manager/guild/ChannelManager/ForumChannelManager.d.ts +0 -8
  47. package/dist/manager/guild/ChannelManager/GuildChannelList.d.ts +0 -16
  48. package/dist/manager/guild/ChannelManager/GuildChannelManager.d.ts +0 -17
  49. package/dist/manager/guild/ChannelManager/GuildMessageManager.d.ts +0 -21
  50. package/dist/manager/guild/ChannelManager/GuildTextChannelManager.d.ts +0 -8
  51. package/dist/manager/guild/ChannelManager/GuildVoiceChannelManager.d.ts +0 -8
  52. package/dist/manager/guild/ChannelManager/NewsChannelManager.d.ts +0 -8
  53. package/dist/manager/guild/ChannelManager/StageChannelManager.d.ts +0 -8
  54. package/dist/manager/guild/ChannelManager/ThreadChannelManager.d.ts +0 -8
  55. package/dist/manager/guild/GuildManager.d.ts +0 -30
  56. package/dist/manager/guild/GuildUserManager.d.ts +0 -46
  57. package/dist/manager/guild/InviteManager.d.ts +0 -20
  58. package/dist/manager/guild/InviteManager_old.d.ts +0 -23
  59. package/dist/manager/guild/RoleManager.d.ts +0 -23
  60. package/dist/manager/handlers/builder/ModalManager.d.ts +0 -22
  61. package/dist/manager/handlers/interactions/BaseInteractionManager.d.ts +0 -44
  62. package/dist/manager/handlers/interactions/BaseInteractionManager.js +0 -338
  63. package/dist/manager/handlers/interactions/InteractionManager.d.ts +0 -14
  64. package/dist/manager/handlers/interactions/InteractionManager.js +0 -29
  65. package/dist/manager/messages/EmbedManager.d.ts +0 -83
  66. package/dist/manager/messages/ReactionManager.d.ts +0 -25
  67. package/dist/manager/messages/WebhookManager.d.ts +0 -29
  68. package/dist/type/FolderName.d.ts +0 -5
  69. package/dist/utils/DiscordRegex.d.ts +0 -65
  70. package/dist/utils/Log.d.ts +0 -8
  71. package/dist/utils/SimpleMutex.d.ts +0 -15
  72. package/dist/utils/network/InternetChecker.d.ts +0 -9
  73. package/dist/utils/times/UnitTime.d.ts +0 -186
@@ -5,6 +5,7 @@ const discord_js_1 = require("discord.js");
5
5
  const EmbedManager_1 = require("./EmbedManager");
6
6
  const Log_1 = require("../../utils/Log");
7
7
  const Bot_1 = require("../../bot/Bot");
8
+ const SendableComponentBuilder_1 = require("../builder/SendableComponentBuilder");
8
9
  class WebhookManager {
9
10
  constructor(channel, name = Bot_1.Bot.config.botName || "", avatarURL) {
10
11
  this.channel = channel;
@@ -39,14 +40,16 @@ class WebhookManager {
39
40
  throw error;
40
41
  }
41
42
  }
42
- /**
43
- * Send message/text/embed - EmbedBuilder NATIVE !
44
- */
45
43
  async send(content) {
46
44
  const webhook = await this.getWebhook();
47
45
  const options = {};
48
- if (content instanceof discord_js_1.EmbedBuilder) {
49
- options.embeds = [content];
46
+ if (SendableComponentBuilder_1.SendableComponentBuilder.isSendableComponent(content)) {
47
+ const t = SendableComponentBuilder_1.SendableComponentBuilder.buildMessage(content);
48
+ options.embeds = t.embeds;
49
+ options.components = t.components;
50
+ }
51
+ else if (typeof content == 'string') {
52
+ options.content = content;
50
53
  }
51
54
  else if (typeof content === 'object') {
52
55
  Object.assign(options, content);
package/package.json CHANGED
@@ -1,42 +1,36 @@
1
- {
2
- "name": "@spatulox/simplediscordbot",
3
- "version": "1.0.6",
4
- "author": "Spatulox",
5
- "description": "Simple discord bot framework to set up a bot under 30 secondes",
6
- "exports": "./dist/index.js",
7
- "types": "./dist/index.d.ts",
8
- "files": ["dist"],
9
- "bin": {
10
- "sdb": "dist/cli/MainCLI.js"
11
- },
12
- "scripts": {
13
- "build": "tsc",
14
- "dev": "nodemon --exec tsx src/test/index.ts",
15
- "cli": "node dist/cli/MainCLI.js"
16
- },
17
- "license": "MIT",
18
- "dependencies": {
19
- "discord.js": "^14.25.1",
20
- "dotenv": "^17.2.0",
21
- "fs": "^0.0.1-security"
22
- },
23
- "devDependencies": {
24
- "@types/node": "^22.14.0",
25
- "@types/node-schedule": "^2.1.7",
26
- "nodemon": "^3.1.9",
27
- "tsx": "^4.20.3",
28
- "typescript": "^5.9.3"
29
- },
30
- "keywords": [
31
- "discord",
32
- "framework",
33
- "bot",
34
- "client",
35
- "discordjs",
36
- "discord.js",
37
- "node"
38
- ],
39
- "bugs": {
40
- "url": "https://github.com/Spatulox/SimpleDiscordBot/issues"
41
- }
42
- }
1
+ {
2
+ "name": "@spatulox/simplediscordbot",
3
+ "version": "1.0.7",
4
+ "author": "Spatulox",
5
+ "description": "Simple discord bot framework to set up a bot under 30 secondes",
6
+ "main": "./dist/index.js",
7
+ "scripts": {
8
+ "build": "tsc",
9
+ "dev": "nodemon --exec tsx src/test/index.ts"
10
+ },
11
+ "license": "MIT",
12
+ "dependencies": {
13
+ "@spatulox/discord-interaction-manager": "^1.0.8",
14
+ "discord.js": "^14.25.1"
15
+ },
16
+ "devDependencies": {
17
+ "@types/node": "^22.14.0",
18
+ "@types/node-schedule": "^2.1.7",
19
+ "dotenv": "^17.2.4",
20
+ "nodemon": "^3.1.9",
21
+ "tsx": "^4.20.3",
22
+ "typescript": "^5.9.3"
23
+ },
24
+ "keywords": [
25
+ "discord",
26
+ "framework",
27
+ "bot",
28
+ "client",
29
+ "discordjs",
30
+ "discord.js",
31
+ "node"
32
+ ],
33
+ "bugs": {
34
+ "url": "https://github.com/Spatulox/SimpleDiscordBot/issues"
35
+ }
36
+ }
package/dist/bot/Bot.d.ts DELETED
@@ -1,32 +0,0 @@
1
- import { Client, ActivityType } from 'discord.js';
2
- import { BotLog, ConfigLog } from "./BotLog";
3
- import { EmbedColor } from "../manager/messages/EmbedManager";
4
- import { BotMessage } from "./BotMessage";
5
- export type BotConfig = {
6
- botIconUrl?: string;
7
- defaultEmbedColor?: number | EmbedColor;
8
- botName?: string;
9
- log?: ConfigLog;
10
- };
11
- export type InternalBotConfig = {
12
- clientId: string;
13
- } & BotConfig;
14
- export type RandomBotActivity = {
15
- type: ActivityType;
16
- message: string;
17
- }[];
18
- export declare class Bot {
19
- static _client: Client;
20
- static readonly log: typeof BotLog;
21
- static readonly message: BotMessage;
22
- private static criticConfig;
23
- private static _config;
24
- get config(): InternalBotConfig;
25
- get client(): Client;
26
- static get client(): Client;
27
- static get config(): InternalBotConfig;
28
- constructor(client: Client, config: BotConfig);
29
- login(maxTries?: number): Promise<boolean>;
30
- static setActivity(message: string, type: ActivityType): void;
31
- static setRandomActivity(randomActivity: RandomBotActivity, intervalMs?: number | null): void;
32
- }
@@ -1,5 +0,0 @@
1
- export declare const BotEnv: {
2
- readonly token: string;
3
- readonly dev: boolean;
4
- readonly clientId: string;
5
- };
@@ -1,51 +0,0 @@
1
- import { EmbedBuilder, Message } from 'discord.js';
2
- export type ConfigLog = {
3
- logChannelId: string;
4
- errorChannelId: string;
5
- info: {
6
- console: boolean;
7
- discord: boolean;
8
- };
9
- error: {
10
- console: boolean;
11
- discord: boolean;
12
- };
13
- warn: {
14
- console: boolean;
15
- discord: boolean;
16
- };
17
- debug: {
18
- console: boolean;
19
- discord: boolean;
20
- };
21
- };
22
- export declare class BotLog {
23
- private static logChannel;
24
- private static errorChannel;
25
- constructor();
26
- static config(): ConfigLog | undefined;
27
- /**
28
- * Initialize Discord logging channels and update Bot.log references
29
- */
30
- static initDiscordLogging(): Promise<void>;
31
- /**
32
- * Send content to specific Discord channel
33
- */
34
- private static _sendToChannel;
35
- /**
36
- * Send INFO log - TEXT or EMBED ! Respecte config.log.info
37
- */
38
- static sendLog(content: string | EmbedBuilder): Promise<Message | void>;
39
- /**
40
- * Send ERROR log - TEXT or EMBED ! Respecte config.log.error
41
- */
42
- static sendError(content: string | EmbedBuilder): Promise<Message | void>;
43
- /**
44
- * Send WARNING log - TEXT or EMBED ! Respecte config.log.warn
45
- */
46
- static sendWarn(content: string | EmbedBuilder): Promise<Message | void>;
47
- /**
48
- * Send DEBUG log - TEXT or EMBED ! Respecte config.log.debug
49
- */
50
- static sendDebug(content: string | EmbedBuilder): Promise<Message | void>;
51
- }
@@ -1,16 +0,0 @@
1
- import { TextChannel, DMChannel, ThreadChannel, EmbedBuilder, Message, User, GuildMember } from 'discord.js';
2
- export declare class BotMessage {
3
- /**
4
- * Send message to any text-based channel
5
- */
6
- send(channel: TextChannel | DMChannel | ThreadChannel | string, content: string | EmbedBuilder): Promise<Message | boolean>;
7
- sendDM(user: User | GuildMember | string, content: string | EmbedBuilder): Promise<Message | boolean>;
8
- /**
9
- * Quick success message
10
- */
11
- success(channel: TextChannel | DMChannel | ThreadChannel | User | GuildMember, message: string): Promise<Message | boolean>;
12
- /**
13
- * Quick error message
14
- */
15
- error(channel: TextChannel | DMChannel | ThreadChannel | User | GuildMember, message: string): Promise<Message | boolean>;
16
- }
@@ -1,25 +0,0 @@
1
- #!/usr/bin/env node
2
- import readline from "readline";
3
- export type MenuSelectionCLI = {
4
- label: string;
5
- action: () => BaseCLI | Promise<any> | null;
6
- }[];
7
- /**
8
- * --- BaseCLI ---
9
- */
10
- export declare abstract class BaseCLI {
11
- protected parent?: BaseCLI | undefined;
12
- private static _rl;
13
- protected get rl(): readline.Interface;
14
- constructor(parent?: BaseCLI | undefined);
15
- protected abstract readonly menuSelection: MenuSelectionCLI;
16
- protected abstract execute(): Promise<void>;
17
- protected getTitle(): string;
18
- protected showMainMenu(): Promise<void>;
19
- protected prompt(question: string): Promise<string>;
20
- protected requireInput(message: string, validator?: (val: string) => boolean, canBeEmpty?: boolean): Promise<string>;
21
- protected yesNoInput(message: string): Promise<boolean>;
22
- protected showHelp(): Promise<void>;
23
- protected goBack(): Promise<void>;
24
- protected saveFile<T>(folderName: string, filename: string, data: T): Promise<void>;
25
- }
@@ -1,166 +0,0 @@
1
- #!/usr/bin/env node
2
- "use strict";
3
- var __importDefault = (this && this.__importDefault) || function (mod) {
4
- return (mod && mod.__esModule) ? mod : { "default": mod };
5
- };
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.BaseCLI = void 0;
8
- const readline_1 = __importDefault(require("readline"));
9
- const FileManager_1 = require("../manager/FileManager");
10
- /**
11
- * --- BaseCLI ---
12
- */
13
- class BaseCLI {
14
- get rl() {
15
- if (!BaseCLI._rl) {
16
- BaseCLI._rl = readline_1.default.createInterface({
17
- input: process.stdin,
18
- output: process.stdout
19
- });
20
- }
21
- return BaseCLI._rl;
22
- }
23
- constructor(parent) {
24
- this.parent = parent;
25
- }
26
- getTitle() {
27
- return "BaseCLI";
28
- }
29
- async showMainMenu() {
30
- console.clear();
31
- console.log(this.getTitle());
32
- console.log('═'.repeat(40));
33
- this.menuSelection.forEach((option, index) => {
34
- console.log(`${index + 1}. ${option.label}`);
35
- });
36
- console.log('═'.repeat(40));
37
- const choice = await this.prompt('Choose an option: ');
38
- if (choice == "exit") {
39
- return this.goBack();
40
- }
41
- const choiceIndex = parseInt(choice) - 1;
42
- if (choiceIndex >= 0 && choiceIndex < this.menuSelection.length) {
43
- const option = this.menuSelection[choiceIndex];
44
- if (!option) {
45
- console.log("Invalid Choice");
46
- return this.showMainMenu();
47
- }
48
- const result = await option.action();
49
- if (result instanceof BaseCLI) {
50
- if (result == this) {
51
- await this.execute();
52
- }
53
- else {
54
- return await result.showMainMenu();
55
- }
56
- }
57
- }
58
- await this.prompt('Press Enter to continue...');
59
- return this.showMainMenu();
60
- }
61
- async prompt(question) {
62
- return new Promise(resolve => this.rl.question(question, resolve));
63
- }
64
- async requireInput(message, validator, canBeEmpty = false) {
65
- while (true) {
66
- const value = (await this.prompt(message));
67
- if (!value && !canBeEmpty) {
68
- console.log("âš ī¸ This field is required. Please enter a value.");
69
- continue;
70
- }
71
- if (validator && !validator(value)) {
72
- console.log("âš ī¸ Invalid input. Try again.");
73
- continue;
74
- }
75
- return value;
76
- }
77
- }
78
- async yesNoInput(message) {
79
- while (true) {
80
- const value = (await this.prompt(message));
81
- if (!value) {
82
- console.log("âš ī¸ This field is required. Please enter a value.");
83
- continue;
84
- }
85
- if (!["y", "n", "yes", "no"].includes(value.toLowerCase())) {
86
- console.log("âš ī¸ Invalid input. Try again.");
87
- continue;
88
- }
89
- return value == "y" || value == "yes";
90
- }
91
- }
92
- async showHelp() {
93
- console.clear();
94
- console.log('');
95
- console.log('||| HELP - Discord Bot Command Manager CLI |||');
96
- console.log('');
97
- console.log('🔗 Wiki: https://github.com/Spatulox/SimpleDiscordBot/wiki');
98
- console.log('═'.repeat(80));
99
- console.log('🤖 What it does:');
100
- console.log(' â€ĸ Manage your Discord interactions (slash commands & context menus) via an interactive CLI');
101
- console.log(' â€ĸ Let you deploy/update/delete any interaction');
102
- console.log(' â€ĸ Let you generate an interaction files');
103
- console.log('');
104
- console.log('How you need to save your interaction files');
105
- console.log('📁 Folder Structure:');
106
- console.log(' ├── handlers/ ← In the root folder of your project');
107
- console.log(' │ ├── commands/ ← Slash Commands (type 1)');
108
- console.log(' │ └── context_menu/ ← Context Menus (type 2/3)');
109
- console.log('');
110
- console.log('đŸŽ¯ Features:');
111
- console.log(' 📊 1. List Remote → Show deployed commands on Discord');
112
- console.log(' 🚀 2. Deploy Local → Deploy local JSON files → Discord');
113
- console.log(' 🔄 3. Update Remote → Update Discord commands based on local JSON file');
114
- console.log(' đŸ—‘ī¸ 4. Delete Remote → Remove Discord commands based on local JSON file');
115
- console.log('');
116
- console.log('🎮 Selection:');
117
- console.log(' â€ĸ Numbered lists appear after the interaction list');
118
- console.log(' â€ĸ Enter: "1,3,5" or "all" to select which interaction you want to apply the action');
119
- console.log('');
120
- console.log('🔗 Wiki: https://github.com/Spatulox/SimpleDiscordBot/wiki');
121
- console.log('🔗 Bugs: https://github.com/Spatulox/SimpleDiscordBot/issues');
122
- console.log('═'.repeat(80));
123
- await this.prompt('Press Enter to continue...');
124
- if (this.parent) {
125
- await this.parent.showMainMenu();
126
- }
127
- else {
128
- await this.showMainMenu();
129
- }
130
- }
131
- async goBack() {
132
- if (this.parent) {
133
- return this.parent?.showMainMenu();
134
- }
135
- return this.execute(); // Fallback for MainCLI
136
- }
137
- async saveFile(folderName, filename, data) {
138
- let finalFilename = filename;
139
- if (await FileManager_1.FileManager.readJsonFile(`./handlers/${folderName}/${filename}`)) {
140
- if (!await this.yesNoInput(`"${finalFilename}" already exists. Overwrite? (y/n): `)) {
141
- const timestamp = Date.now();
142
- finalFilename = `${filename.replace('.json', '')}-${timestamp}`;
143
- console.log(`📝 New filename: ${finalFilename}`);
144
- }
145
- }
146
- // 2. Preview + Confirmation
147
- console.clear();
148
- console.log("✨ Final JSON preview:");
149
- console.log(JSON.stringify(data, null, 2));
150
- if (!await this.yesNoInput("\nSave this file? (y/n): ")) {
151
- console.log("Cancelled");
152
- await this.prompt('Press Enter to continue...');
153
- return this.showMainMenu();
154
- }
155
- try {
156
- await FileManager_1.FileManager.writeJsonFile(`./handlers/${folderName}`, finalFilename, data, false);
157
- console.log(`File saved: ./handlers/${folderName}/${finalFilename}`);
158
- }
159
- catch (error) {
160
- console.error("Error saving file:", error);
161
- }
162
- return;
163
- }
164
- }
165
- exports.BaseCLI = BaseCLI;
166
- BaseCLI._rl = null;
@@ -1,6 +0,0 @@
1
- import { BaseCLI, MenuSelectionCLI } from "../BaseCLI";
2
- export declare class ContextMenuGeneratorCLI extends BaseCLI {
3
- protected getTitle(): string;
4
- protected readonly menuSelection: MenuSelectionCLI;
5
- protected execute(): Promise<void>;
6
- }
@@ -1,109 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ContextMenuGeneratorCLI = void 0;
4
- const BaseCLI_1 = require("../BaseCLI");
5
- const discord_js_1 = require("discord.js");
6
- const DiscordRegex_1 = require("../../utils/DiscordRegex");
7
- const FolderName_1 = require("../../type/FolderName");
8
- class ContextMenuGeneratorCLI extends BaseCLI_1.BaseCLI {
9
- constructor() {
10
- super(...arguments);
11
- this.menuSelection = [
12
- { label: "Generate Context Menu", action: () => this },
13
- { label: "Back", action: () => this.goBack() },
14
- ];
15
- }
16
- getTitle() {
17
- return "📝 Context Menu JSON Generator";
18
- }
19
- async execute() {
20
- const config = { dm_permission: false, integration_types: [], name: "", type: 2 };
21
- // 1. Context Menu Name
22
- console.clear();
23
- console.log("👤 1/10 - Name");
24
- config.name = await this.requireInput("Enter Context Menu name (ex: 'Example context Menu'): ");
25
- // 2. Type (2=User, 3=Message)
26
- console.clear();
27
- console.log("🔧 2/10 - Type");
28
- console.log("2 => Context Menu for users");
29
- console.log("3 => Context Menu for messages");
30
- config.type = parseInt(await this.requireInput("Enter type (2 or 3): ", val => ["2", "3"].includes(val)));
31
- // 3. Member Permissions
32
- console.clear();
33
- console.log("🔐 3/10 - Permissions");
34
- console.log("📋 Valid permissions:\n", Object.keys(discord_js_1.PermissionFlagsBits).join(', '));
35
- const permsInput = await this.requireInput("Default member permissions (comma separated, or 'none'): ", (val) => {
36
- if (!val || val.toLowerCase() === "none" || val == '')
37
- return true;
38
- const permissions = val.split(",").map(p => p.trim());
39
- const invalidPerms = permissions.filter(perm => !(perm in discord_js_1.PermissionFlagsBits));
40
- if (invalidPerms.length > 0) {
41
- console.log(`❌ Invalid permissions: ${invalidPerms.join(', ')}`);
42
- console.log("📋 Valid permissions:\n", Object.keys(discord_js_1.PermissionFlagsBits).join(', '));
43
- return false;
44
- }
45
- return true;
46
- }, true);
47
- if (permsInput !== '' && permsInput.toLowerCase() !== "none") {
48
- config.default_member_permissions = permsInput.split(",")
49
- .map(p => p.trim());
50
- }
51
- // 4. DM Permission
52
- console.clear();
53
- console.log("đŸ’Ŧ 4/10 - DM Permission");
54
- config.dm_permission = (await this.yesNoInput("Allow in DMs? (y/n): "));
55
- // 5. Integration Types
56
- console.clear();
57
- console.log("🔗 5/10 - Integration Types");
58
- console.log("0 => GUILD_INSTALL");
59
- console.log("1 => USER_INSTALL");
60
- console.log("(comma separated, or 'all')");
61
- const intInput = await this.requireInput("Integration types: ");
62
- if (intInput.toLowerCase() === "all") {
63
- config.integration_types = [0, 1];
64
- }
65
- else {
66
- config.integration_types = intInput.split(",").map(i => parseInt(i.trim())).filter(i => !isNaN(i));
67
- }
68
- console.clear();
69
- console.log("🌐 6/10 - Contexts");
70
- console.log("0 => Can be used inside server");
71
- console.log("1 => Can be used inside DMs with bot");
72
- console.log("2 => Group DMs & other DMs");
73
- console.log("(comma separated, or 'all')");
74
- const ctxInput = await this.requireInput("Contexts: ");
75
- if (ctxInput.toLowerCase() === "all") {
76
- config.contexts = [0, 1, 2];
77
- }
78
- else {
79
- config.contexts = ctxInput.split(",").map(i => parseInt(i.trim())).filter(i => !isNaN(i));
80
- }
81
- // 7. Guild IDs
82
- console.clear();
83
- console.log("🏠 7/10 - Guild IDs (optional)");
84
- console.log(" => Used to deploy specific context menu for specific guild");
85
- const guildInput = await this.requireInput("Guild IDs (comma separated, or 'none'): ", (val) => {
86
- if (!val || val.toLowerCase() === "none")
87
- return true;
88
- const ids = val.split(",").map(id => id.trim());
89
- const invalidIds = ids.filter(id => !DiscordRegex_1.DiscordRegex.GUILD_ID.test(id));
90
- if (invalidIds.length > 0) {
91
- console.log(`❌ Invalid Guild IDs: ${invalidIds.join(', ')}`);
92
- console.log("â„šī¸ Discord Guild ID = 18 chiffres (ex: 1111160769132896377)");
93
- return false;
94
- }
95
- console.log("✅ Valid Guild IDs:", ids.join(', '));
96
- return true;
97
- }, true);
98
- if (guildInput.toLowerCase() !== "none" && guildInput !== "") {
99
- config.guildID = guildInput.split(",").map(id => id.trim());
100
- }
101
- // 8. Filename
102
- console.clear();
103
- console.log("💾 8/10 - File");
104
- const filename = (await this.requireInput("Filename (ex: my-context-menu): ")) + ".json";
105
- await this.saveFile(FolderName_1.FolderName.CONTEXT_MENU, filename, config);
106
- return this.showMainMenu();
107
- }
108
- }
109
- exports.ContextMenuGeneratorCLI = ContextMenuGeneratorCLI;
@@ -1,6 +0,0 @@
1
- import { BaseCLI, MenuSelectionCLI } from "../BaseCLI";
2
- export declare class GenerationCLI extends BaseCLI {
3
- protected getTitle(): string;
4
- protected readonly menuSelection: MenuSelectionCLI;
5
- protected execute(): Promise<void>;
6
- }
@@ -1,25 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GenerationCLI = void 0;
4
- const BaseCLI_1 = require("../BaseCLI");
5
- const ContextMenuGeneratorCLI_1 = require("./ContextMenuGeneratorCLI");
6
- const ModalGeneratorCLI_1 = require("./ModalGeneratorCLI");
7
- const SlashCommandsGeneratorCLI_1 = require("./SlashCommandsGeneratorCLI");
8
- class GenerationCLI extends BaseCLI_1.BaseCLI {
9
- constructor() {
10
- super(...arguments);
11
- this.menuSelection = [
12
- { label: 'Generate Slash Command Template', action: () => new SlashCommandsGeneratorCLI_1.SlashCommandGeneratorCLI(this) },
13
- { label: 'Generate Context Menu Template', action: () => new ContextMenuGeneratorCLI_1.ContextMenuGeneratorCLI(this) },
14
- { label: 'Generate Modal Template', action: () => new ModalGeneratorCLI_1.ModalGeneratorCLI(this) },
15
- { label: 'Back', action: () => this.goBack() },
16
- ];
17
- }
18
- getTitle() {
19
- return 'âš™ī¸ Generation Manager CLI';
20
- }
21
- async execute() {
22
- throw new Error("Method not implemented.");
23
- }
24
- }
25
- exports.GenerationCLI = GenerationCLI;
@@ -1,44 +0,0 @@
1
- import { ModalBuilder } from "discord.js";
2
- import { BaseCLI, MenuSelectionCLI } from "../BaseCLI";
3
- export interface ModalCreateOption {
4
- title: string;
5
- customId: string;
6
- label: string;
7
- fields: ModalField[];
8
- }
9
- export interface ModalField {
10
- title: string;
11
- customId: string;
12
- style: ModalFieldStyle;
13
- placeholder?: string;
14
- required?: boolean;
15
- minLength?: number;
16
- maxLength?: number;
17
- }
18
- export interface SimpleModalCreateOption {
19
- customId: string;
20
- title: string;
21
- label: string;
22
- placeholder?: string;
23
- }
24
- export declare enum ModalFieldStyle {
25
- Short = 1,
26
- Paragraph = 2,
27
- Number = "Number",
28
- Phone = "Phone",
29
- Date = "Date"
30
- }
31
- export declare class ModalGeneratorCLI extends BaseCLI {
32
- protected getTitle(): string;
33
- protected readonly menuSelection: MenuSelectionCLI;
34
- protected execute(): Promise<void>;
35
- /**
36
- * Create modal from declarative config - SIMPLE API !
37
- */
38
- static create(options: ModalCreateOption): ModalBuilder;
39
- private static buildInput;
40
- /**
41
- * Quick helpers
42
- */
43
- static simple(option: SimpleModalCreateOption): ModalBuilder;
44
- }