@spatulox/simplediscordbot 1.0.1 → 1.0.2
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.
- package/.env.example +1 -1
- package/LICENSE.md +21 -21
- package/README.md +45 -1
- package/dist/bot/Bot.js +10 -23
- package/dist/bot/BotEnv.js +2 -2
- package/dist/bot/BotLog.js +81 -37
- package/dist/bot/BotMessage.js +1 -1
- package/dist/cli/BaseCLI.js +1 -0
- package/dist/cli/MainCLI.js +0 -0
- package/dist/index.js +3 -1
- package/dist/manager/messages/EmbedManager.js +15 -8
- package/dist/utils/DiscordRegex.js +1 -0
- package/package.json +40 -40
- package/spatulox-simplediscordbot-1.0.1.tgz +0 -0
- package/dist/cli/GenerationCLI/InteractionGeneratorCLI.js +0 -20
- package/dist/cli/GenerationCLI.js +0 -36
- package/dist/cli/InputCLI.js +0 -25
- package/dist/cli/InteractionCLI.js +0 -109
- package/dist/manager/discord/ChannelManager.js +0 -48
- package/dist/manager/discord/DiscordRegex.js +0 -114
- package/dist/manager/discord/GuildManager.js +0 -67
- package/dist/manager/discord/InviteManager.js +0 -89
- package/dist/manager/discord/RoleManager.js +0 -83
- package/dist/manager/discord/UserManager.js +0 -69
- package/dist/manager/hadlers_old/builder/ModalManager.js +0 -111
- package/dist/manager/hadlers_old/builder/delete.js +0 -49
- package/dist/manager/hadlers_old/builder/deploy.js +0 -225
- package/dist/manager/hadlers_old/builder/interactions/CommandManager.js +0 -14
- package/dist/manager/hadlers_old/builder/interactions/ContextMenuManager.js +0 -14
- package/dist/manager/hadlers_old/builder/interactions/InteractionBase.js +0 -341
- package/dist/manager/hadlers_old/builder/interactions/InteractionManager.js +0 -65
- package/dist/manager/hadlers_old/builder/list.js +0 -166
package/.env.example
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
DISCORD_BOT_TOKEN=example
|
|
1
|
+
DISCORD_BOT_TOKEN=example
|
|
2
2
|
DISCORD_BOT_DEV # Define this one with anything you want, the value is not important as long as the env var is defined
|
package/LICENSE.md
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025 Spatulox
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Spatulox
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1 +1,45 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
# Simple Discord Bot 
|
|
3
|
+
|
|
4
|
+
[](https://npmjs.com/package/@spatulox/simplediscordbot)
|
|
5
|
+
[](https://npmjs.com/package/@spatulox/simplediscordbot)
|
|
6
|
+
[](LICENSE)
|
|
7
|
+
|
|
8
|
+
**Framework Discord.js TypeScript ultra-simple**
|
|
9
|
+
|
|
10
|
+
## Installation
|
|
11
|
+
```bash
|
|
12
|
+
npm i @spatulox/simplediscordbot
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
> **TypeScript Discord.js framework** - Simple, powerful, framework-ready. Built for developers who want clean bot architecture.
|
|
16
|
+
|
|
17
|
+
## Quick Start
|
|
18
|
+
|
|
19
|
+
```typescript
|
|
20
|
+
import {Bot, BotConfig, EmbedColor, Time} from "@spatulox/simplediscordbot";
|
|
21
|
+
import {Client, Events, GatewayIntentBits} from "discord.js";
|
|
22
|
+
|
|
23
|
+
const client = new Client({
|
|
24
|
+
intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages]
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
const config: BotConfig = {
|
|
28
|
+
defaultEmbedColor: EmbedColor.blue,
|
|
29
|
+
botName: "Simple Discord Bot",
|
|
30
|
+
log: {
|
|
31
|
+
logChannelId: "YOUR_LOG_CHANNEL_ID",
|
|
32
|
+
errorChannelId: "YOUR_ERROR_CHANNEL_ID",
|
|
33
|
+
info: { console: true, discord: true },
|
|
34
|
+
error: { console: true, discord: true },
|
|
35
|
+
warn: { console: true, discord: true },
|
|
36
|
+
debug: { console: true, discord: false }
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const bot = new Bot(client, config);
|
|
41
|
+
|
|
42
|
+
bot.client.on(Events.ClientReady, async () => {
|
|
43
|
+
Bot.setRandomActivity(randomActivityList, Time.minute.MIN_10.toMilliseconds());
|
|
44
|
+
console.log("Bot ready! ✨");
|
|
45
|
+
});
|
package/dist/bot/Bot.js
CHANGED
|
@@ -10,6 +10,7 @@ const UnitTime_1 = require("../utils/times/UnitTime");
|
|
|
10
10
|
const Log_1 = require("../utils/Log");
|
|
11
11
|
const InternetChecker_1 = require("../utils/network/InternetChecker");
|
|
12
12
|
const BotLog_1 = require("./BotLog");
|
|
13
|
+
const EmbedManager_1 = require("../manager/messages/EmbedManager");
|
|
13
14
|
const BotMessage_1 = require("./BotMessage");
|
|
14
15
|
const BotEnv_1 = require("./BotEnv");
|
|
15
16
|
dotenv_1.default.config();
|
|
@@ -20,7 +21,7 @@ class Bot {
|
|
|
20
21
|
static get config() { return Bot._config; }
|
|
21
22
|
constructor(client, config) {
|
|
22
23
|
Log_1.Log.info('----------------------------------------------------');
|
|
23
|
-
Log_1.Log.info("Starting
|
|
24
|
+
Log_1.Log.info("Starting Bot");
|
|
24
25
|
Bot.criticConfig = { dev: BotEnv_1.BotEnv.dev, token: BotEnv_1.BotEnv.token };
|
|
25
26
|
Bot._config = { ...config, clientId: BotEnv_1.BotEnv.clientId };
|
|
26
27
|
Bot._client = client;
|
|
@@ -29,14 +30,6 @@ class Bot {
|
|
|
29
30
|
Log_1.Log.info('Trying to connect to Discord Servers');
|
|
30
31
|
await InternetChecker_1.InternetChecker.checkConnection(3);
|
|
31
32
|
await this.login();
|
|
32
|
-
Bot._client.on(discord_js_1.Events.ClientReady, () => {
|
|
33
|
-
if (client && client.user) {
|
|
34
|
-
Log_1.Log.info(`${client.user.username} has logged in, waiting...`);
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
/*Bot.client.on(Events.InteractionCreate, async (interaction: Interaction) =>{
|
|
38
|
-
console.log(interaction);
|
|
39
|
-
})*/
|
|
40
33
|
})();
|
|
41
34
|
}
|
|
42
35
|
async login(maxTries = 3) {
|
|
@@ -46,12 +39,12 @@ class Bot {
|
|
|
46
39
|
try {
|
|
47
40
|
await Bot._client.login(Bot.criticConfig.token);
|
|
48
41
|
success = true;
|
|
49
|
-
Bot._client.
|
|
42
|
+
Bot._client.on(discord_js_1.Events.ClientReady, async () => {
|
|
50
43
|
if (Bot._client.user) {
|
|
51
|
-
|
|
52
|
-
Log_1.Log.info(`Connected as ${Bot._client.user.tag}`);
|
|
53
|
-
|
|
54
|
-
Bot.
|
|
44
|
+
await Bot.log.initDiscordLogging();
|
|
45
|
+
Log_1.Log.info(`Connected on ${Bot._client.guilds.cache.size} servers as ${Bot._client.user.tag}`);
|
|
46
|
+
//Bot._client.guilds.cache.forEach(g => console.log(` - ${g.name}`));
|
|
47
|
+
Bot.log.sendLog(EmbedManager_1.EmbedManager.description("Bot Started"));
|
|
55
48
|
}
|
|
56
49
|
});
|
|
57
50
|
}
|
|
@@ -88,20 +81,14 @@ class Bot {
|
|
|
88
81
|
Log_1.Log.info(`Activity set ONCE`);
|
|
89
82
|
return;
|
|
90
83
|
}
|
|
91
|
-
if (intervalMs != null) {
|
|
92
|
-
setInterval(async () => {
|
|
93
|
-
const random = randomActivity[Math.floor(Math.random() * randomActivity.length)];
|
|
94
|
-
Bot.setActivity(random.message, random.type);
|
|
95
|
-
}, intervalMs);
|
|
96
|
-
return;
|
|
97
|
-
}
|
|
98
84
|
pickRandom();
|
|
99
|
-
setInterval(() => {
|
|
85
|
+
setInterval(async () => {
|
|
100
86
|
pickRandom();
|
|
101
87
|
}, intervalMs);
|
|
102
88
|
Log_1.Log.info(`Random activity started (every ${Math.round(intervalMs / 60000)}min)`);
|
|
89
|
+
return;
|
|
103
90
|
}
|
|
104
91
|
}
|
|
105
92
|
exports.Bot = Bot;
|
|
106
|
-
Bot.log =
|
|
93
|
+
Bot.log = BotLog_1.BotLog;
|
|
107
94
|
Bot.message = new BotMessage_1.BotMessage();
|
package/dist/bot/BotEnv.js
CHANGED
|
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.BotEnv = void 0;
|
|
7
7
|
const dotenv_1 = __importDefault(require("dotenv"));
|
|
8
|
+
const DiscordRegex_1 = require("../utils/DiscordRegex");
|
|
8
9
|
dotenv_1.default.config();
|
|
9
10
|
exports.BotEnv = {
|
|
10
11
|
get token() {
|
|
@@ -20,8 +21,7 @@ exports.BotEnv = {
|
|
|
20
21
|
const token = process.env.DISCORD_BOT_CLIENTID;
|
|
21
22
|
if (!token)
|
|
22
23
|
throw new Error('Missing environment variable : DISCORD_BOT_CLIENTID');
|
|
23
|
-
|
|
24
|
-
if (!discordIdRegex.test(token)) {
|
|
24
|
+
if (!DiscordRegex_1.DiscordRegex.BOT_ID.test(token)) {
|
|
25
25
|
throw new Error("Invalid token format");
|
|
26
26
|
}
|
|
27
27
|
return token;
|
package/dist/bot/BotLog.js
CHANGED
|
@@ -6,41 +6,51 @@ const discord_js_1 = require("discord.js");
|
|
|
6
6
|
const Log_1 = require("../utils/Log");
|
|
7
7
|
const Bot_1 = require("./Bot");
|
|
8
8
|
class BotLog {
|
|
9
|
-
constructor() {
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
constructor() { }
|
|
10
|
+
static config() {
|
|
11
|
+
return Bot_1.Bot.config.log;
|
|
12
12
|
}
|
|
13
13
|
/**
|
|
14
14
|
* Initialize Discord logging channels and update Bot.log references
|
|
15
15
|
*/
|
|
16
|
-
static initDiscordLogging() {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
16
|
+
static async initDiscordLogging() {
|
|
17
|
+
if (!Bot_1.Bot.client.isReady()) {
|
|
18
|
+
Log_1.Log.warn('Client not ready for Discord logging init');
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
if (Bot_1.Bot.config.log?.logChannelId) {
|
|
22
|
+
try {
|
|
23
|
+
const logCh = await Bot_1.Bot.client.channels.fetch(Bot_1.Bot.config.log.logChannelId);
|
|
24
|
+
if (logCh?.isTextBased()) {
|
|
25
|
+
BotLog.logChannel = logCh;
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
Log_1.Log.warn(`❌ Log channel ${Bot_1.Bot.config.log.logChannelId} invalid`);
|
|
29
|
+
}
|
|
23
30
|
}
|
|
24
|
-
|
|
25
|
-
Log_1.Log.
|
|
31
|
+
catch (error) {
|
|
32
|
+
Log_1.Log.error(`❌ Log channel fetch failed: ${error}`);
|
|
26
33
|
}
|
|
27
34
|
}
|
|
28
|
-
if (Bot_1.Bot.config.errorChannelId) {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
35
|
+
if (Bot_1.Bot.config.log?.errorChannelId) {
|
|
36
|
+
try {
|
|
37
|
+
const errorCh = await Bot_1.Bot.client.channels.fetch(Bot_1.Bot.config.log.errorChannelId);
|
|
38
|
+
if (errorCh?.isTextBased()) {
|
|
39
|
+
BotLog.errorChannel = errorCh;
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
Log_1.Log.warn(`❌ Error channel ${Bot_1.Bot.config.log.errorChannelId} invalid`);
|
|
43
|
+
}
|
|
34
44
|
}
|
|
35
|
-
|
|
36
|
-
Log_1.Log.
|
|
45
|
+
catch (error) {
|
|
46
|
+
Log_1.Log.error(`❌ Error channel fetch failed: ${error}`);
|
|
37
47
|
}
|
|
38
48
|
}
|
|
39
49
|
}
|
|
40
50
|
/**
|
|
41
51
|
* Send content to specific Discord channel
|
|
42
52
|
*/
|
|
43
|
-
async _sendToChannel(channel, content, prefix = 'info') {
|
|
53
|
+
static async _sendToChannel(channel, content, prefix = 'info') {
|
|
44
54
|
if (!channel)
|
|
45
55
|
return;
|
|
46
56
|
let msg;
|
|
@@ -59,32 +69,66 @@ class BotLog {
|
|
|
59
69
|
return msg;
|
|
60
70
|
}
|
|
61
71
|
/**
|
|
62
|
-
* Send INFO log - TEXT or EMBED !
|
|
72
|
+
* Send INFO log - TEXT or EMBED ! Respecte config.log.info
|
|
63
73
|
*/
|
|
64
|
-
async sendLog(content) {
|
|
65
|
-
|
|
66
|
-
|
|
74
|
+
static async sendLog(content) {
|
|
75
|
+
const logConfig = Bot_1.Bot.config.log;
|
|
76
|
+
// 1. CONSOLE selon config (ou défaut ON)
|
|
77
|
+
if (!logConfig || logConfig.info.console) {
|
|
78
|
+
if (!(content instanceof discord_js_1.EmbedBuilder)) {
|
|
79
|
+
Log_1.Log.info(content);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
// 2. Discord seulement si config + channel
|
|
83
|
+
if (logConfig?.info.discord && this.logChannel) {
|
|
84
|
+
return await this._sendToChannel(this.logChannel, content, 'info');
|
|
85
|
+
}
|
|
67
86
|
}
|
|
68
87
|
/**
|
|
69
|
-
* Send ERROR log - TEXT or EMBED !
|
|
88
|
+
* Send ERROR log - TEXT or EMBED ! Respecte config.log.error
|
|
70
89
|
*/
|
|
71
|
-
async sendError(content) {
|
|
72
|
-
|
|
73
|
-
|
|
90
|
+
static async sendError(content) {
|
|
91
|
+
const logConfig = Bot_1.Bot.config.log;
|
|
92
|
+
// 1. CONSOLE selon config (ou défaut ON)
|
|
93
|
+
if (!logConfig || logConfig.error.console) {
|
|
94
|
+
if (!(content instanceof discord_js_1.EmbedBuilder)) {
|
|
95
|
+
Log_1.Log.error(content);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
// 2. Discord seulement si config + channel
|
|
99
|
+
if (logConfig?.error.discord && this.errorChannel) {
|
|
100
|
+
return await this._sendToChannel(this.errorChannel, content, 'error');
|
|
101
|
+
}
|
|
74
102
|
}
|
|
75
103
|
/**
|
|
76
|
-
* Send WARNING log - TEXT or EMBED
|
|
104
|
+
* Send WARNING log - TEXT or EMBED ! Respecte config.log.warn
|
|
77
105
|
*/
|
|
78
|
-
async sendWarn(content) {
|
|
79
|
-
|
|
80
|
-
|
|
106
|
+
static async sendWarn(content) {
|
|
107
|
+
const logConfig = Bot_1.Bot.config.log;
|
|
108
|
+
if (!logConfig || logConfig?.warn.console) {
|
|
109
|
+
if (!(content instanceof discord_js_1.EmbedBuilder)) {
|
|
110
|
+
Log_1.Log.warn(content);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
if (logConfig?.warn.discord && this.logChannel) {
|
|
114
|
+
return await this._sendToChannel(this.logChannel, content, 'warn');
|
|
115
|
+
}
|
|
81
116
|
}
|
|
82
117
|
/**
|
|
83
|
-
* Send DEBUG log - TEXT or EMBED
|
|
118
|
+
* Send DEBUG log - TEXT or EMBED ! Respecte config.log.debug
|
|
84
119
|
*/
|
|
85
|
-
async sendDebug(content) {
|
|
86
|
-
|
|
87
|
-
|
|
120
|
+
static async sendDebug(content) {
|
|
121
|
+
const logConfig = Bot_1.Bot.config.log;
|
|
122
|
+
if (!logConfig || logConfig?.debug.console) {
|
|
123
|
+
if (!(content instanceof discord_js_1.EmbedBuilder)) {
|
|
124
|
+
Log_1.Log.debug(content);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
if (logConfig?.debug.discord && this.logChannel) {
|
|
128
|
+
return await this._sendToChannel(this.logChannel, content, 'debug');
|
|
129
|
+
}
|
|
88
130
|
}
|
|
89
131
|
}
|
|
90
132
|
exports.BotLog = BotLog;
|
|
133
|
+
BotLog.logChannel = null;
|
|
134
|
+
BotLog.errorChannel = null;
|
package/dist/bot/BotMessage.js
CHANGED
package/dist/cli/BaseCLI.js
CHANGED
|
@@ -118,6 +118,7 @@ class BaseCLI {
|
|
|
118
118
|
console.log(' • Enter: "1,3,5" or "all" to select which interaction you want to apply the action');
|
|
119
119
|
console.log('');
|
|
120
120
|
console.log('🔗 Wiki: https://github.com/Spatulox/SimpleDiscordBot/wiki');
|
|
121
|
+
console.log('🔗 Bugs: https://github.com/Spatulox/SimpleDiscordBot/issues');
|
|
121
122
|
console.log('═'.repeat(80));
|
|
122
123
|
await this.prompt('Press Enter to continue...');
|
|
123
124
|
if (this.parent) {
|
package/dist/cli/MainCLI.js
CHANGED
|
File without changes
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DiscordRegex = exports.SimpleMutex = exports.Log = exports.Time = exports.ModalManager = exports.UserManager = exports.GuildManager = exports.ReactionManager = exports.WebhookManager = exports.EmbedColor = exports.EmbedManager = exports.FileManager = exports.Bot = void 0;
|
|
3
|
+
exports.DiscordRegex = exports.SimpleMutex = exports.Log = exports.Time = exports.ModalManager = exports.UserManager = exports.GuildManager = exports.ReactionManager = exports.WebhookManager = exports.EmbedColor = exports.EmbedManager = exports.FileManager = exports.BotEnv = exports.Bot = void 0;
|
|
4
4
|
var Bot_1 = require("./bot/Bot");
|
|
5
5
|
Object.defineProperty(exports, "Bot", { enumerable: true, get: function () { return Bot_1.Bot; } });
|
|
6
|
+
var BotEnv_1 = require("./bot/BotEnv");
|
|
7
|
+
Object.defineProperty(exports, "BotEnv", { enumerable: true, get: function () { return BotEnv_1.BotEnv; } });
|
|
6
8
|
// Manager
|
|
7
9
|
var FileManager_1 = require("./manager/FileManager");
|
|
8
10
|
Object.defineProperty(exports, "FileManager", { enumerable: true, get: function () { return FileManager_1.FileManager; } });
|
|
@@ -53,16 +53,16 @@ class EmbedManager {
|
|
|
53
53
|
* Creates base embed - SAME SIMPLE API !
|
|
54
54
|
*/
|
|
55
55
|
static create(color = null) {
|
|
56
|
-
|
|
56
|
+
const embed = new discord_js_1.EmbedBuilder()
|
|
57
57
|
.setColor(color ?? this.DEFAULT_COLOR)
|
|
58
|
-
.setTitle('Title')
|
|
59
|
-
.setDescription('')
|
|
60
|
-
.setThumbnail('')
|
|
61
|
-
.setFooter({
|
|
62
|
-
text: Bot_1.Bot.config.botName || "",
|
|
63
|
-
iconURL: this.BOT_ICON
|
|
64
|
-
})
|
|
65
58
|
.setTimestamp(new Date());
|
|
59
|
+
if (this.BOT_ICON && Bot_1.Bot.config.botName) {
|
|
60
|
+
embed.setFooter({
|
|
61
|
+
text: Bot_1.Bot.config.botName,
|
|
62
|
+
iconURL: this.BOT_ICON
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
return embed;
|
|
66
66
|
}
|
|
67
67
|
/**
|
|
68
68
|
* Creates simple embed with just description
|
|
@@ -89,6 +89,13 @@ class EmbedManager {
|
|
|
89
89
|
.setTitle('Success')
|
|
90
90
|
.setDescription(description);
|
|
91
91
|
}
|
|
92
|
+
/**
|
|
93
|
+
* Creates success embed
|
|
94
|
+
*/
|
|
95
|
+
static description(description) {
|
|
96
|
+
return this.create(EmbedColor.minecraft)
|
|
97
|
+
.setDescription(description);
|
|
98
|
+
}
|
|
92
99
|
/**
|
|
93
100
|
* Creates debug embed
|
|
94
101
|
*/
|
|
@@ -100,6 +100,7 @@ DiscordRegex.DISCORD_MENTION_REGEX = new RegExp(`(${_a.DISCORD_PING_REGEX.source
|
|
|
100
100
|
DiscordRegex.USER_ID = /^[0-9]{18}$/;
|
|
101
101
|
DiscordRegex.CHANNEL_ID = /^[0-9]{18}$/;
|
|
102
102
|
DiscordRegex.GUILD_ID = /^[0-9]{19}$/;
|
|
103
|
+
DiscordRegex.BOT_ID = /^[0-9]{19}$/;
|
|
103
104
|
// Username Discord (2-32 caractères alphanumériques + _ .)
|
|
104
105
|
DiscordRegex.USERNAME = /^[a-zA-Z0-9_]{2,32}$/;
|
|
105
106
|
// Username + discrim (ancien format)
|
package/package.json
CHANGED
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@spatulox/simplediscordbot",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"author": "Spatulox",
|
|
5
|
-
"description": "Simple discord bot framework to set up a bot under 30 secondes",
|
|
6
|
-
"main": "./dist/index.js",
|
|
7
|
-
"bin": {
|
|
8
|
-
"sdb": "dist/cli/MainCLI.js"
|
|
9
|
-
},
|
|
10
|
-
"scripts": {
|
|
11
|
-
"build": "tsc",
|
|
12
|
-
"dev": "nodemon --exec tsx src/test/index.ts",
|
|
13
|
-
"cli": "node dist/cli/MainCLI.js"
|
|
14
|
-
},
|
|
15
|
-
"license": "MIT",
|
|
16
|
-
"dependencies": {
|
|
17
|
-
"discord.js": "^14.25.1",
|
|
18
|
-
"dotenv": "^17.2.0",
|
|
19
|
-
"fs": "^0.0.1-security"
|
|
20
|
-
},
|
|
21
|
-
"devDependencies": {
|
|
22
|
-
"@types/node": "^22.14.0",
|
|
23
|
-
"@types/node-schedule": "^2.1.7",
|
|
24
|
-
"nodemon": "^3.1.9",
|
|
25
|
-
"tsx": "^4.20.3",
|
|
26
|
-
"typescript": "^5.9.3"
|
|
27
|
-
},
|
|
28
|
-
"keywords": [
|
|
29
|
-
"discord",
|
|
30
|
-
"framework",
|
|
31
|
-
"bot",
|
|
32
|
-
"client",
|
|
33
|
-
"discordjs",
|
|
34
|
-
"discord.js",
|
|
35
|
-
"node"
|
|
36
|
-
],
|
|
37
|
-
"bugs": {
|
|
38
|
-
"url": "https://github.com/Spatulox/SimpleDiscordBot/issues"
|
|
39
|
-
}
|
|
40
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@spatulox/simplediscordbot",
|
|
3
|
+
"version": "1.0.2",
|
|
4
|
+
"author": "Spatulox",
|
|
5
|
+
"description": "Simple discord bot framework to set up a bot under 30 secondes",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"bin": {
|
|
8
|
+
"sdb": "dist/cli/MainCLI.js"
|
|
9
|
+
},
|
|
10
|
+
"scripts": {
|
|
11
|
+
"build": "tsc",
|
|
12
|
+
"dev": "nodemon --exec tsx src/test/index.ts",
|
|
13
|
+
"cli": "node dist/cli/MainCLI.js"
|
|
14
|
+
},
|
|
15
|
+
"license": "MIT",
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"discord.js": "^14.25.1",
|
|
18
|
+
"dotenv": "^17.2.0",
|
|
19
|
+
"fs": "^0.0.1-security"
|
|
20
|
+
},
|
|
21
|
+
"devDependencies": {
|
|
22
|
+
"@types/node": "^22.14.0",
|
|
23
|
+
"@types/node-schedule": "^2.1.7",
|
|
24
|
+
"nodemon": "^3.1.9",
|
|
25
|
+
"tsx": "^4.20.3",
|
|
26
|
+
"typescript": "^5.9.3"
|
|
27
|
+
},
|
|
28
|
+
"keywords": [
|
|
29
|
+
"discord",
|
|
30
|
+
"framework",
|
|
31
|
+
"bot",
|
|
32
|
+
"client",
|
|
33
|
+
"discordjs",
|
|
34
|
+
"discord.js",
|
|
35
|
+
"node"
|
|
36
|
+
],
|
|
37
|
+
"bugs": {
|
|
38
|
+
"url": "https://github.com/Spatulox/SimpleDiscordBot/issues"
|
|
39
|
+
}
|
|
40
|
+
}
|
|
Binary file
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.InteractionGeneratorCLI = void 0;
|
|
4
|
-
const BaseCLI_1 = require("../BaseCLI");
|
|
5
|
-
class InteractionGeneratorCLI extends BaseCLI_1.BaseCLI {
|
|
6
|
-
constructor() {
|
|
7
|
-
super(...arguments);
|
|
8
|
-
this.menuSelection = [
|
|
9
|
-
{ label: "Generate Modal", action: () => this },
|
|
10
|
-
{ label: 'Back', action: () => this, onSelect: () => this.goBack() },
|
|
11
|
-
];
|
|
12
|
-
}
|
|
13
|
-
getTitle() {
|
|
14
|
-
return "📝 Interaction JSON Generator";
|
|
15
|
-
}
|
|
16
|
-
async action() {
|
|
17
|
-
throw new Error("Method not implemented.");
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
exports.InteractionGeneratorCLI = InteractionGeneratorCLI;
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GenerationCLI = void 0;
|
|
4
|
-
const BaseCLI_1 = require("./BaseCLI");
|
|
5
|
-
class GenerationCLI extends BaseCLI_1.BaseCLI {
|
|
6
|
-
getTitle() {
|
|
7
|
-
return '⚙️ Generation Manager CLI';
|
|
8
|
-
}
|
|
9
|
-
async showMainMenu() {
|
|
10
|
-
console.clear();
|
|
11
|
-
console.log(this.getTitle());
|
|
12
|
-
console.log('═'.repeat(40));
|
|
13
|
-
console.log('1. Generate Slash Command Template');
|
|
14
|
-
console.log('2. Generate Context Menu Template');
|
|
15
|
-
console.log('3. Generate All Templates');
|
|
16
|
-
console.log('4. Back');
|
|
17
|
-
console.log('═'.repeat(40));
|
|
18
|
-
const choice = await this.prompt('Choose an option: ');
|
|
19
|
-
switch (choice) {
|
|
20
|
-
case '1':
|
|
21
|
-
console.log('Slash template generation - TODO');
|
|
22
|
-
break;
|
|
23
|
-
case '2':
|
|
24
|
-
console.log('Context menu template - TODO');
|
|
25
|
-
break;
|
|
26
|
-
case '3':
|
|
27
|
-
console.log('All templates - TODO');
|
|
28
|
-
break;
|
|
29
|
-
case '4':
|
|
30
|
-
case 'exit': return this.goBack();
|
|
31
|
-
}
|
|
32
|
-
await this.prompt('Press Enter to continue...');
|
|
33
|
-
return this.showMainMenu();
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
exports.GenerationCLI = GenerationCLI;
|
package/dist/cli/InputCLI.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const BaseCLI_1 = require("./BaseCLI");
|
|
4
|
-
/*import {BaseClient} from "discord.js";
|
|
5
|
-
|
|
6
|
-
/*class SimpleDiscordBotCLI extends BaseCLI {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
protected getTitle(): string {
|
|
11
|
-
throw new Error("Method not implemented.");
|
|
12
|
-
}
|
|
13
|
-
protected showManagersMenu(): Promise<void> {
|
|
14
|
-
throw new Error("Method not implemented.");
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
constructor() {
|
|
18
|
-
super();
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
async start(): Promise<void> {
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
}*/
|
|
25
|
-
new BaseCLI_1.BaseCLI();
|