@spatulox/simplediscordbot 1.0.36 → 1.0.38
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 +51 -51
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +59 -66
- package/dist/index.mjs +15 -24
- package/package.json +51 -51
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,51 +1,51 @@
|
|
|
1
|
-
|
|
2
|
-
# Simple Discord Bot 
|
|
3
|
-
|
|
4
|
-
[](https://npmjs.com/package/@spatulox/simplediscordbot)
|
|
5
|
-
[](https://npmjs.com/package/@spatulox/simplediscordbot)
|
|
6
|
-
[](LICENSE)
|
|
7
|
-
|
|
8
|
-
**Ultra-simple Framework Discord.js TypeScript**
|
|
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
|
-
## Quick Start
|
|
17
|
-
|
|
18
|
-
Env Variables:
|
|
19
|
-
```bash
|
|
20
|
-
DISCORD_BOT_TOKEN="" // Your bot Token
|
|
21
|
-
DISCORD_BOT_CLIENTID="" // Yout bot client id
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
```typescript
|
|
25
|
-
import {Bot, BotConfig, EmbedColor, Time} from "@spatulox/simplediscordbot";
|
|
26
|
-
import {Client, Events, GatewayIntentBits} from "discord.js";
|
|
27
|
-
|
|
28
|
-
const client = new Client({
|
|
29
|
-
intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages]
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
const config: BotConfig = {
|
|
33
|
-
defaultEmbedColor: EmbedColor.blue,
|
|
34
|
-
botName: "Simple Discord Bot",
|
|
35
|
-
log: {
|
|
36
|
-
logChannelId: "YOUR_LOG_CHANNEL_ID",
|
|
37
|
-
errorChannelId: "YOUR_ERROR_CHANNEL_ID",
|
|
38
|
-
info: { console: true, discord: true },
|
|
39
|
-
error: { console: true, discord: true },
|
|
40
|
-
warn: { console: true, discord: true },
|
|
41
|
-
debug: { console: true, discord: false }
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
const bot = new Bot(client, config);
|
|
46
|
-
|
|
47
|
-
bot.client.on(Events.ClientReady, async () => {
|
|
48
|
-
Bot.setRandomActivity(randomActivityList, Time.minute.MIN_10.toMilliseconds());
|
|
49
|
-
console.log("Bot ready! ✨");
|
|
50
|
-
});
|
|
51
|
-
```
|
|
1
|
+
|
|
2
|
+
# Simple Discord Bot 
|
|
3
|
+
|
|
4
|
+
[](https://npmjs.com/package/@spatulox/simplediscordbot)
|
|
5
|
+
[](https://npmjs.com/package/@spatulox/simplediscordbot)
|
|
6
|
+
[](LICENSE)
|
|
7
|
+
|
|
8
|
+
**Ultra-simple Framework Discord.js TypeScript**
|
|
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
|
+
## Quick Start
|
|
17
|
+
|
|
18
|
+
Env Variables:
|
|
19
|
+
```bash
|
|
20
|
+
DISCORD_BOT_TOKEN="" // Your bot Token
|
|
21
|
+
DISCORD_BOT_CLIENTID="" // Yout bot client id
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
```typescript
|
|
25
|
+
import {Bot, BotConfig, EmbedColor, Time} from "@spatulox/simplediscordbot";
|
|
26
|
+
import {Client, Events, GatewayIntentBits} from "discord.js";
|
|
27
|
+
|
|
28
|
+
const client = new Client({
|
|
29
|
+
intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages]
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
const config: BotConfig = {
|
|
33
|
+
defaultEmbedColor: EmbedColor.blue,
|
|
34
|
+
botName: "Simple Discord Bot",
|
|
35
|
+
log: {
|
|
36
|
+
logChannelId: "YOUR_LOG_CHANNEL_ID",
|
|
37
|
+
errorChannelId: "YOUR_ERROR_CHANNEL_ID",
|
|
38
|
+
info: { console: true, discord: true },
|
|
39
|
+
error: { console: true, discord: true },
|
|
40
|
+
warn: { console: true, discord: true },
|
|
41
|
+
debug: { console: true, discord: false }
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
const bot = new Bot(client, config);
|
|
46
|
+
|
|
47
|
+
bot.client.on(Events.ClientReady, async () => {
|
|
48
|
+
Bot.setRandomActivity(randomActivityList, Time.minute.MIN_10.toMilliseconds());
|
|
49
|
+
console.log("Bot ready! ✨");
|
|
50
|
+
});
|
|
51
|
+
```
|
package/dist/index.d.mts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -534,7 +534,7 @@ var EmbedManager = class {
|
|
|
534
534
|
* Creates simple embed with just description
|
|
535
535
|
*/
|
|
536
536
|
static simple(description, color = null) {
|
|
537
|
-
return this.create(color).setDescription(description)
|
|
537
|
+
return this.create(color).setDescription(description);
|
|
538
538
|
}
|
|
539
539
|
/**
|
|
540
540
|
* Creates error embed
|
|
@@ -549,10 +549,10 @@ var EmbedManager = class {
|
|
|
549
549
|
return this.create(25600 /* minecraft */).setTitle("Success").setDescription(description);
|
|
550
550
|
}
|
|
551
551
|
/**
|
|
552
|
-
* Creates
|
|
552
|
+
* Creates a simply description embed
|
|
553
553
|
*/
|
|
554
554
|
static description(description) {
|
|
555
|
-
return this.create(
|
|
555
|
+
return this.create().setDescription(description).setFooter(null).setTimestamp(null);
|
|
556
556
|
}
|
|
557
557
|
/**
|
|
558
558
|
* Creates debug embed
|
|
@@ -641,20 +641,16 @@ var SendableComponentBuilder = class {
|
|
|
641
641
|
}
|
|
642
642
|
return base;
|
|
643
643
|
}
|
|
644
|
-
static buildInteraction(
|
|
644
|
+
/*static buildInteraction (content: string, epheremal?: boolean): InteractionReplyOptions | InteractionUpdateOptions;
|
|
645
|
+
static buildInteraction (component: SendableComponent | SendableComponent[], epheremal?: boolean): InteractionReplyOptions | InteractionUpdateOptions;
|
|
646
|
+
static buildInteraction (content?: string | null, component?: SendableComponent | SendableComponent[] | null, ephemeral?: boolean): InteractionReplyOptions | InteractionUpdateOptions;*/
|
|
647
|
+
static buildInteraction(content, component, ephemeral) {
|
|
645
648
|
let base = {};
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
}
|
|
649
|
-
if (typeof contentOrComponent !== "string" && !component) {
|
|
650
|
-
base = this.build(base, null, contentOrComponent);
|
|
651
|
-
}
|
|
652
|
-
if (contentOrComponent && typeof contentOrComponent === "string" && component) {
|
|
653
|
-
base = this.build(base, contentOrComponent, component);
|
|
654
|
-
}
|
|
655
|
-
if (ephemeral) {
|
|
649
|
+
this.build(base, content, component);
|
|
650
|
+
if (ephemeral || typeof component == "boolean" && component) {
|
|
656
651
|
base.flags = [import_discord3.MessageFlags.Ephemeral];
|
|
657
652
|
}
|
|
653
|
+
console.log(base);
|
|
658
654
|
return base;
|
|
659
655
|
}
|
|
660
656
|
static buildMessage(contentOrComponent, component) {
|
|
@@ -916,7 +912,7 @@ var BotInteraction = class {
|
|
|
916
912
|
static async send(interaction, content, component = false, ephemeral = false) {
|
|
917
913
|
if (!interaction.isRepliable()) return false;
|
|
918
914
|
const options = this.buildReplyOptions(
|
|
919
|
-
typeof content === "string" ? content :
|
|
915
|
+
typeof content === "string" ? content : null,
|
|
920
916
|
typeof content === "string" ? component : content,
|
|
921
917
|
typeof content === "string" ? ephemeral : component
|
|
922
918
|
);
|
|
@@ -1270,9 +1266,6 @@ var WebhookManager = class {
|
|
|
1270
1266
|
};
|
|
1271
1267
|
|
|
1272
1268
|
// src/manager/guild/ChannelManager/GuildTextChannelManager.ts
|
|
1273
|
-
var import_discord8 = require("discord.js");
|
|
1274
|
-
|
|
1275
|
-
// src/manager/guild/ChannelManager/GuildChannelManager.ts
|
|
1276
1269
|
var import_discord7 = require("discord.js");
|
|
1277
1270
|
|
|
1278
1271
|
// src/manager/guild/ChannelManager/GuildMessageManager.ts
|
|
@@ -1379,9 +1372,9 @@ var _GuildChannelManager = class _GuildChannelManager {
|
|
|
1379
1372
|
static async find(channelId) {
|
|
1380
1373
|
try {
|
|
1381
1374
|
const cached = Bot.client.channels.cache.get(channelId);
|
|
1382
|
-
if (cached && cached
|
|
1375
|
+
if (cached && !cached.isDMBased()) return cached;
|
|
1383
1376
|
const channel = await Bot.client.channels.fetch(channelId);
|
|
1384
|
-
if (channel && channel
|
|
1377
|
+
if (channel && !channel.isDMBased()) return channel;
|
|
1385
1378
|
Log.warn(`Channel ${channelId} not found in any guild`);
|
|
1386
1379
|
return null;
|
|
1387
1380
|
} catch (error) {
|
|
@@ -1468,12 +1461,12 @@ var GuildTextChannelManager = class extends GuildChannelManager {
|
|
|
1468
1461
|
Log.warn(`Guild ${guildId} not found`);
|
|
1469
1462
|
return [];
|
|
1470
1463
|
}
|
|
1471
|
-
return Array.from(guild.channels.cache.values()).filter((c) => c instanceof
|
|
1464
|
+
return Array.from(guild.channels.cache.values()).filter((c) => c instanceof import_discord7.TextChannel);
|
|
1472
1465
|
}
|
|
1473
1466
|
static async create(guildId, name, options) {
|
|
1474
1467
|
return await super._create(guildId, {
|
|
1475
1468
|
name,
|
|
1476
|
-
type:
|
|
1469
|
+
type: import_discord7.ChannelType.GuildText,
|
|
1477
1470
|
...options
|
|
1478
1471
|
});
|
|
1479
1472
|
}
|
|
@@ -1570,10 +1563,10 @@ var ReactionManager = class {
|
|
|
1570
1563
|
};
|
|
1571
1564
|
|
|
1572
1565
|
// src/manager/guild/GuildManager.ts
|
|
1573
|
-
var
|
|
1566
|
+
var import_discord14 = require("discord.js");
|
|
1574
1567
|
|
|
1575
1568
|
// src/manager/direct/BasicUserManager.ts
|
|
1576
|
-
var
|
|
1569
|
+
var import_discord8 = require("discord.js");
|
|
1577
1570
|
var BasicUserManager = class {
|
|
1578
1571
|
/**
|
|
1579
1572
|
* Find member in specific guild
|
|
@@ -1631,7 +1624,7 @@ var BasicUserManager = class {
|
|
|
1631
1624
|
payload = content_or_component_or_options;
|
|
1632
1625
|
}
|
|
1633
1626
|
const message = await dmChannel.send(payload);
|
|
1634
|
-
if (user instanceof
|
|
1627
|
+
if (user instanceof import_discord8.GuildMember) {
|
|
1635
1628
|
Log.info(`Sent DM to ${user.id} (${user.user.username}): "${(payload.content || "Embed/Component").substring(0, 50)}..."`);
|
|
1636
1629
|
} else {
|
|
1637
1630
|
Log.info(`Sent DM to ${user.id} (${user.username}): "${(payload.content || "Embed/Component").substring(0, 50)}..."`);
|
|
@@ -1645,13 +1638,13 @@ var BasicUserManager = class {
|
|
|
1645
1638
|
};
|
|
1646
1639
|
|
|
1647
1640
|
// src/manager/guild/GuildUserManager.ts
|
|
1648
|
-
var
|
|
1641
|
+
var import_discord9 = require("discord.js");
|
|
1649
1642
|
var import_promises2 = require("timers/promises");
|
|
1650
1643
|
var MAX_NICKNAME_LENGTH = 32;
|
|
1651
1644
|
var GuildUserManager = class extends BasicUserManager {
|
|
1652
1645
|
static async find(userId, guild) {
|
|
1653
1646
|
try {
|
|
1654
|
-
if (guild instanceof
|
|
1647
|
+
if (guild instanceof import_discord9.Guild) {
|
|
1655
1648
|
return await guild.members.fetch(userId);
|
|
1656
1649
|
} else {
|
|
1657
1650
|
return await (await GuildManager.find(guild)).members.fetch(userId);
|
|
@@ -1949,15 +1942,15 @@ var RoleManager = class {
|
|
|
1949
1942
|
};
|
|
1950
1943
|
|
|
1951
1944
|
// src/manager/guild/ChannelManager/ForumChannelManager.ts
|
|
1952
|
-
var
|
|
1945
|
+
var import_discord10 = require("discord.js");
|
|
1953
1946
|
var ForumChannelManager = class extends GuildChannelManager {
|
|
1954
1947
|
static async findInGuild(guildId, channelId) {
|
|
1955
1948
|
const channel = await super.findInGuild(guildId, channelId);
|
|
1956
|
-
return channel instanceof
|
|
1949
|
+
return channel instanceof import_discord10.ForumChannel ? channel : null;
|
|
1957
1950
|
}
|
|
1958
1951
|
static async find(channelId) {
|
|
1959
1952
|
const channel = await super.find(channelId);
|
|
1960
|
-
return channel instanceof
|
|
1953
|
+
return channel instanceof import_discord10.ForumChannel ? channel : null;
|
|
1961
1954
|
}
|
|
1962
1955
|
static findAll(guildId) {
|
|
1963
1956
|
const guild = Bot.client.guilds.cache.get(guildId);
|
|
@@ -1965,27 +1958,27 @@ var ForumChannelManager = class extends GuildChannelManager {
|
|
|
1965
1958
|
Log.warn(`Guild ${guildId} not found`);
|
|
1966
1959
|
return [];
|
|
1967
1960
|
}
|
|
1968
|
-
return Array.from(guild.channels.cache.values()).filter((c) => c instanceof
|
|
1961
|
+
return Array.from(guild.channels.cache.values()).filter((c) => c instanceof import_discord10.ForumChannel);
|
|
1969
1962
|
}
|
|
1970
1963
|
static async create(guildId, name, options) {
|
|
1971
1964
|
return await super._create(guildId, {
|
|
1972
1965
|
name,
|
|
1973
|
-
type:
|
|
1966
|
+
type: import_discord10.ChannelType.GuildForum,
|
|
1974
1967
|
...options
|
|
1975
1968
|
});
|
|
1976
1969
|
}
|
|
1977
1970
|
};
|
|
1978
1971
|
|
|
1979
1972
|
// src/manager/guild/ChannelManager/NewsChannelManager.ts
|
|
1980
|
-
var
|
|
1973
|
+
var import_discord11 = require("discord.js");
|
|
1981
1974
|
var NewsChannelManager = class extends GuildChannelManager {
|
|
1982
1975
|
static async findInGuild(guildId, channelId) {
|
|
1983
1976
|
const channel = await super.findInGuild(guildId, channelId);
|
|
1984
|
-
return channel instanceof
|
|
1977
|
+
return channel instanceof import_discord11.NewsChannel ? channel : null;
|
|
1985
1978
|
}
|
|
1986
1979
|
static async find(channelId) {
|
|
1987
1980
|
const channel = await super.find(channelId);
|
|
1988
|
-
return channel instanceof
|
|
1981
|
+
return channel instanceof import_discord11.NewsChannel ? channel : null;
|
|
1989
1982
|
}
|
|
1990
1983
|
static findAll(guildId) {
|
|
1991
1984
|
const guild = Bot.client.guilds.cache.get(guildId);
|
|
@@ -1993,27 +1986,27 @@ var NewsChannelManager = class extends GuildChannelManager {
|
|
|
1993
1986
|
Log.warn(`Guild ${guildId} not found`);
|
|
1994
1987
|
return [];
|
|
1995
1988
|
}
|
|
1996
|
-
return Array.from(guild.channels.cache.values()).filter((c) => c instanceof
|
|
1989
|
+
return Array.from(guild.channels.cache.values()).filter((c) => c instanceof import_discord11.NewsChannel);
|
|
1997
1990
|
}
|
|
1998
1991
|
static async create(guildId, name, options) {
|
|
1999
1992
|
return await super._create(guildId, {
|
|
2000
1993
|
name,
|
|
2001
|
-
type:
|
|
1994
|
+
type: import_discord11.ChannelType.GuildAnnouncement,
|
|
2002
1995
|
...options
|
|
2003
1996
|
});
|
|
2004
1997
|
}
|
|
2005
1998
|
};
|
|
2006
1999
|
|
|
2007
2000
|
// src/manager/guild/ChannelManager/StageChannelManager.ts
|
|
2008
|
-
var
|
|
2001
|
+
var import_discord12 = require("discord.js");
|
|
2009
2002
|
var StageChannelManager = class extends GuildChannelManager {
|
|
2010
2003
|
static async findInGuild(guildId, channelId) {
|
|
2011
2004
|
const channel = await super.findInGuild(guildId, channelId);
|
|
2012
|
-
return channel instanceof
|
|
2005
|
+
return channel instanceof import_discord12.StageChannel ? channel : null;
|
|
2013
2006
|
}
|
|
2014
2007
|
static async find(channelId) {
|
|
2015
2008
|
const channel = await super.find(channelId);
|
|
2016
|
-
return channel instanceof
|
|
2009
|
+
return channel instanceof import_discord12.StageChannel ? channel : null;
|
|
2017
2010
|
}
|
|
2018
2011
|
static findAll(guildId) {
|
|
2019
2012
|
const guild = Bot.client.guilds.cache.get(guildId);
|
|
@@ -2021,12 +2014,12 @@ var StageChannelManager = class extends GuildChannelManager {
|
|
|
2021
2014
|
Log.warn(`Guild ${guildId} not found`);
|
|
2022
2015
|
return [];
|
|
2023
2016
|
}
|
|
2024
|
-
return Array.from(guild.channels.cache.values()).filter((c) => c instanceof
|
|
2017
|
+
return Array.from(guild.channels.cache.values()).filter((c) => c instanceof import_discord12.StageChannel);
|
|
2025
2018
|
}
|
|
2026
2019
|
static async create(guildId, name, options) {
|
|
2027
2020
|
return await super._create(guildId, {
|
|
2028
2021
|
name,
|
|
2029
|
-
type:
|
|
2022
|
+
type: import_discord12.ChannelType.GuildStageVoice,
|
|
2030
2023
|
...options
|
|
2031
2024
|
});
|
|
2032
2025
|
}
|
|
@@ -2074,7 +2067,7 @@ var ThreadChannelManager = class {
|
|
|
2074
2067
|
};
|
|
2075
2068
|
|
|
2076
2069
|
// src/manager/guild/ChannelManager/GuildVoiceChannelManager.ts
|
|
2077
|
-
var
|
|
2070
|
+
var import_discord13 = require("discord.js");
|
|
2078
2071
|
var GuildVoiceChannelManager = class extends GuildChannelManager {
|
|
2079
2072
|
static async findInGuild(guildId, channelId) {
|
|
2080
2073
|
const channel = await super.findInGuild(guildId, channelId);
|
|
@@ -2090,12 +2083,12 @@ var GuildVoiceChannelManager = class extends GuildChannelManager {
|
|
|
2090
2083
|
Log.warn(`Guild ${guildId} not found`);
|
|
2091
2084
|
return [];
|
|
2092
2085
|
}
|
|
2093
|
-
return Array.from(guild.channels.cache.values()).filter((c) => c instanceof
|
|
2086
|
+
return Array.from(guild.channels.cache.values()).filter((c) => c instanceof import_discord13.VoiceChannel);
|
|
2094
2087
|
}
|
|
2095
2088
|
static async create(guildId, name, options) {
|
|
2096
2089
|
return await super._create(guildId, {
|
|
2097
2090
|
name,
|
|
2098
|
-
type:
|
|
2091
|
+
type: import_discord13.ChannelType.GuildVoice,
|
|
2099
2092
|
...options
|
|
2100
2093
|
});
|
|
2101
2094
|
}
|
|
@@ -2216,7 +2209,7 @@ var GuildManager = class {
|
|
|
2216
2209
|
*/
|
|
2217
2210
|
static async fetchAllMembers(guildId, MAX_ATTEMPTS = 3, RETRY_DELAY = Time.minute.MIN_05.toMilliseconds()) {
|
|
2218
2211
|
let guild;
|
|
2219
|
-
if (guildId instanceof
|
|
2212
|
+
if (guildId instanceof import_discord14.Guild) {
|
|
2220
2213
|
guild = guildId;
|
|
2221
2214
|
} else {
|
|
2222
2215
|
let tmp = Bot.client.guilds.cache.get(guildId);
|
|
@@ -2269,10 +2262,10 @@ var GuildManager = class {
|
|
|
2269
2262
|
if (!toChannel) {
|
|
2270
2263
|
throw new Error(`To channel ${toChannelId} not found`);
|
|
2271
2264
|
}
|
|
2272
|
-
if (!(fromChannel instanceof
|
|
2265
|
+
if (!(fromChannel instanceof import_discord14.VoiceChannel || fromChannel instanceof import_discord14.StageChannel)) {
|
|
2273
2266
|
throw new Error(`From channel ${fromChannelId} is not a voice/stage channel`);
|
|
2274
2267
|
}
|
|
2275
|
-
if (!(toChannel instanceof
|
|
2268
|
+
if (!(toChannel instanceof import_discord14.VoiceChannel || toChannel instanceof import_discord14.StageChannel)) {
|
|
2276
2269
|
throw new Error(`To channel ${toChannelId} is not a voice/stage channel`);
|
|
2277
2270
|
}
|
|
2278
2271
|
if (member.voice.channelId !== fromChannelId) {
|
|
@@ -2309,7 +2302,7 @@ var UserManager = class extends BasicUserManager {
|
|
|
2309
2302
|
};
|
|
2310
2303
|
|
|
2311
2304
|
// src/manager/interactions/ModalManager.ts
|
|
2312
|
-
var
|
|
2305
|
+
var import_discord15 = require("discord.js");
|
|
2313
2306
|
var ModalManager = class _ModalManager {
|
|
2314
2307
|
/**
|
|
2315
2308
|
* Load modal from JSON file and return ModalBuilder
|
|
@@ -2335,17 +2328,17 @@ var ModalManager = class _ModalManager {
|
|
|
2335
2328
|
}
|
|
2336
2329
|
}
|
|
2337
2330
|
static jsonToBuilder(json) {
|
|
2338
|
-
const modal = new
|
|
2331
|
+
const modal = new import_discord15.ModalBuilder().setCustomId(json.customId).setTitle(json.title.slice(0, 45));
|
|
2339
2332
|
const actionRows = [];
|
|
2340
2333
|
for (const fieldJson of json.fields) {
|
|
2341
2334
|
const input = this.fieldJsonToInput(fieldJson);
|
|
2342
|
-
const row = new
|
|
2335
|
+
const row = new import_discord15.ActionRowBuilder().addComponents(input);
|
|
2343
2336
|
actionRows.push(row);
|
|
2344
2337
|
}
|
|
2345
2338
|
return modal.addComponents(...actionRows);
|
|
2346
2339
|
}
|
|
2347
2340
|
static fieldJsonToInput(fieldJson) {
|
|
2348
|
-
const input = new
|
|
2341
|
+
const input = new import_discord15.TextInputBuilder().setCustomId(fieldJson.customId).setLabel(fieldJson.title.slice(0, 45)).setPlaceholder(fieldJson.placeholder || "Enter value...").setRequired(fieldJson.required !== false).setMinLength(fieldJson.minLength || 0).setMaxLength(fieldJson.maxLength || 400);
|
|
2349
2342
|
const style = fieldJson.style;
|
|
2350
2343
|
if (typeof style === "number") {
|
|
2351
2344
|
input.setStyle(style);
|
|
@@ -2354,13 +2347,13 @@ var ModalManager = class _ModalManager {
|
|
|
2354
2347
|
case "Number":
|
|
2355
2348
|
case "Phone":
|
|
2356
2349
|
case "Date":
|
|
2357
|
-
input.setStyle(
|
|
2350
|
+
input.setStyle(import_discord15.TextInputStyle.Short);
|
|
2358
2351
|
input.setPlaceholder(
|
|
2359
2352
|
style === "Number" ? "123" : style === "Phone" ? "+33 6 12 34 56 78" : "2024-02-05"
|
|
2360
2353
|
);
|
|
2361
2354
|
break;
|
|
2362
2355
|
default:
|
|
2363
|
-
input.setStyle(
|
|
2356
|
+
input.setStyle(import_discord15.TextInputStyle.Short);
|
|
2364
2357
|
}
|
|
2365
2358
|
}
|
|
2366
2359
|
return input;
|
|
@@ -2396,13 +2389,13 @@ var ModalManager = class _ModalManager {
|
|
|
2396
2389
|
};
|
|
2397
2390
|
|
|
2398
2391
|
// src/manager/interactions/SelectMenuManager.ts
|
|
2399
|
-
var
|
|
2392
|
+
var import_discord16 = require("discord.js");
|
|
2400
2393
|
var SelectMenuManager = class {
|
|
2401
2394
|
/**
|
|
2402
2395
|
* Creates base StringSelectMenu - SIMPLE API !
|
|
2403
2396
|
*/
|
|
2404
2397
|
static create(customId, placeholder = "Select an option...") {
|
|
2405
|
-
return new
|
|
2398
|
+
return new import_discord16.StringSelectMenuBuilder().setCustomId(customId).setPlaceholder(placeholder).setMinValues(1).setMaxValues(1);
|
|
2406
2399
|
}
|
|
2407
2400
|
/**
|
|
2408
2401
|
* Quick StringSelectMenu
|
|
@@ -2420,10 +2413,10 @@ var SelectMenuManager = class {
|
|
|
2420
2413
|
* Pagination menu
|
|
2421
2414
|
*/
|
|
2422
2415
|
static paginated(customId, options, pageSize = 25) {
|
|
2423
|
-
const row = new
|
|
2416
|
+
const row = new import_discord16.ActionRowBuilder();
|
|
2424
2417
|
for (let i = 0; i < options.length; i += pageSize) {
|
|
2425
2418
|
const pageOptions = options.slice(i, i + pageSize);
|
|
2426
|
-
const menu = new
|
|
2419
|
+
const menu = new import_discord16.StringSelectMenuBuilder().setCustomId(`${customId}_page_${Math.floor(i / pageSize)}`).setPlaceholder(`Page ${Math.floor(i / pageSize) + 1}`).addOptions(pageOptions.map((opt) => {
|
|
2427
2420
|
return this.option(opt);
|
|
2428
2421
|
}));
|
|
2429
2422
|
row.addComponents(menu);
|
|
@@ -2434,25 +2427,25 @@ var SelectMenuManager = class {
|
|
|
2434
2427
|
* User Select Menu (Components V2)
|
|
2435
2428
|
*/
|
|
2436
2429
|
static users(customId, placeholder = "Select users...") {
|
|
2437
|
-
return new
|
|
2430
|
+
return new import_discord16.UserSelectMenuBuilder().setCustomId(customId).setPlaceholder(placeholder).setMinValues(1).setMaxValues(25);
|
|
2438
2431
|
}
|
|
2439
2432
|
/**
|
|
2440
2433
|
* Role Select Menu (Components V2)
|
|
2441
2434
|
*/
|
|
2442
2435
|
static roles(customId, placeholder = "Select roles...") {
|
|
2443
|
-
return new
|
|
2436
|
+
return new import_discord16.RoleSelectMenuBuilder().setCustomId(customId).setPlaceholder(placeholder).setMinValues(1).setMaxValues(25);
|
|
2444
2437
|
}
|
|
2445
2438
|
/**
|
|
2446
2439
|
* Mentionable Select Menu (Components V2)
|
|
2447
2440
|
*/
|
|
2448
2441
|
static mentionables(customId, placeholder = "Select users/roles...") {
|
|
2449
|
-
return new
|
|
2442
|
+
return new import_discord16.MentionableSelectMenuBuilder().setCustomId(customId).setPlaceholder(placeholder).setMinValues(1).setMaxValues(25);
|
|
2450
2443
|
}
|
|
2451
2444
|
/**
|
|
2452
2445
|
* Channel Select Menu (Components V2)
|
|
2453
2446
|
*/
|
|
2454
2447
|
static channels(customId, placeholder = "Select channels...", channelTypes = []) {
|
|
2455
|
-
return new
|
|
2448
|
+
return new import_discord16.ChannelSelectMenuBuilder().setCustomId(customId).setPlaceholder(placeholder).setMinValues(1).setMaxValues(25).setChannelTypes(...channelTypes);
|
|
2456
2449
|
}
|
|
2457
2450
|
static option(option) {
|
|
2458
2451
|
if (Array.isArray(option)) {
|
|
@@ -2461,7 +2454,7 @@ var SelectMenuManager = class {
|
|
|
2461
2454
|
return this._createOption(option);
|
|
2462
2455
|
}
|
|
2463
2456
|
static _createOption(option) {
|
|
2464
|
-
const builder = new
|
|
2457
|
+
const builder = new import_discord16.StringSelectMenuOptionBuilder().setLabel(option.label).setValue(option.value);
|
|
2465
2458
|
option.description && builder.setDescription(option.description);
|
|
2466
2459
|
option.emoji && builder.setEmoji(option.emoji);
|
|
2467
2460
|
return builder;
|
|
@@ -2482,7 +2475,7 @@ var SelectMenuManager = class {
|
|
|
2482
2475
|
* ActionRow
|
|
2483
2476
|
*/
|
|
2484
2477
|
static row(component) {
|
|
2485
|
-
return new
|
|
2478
|
+
return new import_discord16.ActionRowBuilder().addComponents(component);
|
|
2486
2479
|
}
|
|
2487
2480
|
/**
|
|
2488
2481
|
* Rows multiples (5 max)
|
|
@@ -2535,7 +2528,7 @@ var SimpleMutex = class {
|
|
|
2535
2528
|
// package.json
|
|
2536
2529
|
var package_default = {
|
|
2537
2530
|
name: "@spatulox/simplediscordbot",
|
|
2538
|
-
version: "1.0.
|
|
2531
|
+
version: "1.0.37",
|
|
2539
2532
|
author: "Spatulox",
|
|
2540
2533
|
description: "Simple discord bot framework to set up a bot under 30 secondes",
|
|
2541
2534
|
exports: {
|
|
@@ -2559,7 +2552,7 @@ var package_default = {
|
|
|
2559
2552
|
},
|
|
2560
2553
|
license: "MIT",
|
|
2561
2554
|
dependencies: {
|
|
2562
|
-
"@spatulox/discord-interaction-manager": "^1.0.
|
|
2555
|
+
"@spatulox/discord-interaction-manager": "^1.0.17",
|
|
2563
2556
|
"discord.js": "^14.25.1"
|
|
2564
2557
|
},
|
|
2565
2558
|
devDependencies: {
|
package/dist/index.mjs
CHANGED
|
@@ -486,7 +486,7 @@ var EmbedManager = class {
|
|
|
486
486
|
* Creates simple embed with just description
|
|
487
487
|
*/
|
|
488
488
|
static simple(description, color = null) {
|
|
489
|
-
return this.create(color).setDescription(description)
|
|
489
|
+
return this.create(color).setDescription(description);
|
|
490
490
|
}
|
|
491
491
|
/**
|
|
492
492
|
* Creates error embed
|
|
@@ -501,10 +501,10 @@ var EmbedManager = class {
|
|
|
501
501
|
return this.create(25600 /* minecraft */).setTitle("Success").setDescription(description);
|
|
502
502
|
}
|
|
503
503
|
/**
|
|
504
|
-
* Creates
|
|
504
|
+
* Creates a simply description embed
|
|
505
505
|
*/
|
|
506
506
|
static description(description) {
|
|
507
|
-
return this.create(
|
|
507
|
+
return this.create().setDescription(description).setFooter(null).setTimestamp(null);
|
|
508
508
|
}
|
|
509
509
|
/**
|
|
510
510
|
* Creates debug embed
|
|
@@ -600,20 +600,16 @@ var SendableComponentBuilder = class {
|
|
|
600
600
|
}
|
|
601
601
|
return base;
|
|
602
602
|
}
|
|
603
|
-
static buildInteraction(
|
|
603
|
+
/*static buildInteraction (content: string, epheremal?: boolean): InteractionReplyOptions | InteractionUpdateOptions;
|
|
604
|
+
static buildInteraction (component: SendableComponent | SendableComponent[], epheremal?: boolean): InteractionReplyOptions | InteractionUpdateOptions;
|
|
605
|
+
static buildInteraction (content?: string | null, component?: SendableComponent | SendableComponent[] | null, ephemeral?: boolean): InteractionReplyOptions | InteractionUpdateOptions;*/
|
|
606
|
+
static buildInteraction(content, component, ephemeral) {
|
|
604
607
|
let base = {};
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
}
|
|
608
|
-
if (typeof contentOrComponent !== "string" && !component) {
|
|
609
|
-
base = this.build(base, null, contentOrComponent);
|
|
610
|
-
}
|
|
611
|
-
if (contentOrComponent && typeof contentOrComponent === "string" && component) {
|
|
612
|
-
base = this.build(base, contentOrComponent, component);
|
|
613
|
-
}
|
|
614
|
-
if (ephemeral) {
|
|
608
|
+
this.build(base, content, component);
|
|
609
|
+
if (ephemeral || typeof component == "boolean" && component) {
|
|
615
610
|
base.flags = [MessageFlags2.Ephemeral];
|
|
616
611
|
}
|
|
612
|
+
console.log(base);
|
|
617
613
|
return base;
|
|
618
614
|
}
|
|
619
615
|
static buildMessage(contentOrComponent, component) {
|
|
@@ -875,7 +871,7 @@ var BotInteraction = class {
|
|
|
875
871
|
static async send(interaction, content, component = false, ephemeral = false) {
|
|
876
872
|
if (!interaction.isRepliable()) return false;
|
|
877
873
|
const options = this.buildReplyOptions(
|
|
878
|
-
typeof content === "string" ? content :
|
|
874
|
+
typeof content === "string" ? content : null,
|
|
879
875
|
typeof content === "string" ? component : content,
|
|
880
876
|
typeof content === "string" ? ephemeral : component
|
|
881
877
|
);
|
|
@@ -1233,11 +1229,6 @@ var WebhookManager = class {
|
|
|
1233
1229
|
// src/manager/guild/ChannelManager/GuildTextChannelManager.ts
|
|
1234
1230
|
import { TextChannel as TextChannel4, ChannelType } from "discord.js";
|
|
1235
1231
|
|
|
1236
|
-
// src/manager/guild/ChannelManager/GuildChannelManager.ts
|
|
1237
|
-
import {
|
|
1238
|
-
GuildChannel
|
|
1239
|
-
} from "discord.js";
|
|
1240
|
-
|
|
1241
1232
|
// src/manager/guild/ChannelManager/GuildMessageManager.ts
|
|
1242
1233
|
var GuildMessageManager = class {
|
|
1243
1234
|
/**
|
|
@@ -1342,9 +1333,9 @@ var _GuildChannelManager = class _GuildChannelManager {
|
|
|
1342
1333
|
static async find(channelId) {
|
|
1343
1334
|
try {
|
|
1344
1335
|
const cached = Bot.client.channels.cache.get(channelId);
|
|
1345
|
-
if (cached && cached
|
|
1336
|
+
if (cached && !cached.isDMBased()) return cached;
|
|
1346
1337
|
const channel = await Bot.client.channels.fetch(channelId);
|
|
1347
|
-
if (channel && channel
|
|
1338
|
+
if (channel && !channel.isDMBased()) return channel;
|
|
1348
1339
|
Log.warn(`Channel ${channelId} not found in any guild`);
|
|
1349
1340
|
return null;
|
|
1350
1341
|
} catch (error) {
|
|
@@ -2515,7 +2506,7 @@ var SimpleMutex = class {
|
|
|
2515
2506
|
// package.json
|
|
2516
2507
|
var package_default = {
|
|
2517
2508
|
name: "@spatulox/simplediscordbot",
|
|
2518
|
-
version: "1.0.
|
|
2509
|
+
version: "1.0.37",
|
|
2519
2510
|
author: "Spatulox",
|
|
2520
2511
|
description: "Simple discord bot framework to set up a bot under 30 secondes",
|
|
2521
2512
|
exports: {
|
|
@@ -2539,7 +2530,7 @@ var package_default = {
|
|
|
2539
2530
|
},
|
|
2540
2531
|
license: "MIT",
|
|
2541
2532
|
dependencies: {
|
|
2542
|
-
"@spatulox/discord-interaction-manager": "^1.0.
|
|
2533
|
+
"@spatulox/discord-interaction-manager": "^1.0.17",
|
|
2543
2534
|
"discord.js": "^14.25.1"
|
|
2544
2535
|
},
|
|
2545
2536
|
devDependencies: {
|
package/package.json
CHANGED
|
@@ -1,51 +1,51 @@
|
|
|
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
|
-
"exports": {
|
|
7
|
-
"types": "./dist/index.d.ts",
|
|
8
|
-
"import": "./dist/index.js",
|
|
9
|
-
"require": "./dist/index.js"
|
|
10
|
-
},
|
|
11
|
-
"types": "./dist/index.d.ts",
|
|
12
|
-
"scripts": {
|
|
13
|
-
"build": "rm -r dist/ && tsup",
|
|
14
|
-
"patch": "npm run build && npm version patch",
|
|
15
|
-
"minor": "npm run build && npm version minor",
|
|
16
|
-
"major": "npm run build && npm version major",
|
|
17
|
-
"premajor": "npm run build && npm version premajor",
|
|
18
|
-
"premajor:alpha": "npm run build && npm version premajor --preid=alpha",
|
|
19
|
-
"pub": "npm run patch && npm publish --access public",
|
|
20
|
-
"pub:major": "npm run major && npm publish --access public",
|
|
21
|
-
"pub:alpha": "npm run premajor:alpha && npm publish --tag alpha --access public",
|
|
22
|
-
"test-pack": "npm run patch && npm publish --access public",
|
|
23
|
-
"dev": "nodemon --exec tsx src/test/index.ts"
|
|
24
|
-
},
|
|
25
|
-
"license": "MIT",
|
|
26
|
-
"dependencies": {
|
|
27
|
-
"@spatulox/discord-interaction-manager": "^1.0.
|
|
28
|
-
"discord.js": "^14.25.1"
|
|
29
|
-
},
|
|
30
|
-
"devDependencies": {
|
|
31
|
-
"@types/node": "^22.14.0",
|
|
32
|
-
"@types/node-schedule": "^2.1.7",
|
|
33
|
-
"dotenv": "^17.2.4",
|
|
34
|
-
"nodemon": "^3.1.9",
|
|
35
|
-
"tsup": "^8.5.1",
|
|
36
|
-
"tsx": "^4.20.3",
|
|
37
|
-
"typescript": "^5.9.3"
|
|
38
|
-
},
|
|
39
|
-
"keywords": [
|
|
40
|
-
"discord",
|
|
41
|
-
"framework",
|
|
42
|
-
"bot",
|
|
43
|
-
"client",
|
|
44
|
-
"discordjs",
|
|
45
|
-
"discord.js",
|
|
46
|
-
"node"
|
|
47
|
-
],
|
|
48
|
-
"bugs": {
|
|
49
|
-
"url": "https://github.com/Spatulox/SimpleDiscordBot/issues"
|
|
50
|
-
}
|
|
51
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@spatulox/simplediscordbot",
|
|
3
|
+
"version": "1.0.38",
|
|
4
|
+
"author": "Spatulox",
|
|
5
|
+
"description": "Simple discord bot framework to set up a bot under 30 secondes",
|
|
6
|
+
"exports": {
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"import": "./dist/index.js",
|
|
9
|
+
"require": "./dist/index.js"
|
|
10
|
+
},
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"scripts": {
|
|
13
|
+
"build": "rm -r dist/ && tsup",
|
|
14
|
+
"patch": "npm run build && npm version patch",
|
|
15
|
+
"minor": "npm run build && npm version minor",
|
|
16
|
+
"major": "npm run build && npm version major",
|
|
17
|
+
"premajor": "npm run build && npm version premajor",
|
|
18
|
+
"premajor:alpha": "npm run build && npm version premajor --preid=alpha",
|
|
19
|
+
"pub": "npm run patch && npm publish --access public",
|
|
20
|
+
"pub:major": "npm run major && npm publish --access public",
|
|
21
|
+
"pub:alpha": "npm run premajor:alpha && npm publish --tag alpha --access public",
|
|
22
|
+
"test-pack": "npm run patch && npm publish --access public",
|
|
23
|
+
"dev": "nodemon --exec tsx src/test/index.ts"
|
|
24
|
+
},
|
|
25
|
+
"license": "MIT",
|
|
26
|
+
"dependencies": {
|
|
27
|
+
"@spatulox/discord-interaction-manager": "^1.0.17",
|
|
28
|
+
"discord.js": "^14.25.1"
|
|
29
|
+
},
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"@types/node": "^22.14.0",
|
|
32
|
+
"@types/node-schedule": "^2.1.7",
|
|
33
|
+
"dotenv": "^17.2.4",
|
|
34
|
+
"nodemon": "^3.1.9",
|
|
35
|
+
"tsup": "^8.5.1",
|
|
36
|
+
"tsx": "^4.20.3",
|
|
37
|
+
"typescript": "^5.9.3"
|
|
38
|
+
},
|
|
39
|
+
"keywords": [
|
|
40
|
+
"discord",
|
|
41
|
+
"framework",
|
|
42
|
+
"bot",
|
|
43
|
+
"client",
|
|
44
|
+
"discordjs",
|
|
45
|
+
"discord.js",
|
|
46
|
+
"node"
|
|
47
|
+
],
|
|
48
|
+
"bugs": {
|
|
49
|
+
"url": "https://github.com/Spatulox/SimpleDiscordBot/issues"
|
|
50
|
+
}
|
|
51
|
+
}
|