@spatulox/simplediscordbot 1.0.41 → 1.1.0
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/dist/index.d.mts +1 -2
- package/dist/index.d.ts +1 -2
- package/dist/index.js +50 -58
- package/dist/index.mjs +14 -26
- package/package.json +4 -6
package/dist/index.d.mts
CHANGED
|
@@ -341,7 +341,6 @@ declare abstract class BasicUserManager {
|
|
|
341
341
|
}
|
|
342
342
|
|
|
343
343
|
declare class GuildUserManager extends BasicUserManager {
|
|
344
|
-
static find(userId: string, guild: Guild | string): Promise<GuildMember | null>;
|
|
345
344
|
static rename(member: GuildMember, nickname: string, maxAttempts?: number): Promise<boolean>;
|
|
346
345
|
/**
|
|
347
346
|
* Check if user is banned from guild
|
|
@@ -529,7 +528,7 @@ declare class GuildManager {
|
|
|
529
528
|
static readonly channel: typeof GuildChannelList;
|
|
530
529
|
static readonly invite: typeof InviteManager;
|
|
531
530
|
static list(): Guild[];
|
|
532
|
-
static find(guild_id: string): Promise<Guild>;
|
|
531
|
+
static find(guild_id: string): Promise<Guild | null>;
|
|
533
532
|
/**
|
|
534
533
|
* Search channel by ID (TextChannel, DMChannel, ThreadChannel)
|
|
535
534
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -341,7 +341,6 @@ declare abstract class BasicUserManager {
|
|
|
341
341
|
}
|
|
342
342
|
|
|
343
343
|
declare class GuildUserManager extends BasicUserManager {
|
|
344
|
-
static find(userId: string, guild: Guild | string): Promise<GuildMember | null>;
|
|
345
344
|
static rename(member: GuildMember, nickname: string, maxAttempts?: number): Promise<boolean>;
|
|
346
345
|
/**
|
|
347
346
|
* Check if user is banned from guild
|
|
@@ -529,7 +528,7 @@ declare class GuildManager {
|
|
|
529
528
|
static readonly channel: typeof GuildChannelList;
|
|
530
529
|
static readonly invite: typeof InviteManager;
|
|
531
530
|
static list(): Guild[];
|
|
532
|
-
static find(guild_id: string): Promise<Guild>;
|
|
531
|
+
static find(guild_id: string): Promise<Guild | null>;
|
|
533
532
|
/**
|
|
534
533
|
* Search channel by ID (TextChannel, DMChannel, ThreadChannel)
|
|
535
534
|
*/
|
package/dist/index.js
CHANGED
|
@@ -1559,7 +1559,7 @@ var ReactionManager = class {
|
|
|
1559
1559
|
};
|
|
1560
1560
|
|
|
1561
1561
|
// src/manager/guild/GuildManager.ts
|
|
1562
|
-
var
|
|
1562
|
+
var import_discord13 = require("discord.js");
|
|
1563
1563
|
|
|
1564
1564
|
// src/manager/direct/BasicUserManager.ts
|
|
1565
1565
|
var import_discord8 = require("discord.js");
|
|
@@ -1634,22 +1634,9 @@ var BasicUserManager = class {
|
|
|
1634
1634
|
};
|
|
1635
1635
|
|
|
1636
1636
|
// src/manager/guild/GuildUserManager.ts
|
|
1637
|
-
var import_discord9 = require("discord.js");
|
|
1638
1637
|
var import_promises2 = require("timers/promises");
|
|
1639
1638
|
var MAX_NICKNAME_LENGTH = 32;
|
|
1640
1639
|
var GuildUserManager = class extends BasicUserManager {
|
|
1641
|
-
static async find(userId, guild) {
|
|
1642
|
-
try {
|
|
1643
|
-
if (guild instanceof import_discord9.Guild) {
|
|
1644
|
-
return await guild.members.fetch(userId);
|
|
1645
|
-
} else {
|
|
1646
|
-
return await (await GuildManager.find(guild)).members.fetch(userId);
|
|
1647
|
-
}
|
|
1648
|
-
} catch (error) {
|
|
1649
|
-
Log.error(`UserManager: Member ${userId} not found`);
|
|
1650
|
-
return null;
|
|
1651
|
-
}
|
|
1652
|
-
}
|
|
1653
1640
|
static async rename(member, nickname, maxAttempts = 3) {
|
|
1654
1641
|
if (nickname.length > MAX_NICKNAME_LENGTH) {
|
|
1655
1642
|
nickname = nickname.slice(0, MAX_NICKNAME_LENGTH);
|
|
@@ -1938,15 +1925,15 @@ var RoleManager = class {
|
|
|
1938
1925
|
};
|
|
1939
1926
|
|
|
1940
1927
|
// src/manager/guild/ChannelManager/ForumChannelManager.ts
|
|
1941
|
-
var
|
|
1928
|
+
var import_discord9 = require("discord.js");
|
|
1942
1929
|
var ForumChannelManager = class extends GuildChannelManager {
|
|
1943
1930
|
static async findInGuild(guildId, channelId) {
|
|
1944
1931
|
const channel = await super.findInGuild(guildId, channelId);
|
|
1945
|
-
return channel instanceof
|
|
1932
|
+
return channel instanceof import_discord9.ForumChannel ? channel : null;
|
|
1946
1933
|
}
|
|
1947
1934
|
static async find(channelId) {
|
|
1948
1935
|
const channel = await super.find(channelId);
|
|
1949
|
-
return channel instanceof
|
|
1936
|
+
return channel instanceof import_discord9.ForumChannel ? channel : null;
|
|
1950
1937
|
}
|
|
1951
1938
|
static findAll(guildId) {
|
|
1952
1939
|
const guild = Bot.client.guilds.cache.get(guildId);
|
|
@@ -1954,27 +1941,27 @@ var ForumChannelManager = class extends GuildChannelManager {
|
|
|
1954
1941
|
Log.warn(`Guild ${guildId} not found`);
|
|
1955
1942
|
return [];
|
|
1956
1943
|
}
|
|
1957
|
-
return Array.from(guild.channels.cache.values()).filter((c) => c instanceof
|
|
1944
|
+
return Array.from(guild.channels.cache.values()).filter((c) => c instanceof import_discord9.ForumChannel);
|
|
1958
1945
|
}
|
|
1959
1946
|
static async create(guildId, name, options) {
|
|
1960
1947
|
return await super._create(guildId, {
|
|
1961
1948
|
name,
|
|
1962
|
-
type:
|
|
1949
|
+
type: import_discord9.ChannelType.GuildForum,
|
|
1963
1950
|
...options
|
|
1964
1951
|
});
|
|
1965
1952
|
}
|
|
1966
1953
|
};
|
|
1967
1954
|
|
|
1968
1955
|
// src/manager/guild/ChannelManager/NewsChannelManager.ts
|
|
1969
|
-
var
|
|
1956
|
+
var import_discord10 = require("discord.js");
|
|
1970
1957
|
var NewsChannelManager = class extends GuildChannelManager {
|
|
1971
1958
|
static async findInGuild(guildId, channelId) {
|
|
1972
1959
|
const channel = await super.findInGuild(guildId, channelId);
|
|
1973
|
-
return channel instanceof
|
|
1960
|
+
return channel instanceof import_discord10.NewsChannel ? channel : null;
|
|
1974
1961
|
}
|
|
1975
1962
|
static async find(channelId) {
|
|
1976
1963
|
const channel = await super.find(channelId);
|
|
1977
|
-
return channel instanceof
|
|
1964
|
+
return channel instanceof import_discord10.NewsChannel ? channel : null;
|
|
1978
1965
|
}
|
|
1979
1966
|
static findAll(guildId) {
|
|
1980
1967
|
const guild = Bot.client.guilds.cache.get(guildId);
|
|
@@ -1982,27 +1969,27 @@ var NewsChannelManager = class extends GuildChannelManager {
|
|
|
1982
1969
|
Log.warn(`Guild ${guildId} not found`);
|
|
1983
1970
|
return [];
|
|
1984
1971
|
}
|
|
1985
|
-
return Array.from(guild.channels.cache.values()).filter((c) => c instanceof
|
|
1972
|
+
return Array.from(guild.channels.cache.values()).filter((c) => c instanceof import_discord10.NewsChannel);
|
|
1986
1973
|
}
|
|
1987
1974
|
static async create(guildId, name, options) {
|
|
1988
1975
|
return await super._create(guildId, {
|
|
1989
1976
|
name,
|
|
1990
|
-
type:
|
|
1977
|
+
type: import_discord10.ChannelType.GuildAnnouncement,
|
|
1991
1978
|
...options
|
|
1992
1979
|
});
|
|
1993
1980
|
}
|
|
1994
1981
|
};
|
|
1995
1982
|
|
|
1996
1983
|
// src/manager/guild/ChannelManager/StageChannelManager.ts
|
|
1997
|
-
var
|
|
1984
|
+
var import_discord11 = require("discord.js");
|
|
1998
1985
|
var StageChannelManager = class extends GuildChannelManager {
|
|
1999
1986
|
static async findInGuild(guildId, channelId) {
|
|
2000
1987
|
const channel = await super.findInGuild(guildId, channelId);
|
|
2001
|
-
return channel instanceof
|
|
1988
|
+
return channel instanceof import_discord11.StageChannel ? channel : null;
|
|
2002
1989
|
}
|
|
2003
1990
|
static async find(channelId) {
|
|
2004
1991
|
const channel = await super.find(channelId);
|
|
2005
|
-
return channel instanceof
|
|
1992
|
+
return channel instanceof import_discord11.StageChannel ? channel : null;
|
|
2006
1993
|
}
|
|
2007
1994
|
static findAll(guildId) {
|
|
2008
1995
|
const guild = Bot.client.guilds.cache.get(guildId);
|
|
@@ -2010,12 +1997,12 @@ var StageChannelManager = class extends GuildChannelManager {
|
|
|
2010
1997
|
Log.warn(`Guild ${guildId} not found`);
|
|
2011
1998
|
return [];
|
|
2012
1999
|
}
|
|
2013
|
-
return Array.from(guild.channels.cache.values()).filter((c) => c instanceof
|
|
2000
|
+
return Array.from(guild.channels.cache.values()).filter((c) => c instanceof import_discord11.StageChannel);
|
|
2014
2001
|
}
|
|
2015
2002
|
static async create(guildId, name, options) {
|
|
2016
2003
|
return await super._create(guildId, {
|
|
2017
2004
|
name,
|
|
2018
|
-
type:
|
|
2005
|
+
type: import_discord11.ChannelType.GuildStageVoice,
|
|
2019
2006
|
...options
|
|
2020
2007
|
});
|
|
2021
2008
|
}
|
|
@@ -2063,7 +2050,7 @@ var ThreadChannelManager = class {
|
|
|
2063
2050
|
};
|
|
2064
2051
|
|
|
2065
2052
|
// src/manager/guild/ChannelManager/GuildVoiceChannelManager.ts
|
|
2066
|
-
var
|
|
2053
|
+
var import_discord12 = require("discord.js");
|
|
2067
2054
|
var GuildVoiceChannelManager = class extends GuildChannelManager {
|
|
2068
2055
|
static async findInGuild(guildId, channelId) {
|
|
2069
2056
|
const channel = await super.findInGuild(guildId, channelId);
|
|
@@ -2079,12 +2066,12 @@ var GuildVoiceChannelManager = class extends GuildChannelManager {
|
|
|
2079
2066
|
Log.warn(`Guild ${guildId} not found`);
|
|
2080
2067
|
return [];
|
|
2081
2068
|
}
|
|
2082
|
-
return Array.from(guild.channels.cache.values()).filter((c) => c instanceof
|
|
2069
|
+
return Array.from(guild.channels.cache.values()).filter((c) => c instanceof import_discord12.VoiceChannel);
|
|
2083
2070
|
}
|
|
2084
2071
|
static async create(guildId, name, options) {
|
|
2085
2072
|
return await super._create(guildId, {
|
|
2086
2073
|
name,
|
|
2087
|
-
type:
|
|
2074
|
+
type: import_discord12.ChannelType.GuildVoice,
|
|
2088
2075
|
...options
|
|
2089
2076
|
});
|
|
2090
2077
|
}
|
|
@@ -2166,7 +2153,14 @@ var GuildManager = class {
|
|
|
2166
2153
|
return Array.from(Bot.client.guilds.cache.values());
|
|
2167
2154
|
}
|
|
2168
2155
|
static async find(guild_id) {
|
|
2169
|
-
|
|
2156
|
+
try {
|
|
2157
|
+
const cached = Bot.client.guilds.cache.get(guild_id);
|
|
2158
|
+
if (cached) return cached;
|
|
2159
|
+
return await Bot.client.guilds.fetch(guild_id);
|
|
2160
|
+
} catch (error) {
|
|
2161
|
+
Log.error(`GuildManager: Guild ${guild_id} : ${error} `);
|
|
2162
|
+
return null;
|
|
2163
|
+
}
|
|
2170
2164
|
}
|
|
2171
2165
|
/**
|
|
2172
2166
|
* Search channel by ID (TextChannel, DMChannel, ThreadChannel)
|
|
@@ -2205,7 +2199,7 @@ var GuildManager = class {
|
|
|
2205
2199
|
*/
|
|
2206
2200
|
static async fetchAllMembers(guildId, MAX_ATTEMPTS = 3, RETRY_DELAY = Time.minute.MIN_05.toMilliseconds()) {
|
|
2207
2201
|
let guild;
|
|
2208
|
-
if (guildId instanceof
|
|
2202
|
+
if (guildId instanceof import_discord13.Guild) {
|
|
2209
2203
|
guild = guildId;
|
|
2210
2204
|
} else {
|
|
2211
2205
|
let tmp = Bot.client.guilds.cache.get(guildId);
|
|
@@ -2258,10 +2252,10 @@ var GuildManager = class {
|
|
|
2258
2252
|
if (!toChannel) {
|
|
2259
2253
|
throw new Error(`To channel ${toChannelId} not found`);
|
|
2260
2254
|
}
|
|
2261
|
-
if (!(fromChannel instanceof
|
|
2255
|
+
if (!(fromChannel instanceof import_discord13.VoiceChannel || fromChannel instanceof import_discord13.StageChannel)) {
|
|
2262
2256
|
throw new Error(`From channel ${fromChannelId} is not a voice/stage channel`);
|
|
2263
2257
|
}
|
|
2264
|
-
if (!(toChannel instanceof
|
|
2258
|
+
if (!(toChannel instanceof import_discord13.VoiceChannel || toChannel instanceof import_discord13.StageChannel)) {
|
|
2265
2259
|
throw new Error(`To channel ${toChannelId} is not a voice/stage channel`);
|
|
2266
2260
|
}
|
|
2267
2261
|
if (member.voice.channelId !== fromChannelId) {
|
|
@@ -2298,7 +2292,7 @@ var UserManager = class extends BasicUserManager {
|
|
|
2298
2292
|
};
|
|
2299
2293
|
|
|
2300
2294
|
// src/manager/interactions/ModalManager.ts
|
|
2301
|
-
var
|
|
2295
|
+
var import_discord14 = require("discord.js");
|
|
2302
2296
|
var ModalManager = class _ModalManager {
|
|
2303
2297
|
/**
|
|
2304
2298
|
* Load modal from JSON file and return ModalBuilder
|
|
@@ -2324,17 +2318,17 @@ var ModalManager = class _ModalManager {
|
|
|
2324
2318
|
}
|
|
2325
2319
|
}
|
|
2326
2320
|
static jsonToBuilder(json) {
|
|
2327
|
-
const modal = new
|
|
2321
|
+
const modal = new import_discord14.ModalBuilder().setCustomId(json.customId).setTitle(json.title.slice(0, 45));
|
|
2328
2322
|
const actionRows = [];
|
|
2329
2323
|
for (const fieldJson of json.fields) {
|
|
2330
2324
|
const input = this.fieldJsonToInput(fieldJson);
|
|
2331
|
-
const row = new
|
|
2325
|
+
const row = new import_discord14.ActionRowBuilder().addComponents(input);
|
|
2332
2326
|
actionRows.push(row);
|
|
2333
2327
|
}
|
|
2334
2328
|
return modal.addComponents(...actionRows);
|
|
2335
2329
|
}
|
|
2336
2330
|
static fieldJsonToInput(fieldJson) {
|
|
2337
|
-
const input = new
|
|
2331
|
+
const input = new import_discord14.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);
|
|
2338
2332
|
const style = fieldJson.style;
|
|
2339
2333
|
if (typeof style === "number") {
|
|
2340
2334
|
input.setStyle(style);
|
|
@@ -2343,13 +2337,13 @@ var ModalManager = class _ModalManager {
|
|
|
2343
2337
|
case "Number":
|
|
2344
2338
|
case "Phone":
|
|
2345
2339
|
case "Date":
|
|
2346
|
-
input.setStyle(
|
|
2340
|
+
input.setStyle(import_discord14.TextInputStyle.Short);
|
|
2347
2341
|
input.setPlaceholder(
|
|
2348
2342
|
style === "Number" ? "123" : style === "Phone" ? "+33 6 12 34 56 78" : "2024-02-05"
|
|
2349
2343
|
);
|
|
2350
2344
|
break;
|
|
2351
2345
|
default:
|
|
2352
|
-
input.setStyle(
|
|
2346
|
+
input.setStyle(import_discord14.TextInputStyle.Short);
|
|
2353
2347
|
}
|
|
2354
2348
|
}
|
|
2355
2349
|
return input;
|
|
@@ -2385,13 +2379,13 @@ var ModalManager = class _ModalManager {
|
|
|
2385
2379
|
};
|
|
2386
2380
|
|
|
2387
2381
|
// src/manager/interactions/SelectMenuManager.ts
|
|
2388
|
-
var
|
|
2382
|
+
var import_discord15 = require("discord.js");
|
|
2389
2383
|
var SelectMenuManager = class {
|
|
2390
2384
|
/**
|
|
2391
2385
|
* Creates base StringSelectMenu - SIMPLE API !
|
|
2392
2386
|
*/
|
|
2393
2387
|
static create(customId, placeholder = "Select an option...") {
|
|
2394
|
-
return new
|
|
2388
|
+
return new import_discord15.StringSelectMenuBuilder().setCustomId(customId).setPlaceholder(placeholder).setMinValues(1).setMaxValues(1);
|
|
2395
2389
|
}
|
|
2396
2390
|
/**
|
|
2397
2391
|
* Quick StringSelectMenu
|
|
@@ -2409,10 +2403,10 @@ var SelectMenuManager = class {
|
|
|
2409
2403
|
* Pagination menu
|
|
2410
2404
|
*/
|
|
2411
2405
|
static paginated(customId, options, pageSize = 25) {
|
|
2412
|
-
const row = new
|
|
2406
|
+
const row = new import_discord15.ActionRowBuilder();
|
|
2413
2407
|
for (let i = 0; i < options.length; i += pageSize) {
|
|
2414
2408
|
const pageOptions = options.slice(i, i + pageSize);
|
|
2415
|
-
const menu = new
|
|
2409
|
+
const menu = new import_discord15.StringSelectMenuBuilder().setCustomId(`${customId}_page_${Math.floor(i / pageSize)}`).setPlaceholder(`Page ${Math.floor(i / pageSize) + 1}`).addOptions(pageOptions.map((opt) => {
|
|
2416
2410
|
return this.option(opt);
|
|
2417
2411
|
}));
|
|
2418
2412
|
row.addComponents(menu);
|
|
@@ -2423,25 +2417,25 @@ var SelectMenuManager = class {
|
|
|
2423
2417
|
* User Select Menu (Components V2)
|
|
2424
2418
|
*/
|
|
2425
2419
|
static users(customId, placeholder = "Select users...") {
|
|
2426
|
-
return new
|
|
2420
|
+
return new import_discord15.UserSelectMenuBuilder().setCustomId(customId).setPlaceholder(placeholder).setMinValues(1).setMaxValues(25);
|
|
2427
2421
|
}
|
|
2428
2422
|
/**
|
|
2429
2423
|
* Role Select Menu (Components V2)
|
|
2430
2424
|
*/
|
|
2431
2425
|
static roles(customId, placeholder = "Select roles...") {
|
|
2432
|
-
return new
|
|
2426
|
+
return new import_discord15.RoleSelectMenuBuilder().setCustomId(customId).setPlaceholder(placeholder).setMinValues(1).setMaxValues(25);
|
|
2433
2427
|
}
|
|
2434
2428
|
/**
|
|
2435
2429
|
* Mentionable Select Menu (Components V2)
|
|
2436
2430
|
*/
|
|
2437
2431
|
static mentionables(customId, placeholder = "Select users/roles...") {
|
|
2438
|
-
return new
|
|
2432
|
+
return new import_discord15.MentionableSelectMenuBuilder().setCustomId(customId).setPlaceholder(placeholder).setMinValues(1).setMaxValues(25);
|
|
2439
2433
|
}
|
|
2440
2434
|
/**
|
|
2441
2435
|
* Channel Select Menu (Components V2)
|
|
2442
2436
|
*/
|
|
2443
2437
|
static channels(customId, placeholder = "Select channels...", channelTypes = []) {
|
|
2444
|
-
return new
|
|
2438
|
+
return new import_discord15.ChannelSelectMenuBuilder().setCustomId(customId).setPlaceholder(placeholder).setMinValues(1).setMaxValues(25).setChannelTypes(...channelTypes);
|
|
2445
2439
|
}
|
|
2446
2440
|
static option(option) {
|
|
2447
2441
|
if (Array.isArray(option)) {
|
|
@@ -2450,7 +2444,7 @@ var SelectMenuManager = class {
|
|
|
2450
2444
|
return this._createOption(option);
|
|
2451
2445
|
}
|
|
2452
2446
|
static _createOption(option) {
|
|
2453
|
-
const builder = new
|
|
2447
|
+
const builder = new import_discord15.StringSelectMenuOptionBuilder().setLabel(option.label).setValue(option.value);
|
|
2454
2448
|
option.description && builder.setDescription(option.description);
|
|
2455
2449
|
option.emoji && builder.setEmoji(option.emoji);
|
|
2456
2450
|
return builder;
|
|
@@ -2471,7 +2465,7 @@ var SelectMenuManager = class {
|
|
|
2471
2465
|
* ActionRow
|
|
2472
2466
|
*/
|
|
2473
2467
|
static row(component) {
|
|
2474
|
-
return new
|
|
2468
|
+
return new import_discord15.ActionRowBuilder().addComponents(component);
|
|
2475
2469
|
}
|
|
2476
2470
|
/**
|
|
2477
2471
|
* Rows multiples (5 max)
|
|
@@ -2524,7 +2518,7 @@ var SimpleMutex = class {
|
|
|
2524
2518
|
// package.json
|
|
2525
2519
|
var package_default = {
|
|
2526
2520
|
name: "@spatulox/simplediscordbot",
|
|
2527
|
-
version: "1.0.
|
|
2521
|
+
version: "1.0.42",
|
|
2528
2522
|
author: "Spatulox",
|
|
2529
2523
|
description: "Simple discord bot framework to set up a bot under 30 secondes",
|
|
2530
2524
|
exports: {
|
|
@@ -2538,17 +2532,15 @@ var package_default = {
|
|
|
2538
2532
|
patch: "npm run build && npm version patch",
|
|
2539
2533
|
minor: "npm run build && npm version minor",
|
|
2540
2534
|
major: "npm run build && npm version major",
|
|
2541
|
-
|
|
2542
|
-
"
|
|
2543
|
-
pub: "npm run patch && npm publish --access public",
|
|
2535
|
+
"pub:patch": "npm run patch && npm publish --access public",
|
|
2536
|
+
"pub:minor": "npm run minor && npm publish --access public",
|
|
2544
2537
|
"pub:major": "npm run major && npm publish --access public",
|
|
2545
|
-
"pub:alpha": "npm run premajor:alpha && npm publish --tag alpha --access public",
|
|
2546
2538
|
"test-pack": "npm run patch && npm publish --access public",
|
|
2547
2539
|
dev: "nodemon --exec tsx src/test/index.ts"
|
|
2548
2540
|
},
|
|
2549
2541
|
license: "MIT",
|
|
2550
2542
|
dependencies: {
|
|
2551
|
-
"@spatulox/discord-interaction-manager": "^1.0.
|
|
2543
|
+
"@spatulox/discord-interaction-manager": "^1.0.21",
|
|
2552
2544
|
"discord.js": "^14.25.1"
|
|
2553
2545
|
},
|
|
2554
2546
|
devDependencies: {
|
package/dist/index.mjs
CHANGED
|
@@ -1520,11 +1520,7 @@ var ReactionManager = class {
|
|
|
1520
1520
|
};
|
|
1521
1521
|
|
|
1522
1522
|
// src/manager/guild/GuildManager.ts
|
|
1523
|
-
import {
|
|
1524
|
-
Guild as Guild3,
|
|
1525
|
-
VoiceChannel as VoiceChannel2,
|
|
1526
|
-
StageChannel as StageChannel2
|
|
1527
|
-
} from "discord.js";
|
|
1523
|
+
import { Guild as Guild2, StageChannel as StageChannel2, VoiceChannel as VoiceChannel2 } from "discord.js";
|
|
1528
1524
|
|
|
1529
1525
|
// src/manager/direct/BasicUserManager.ts
|
|
1530
1526
|
import { GuildMember as GuildMember2 } from "discord.js";
|
|
@@ -1599,22 +1595,9 @@ var BasicUserManager = class {
|
|
|
1599
1595
|
};
|
|
1600
1596
|
|
|
1601
1597
|
// src/manager/guild/GuildUserManager.ts
|
|
1602
|
-
import { Guild as Guild2 } from "discord.js";
|
|
1603
1598
|
import { setTimeout as setTimeout2 } from "timers/promises";
|
|
1604
1599
|
var MAX_NICKNAME_LENGTH = 32;
|
|
1605
1600
|
var GuildUserManager = class extends BasicUserManager {
|
|
1606
|
-
static async find(userId, guild) {
|
|
1607
|
-
try {
|
|
1608
|
-
if (guild instanceof Guild2) {
|
|
1609
|
-
return await guild.members.fetch(userId);
|
|
1610
|
-
} else {
|
|
1611
|
-
return await (await GuildManager.find(guild)).members.fetch(userId);
|
|
1612
|
-
}
|
|
1613
|
-
} catch (error) {
|
|
1614
|
-
Log.error(`UserManager: Member ${userId} not found`);
|
|
1615
|
-
return null;
|
|
1616
|
-
}
|
|
1617
|
-
}
|
|
1618
1601
|
static async rename(member, nickname, maxAttempts = 3) {
|
|
1619
1602
|
if (nickname.length > MAX_NICKNAME_LENGTH) {
|
|
1620
1603
|
nickname = nickname.slice(0, MAX_NICKNAME_LENGTH);
|
|
@@ -2131,7 +2114,14 @@ var GuildManager = class {
|
|
|
2131
2114
|
return Array.from(Bot.client.guilds.cache.values());
|
|
2132
2115
|
}
|
|
2133
2116
|
static async find(guild_id) {
|
|
2134
|
-
|
|
2117
|
+
try {
|
|
2118
|
+
const cached = Bot.client.guilds.cache.get(guild_id);
|
|
2119
|
+
if (cached) return cached;
|
|
2120
|
+
return await Bot.client.guilds.fetch(guild_id);
|
|
2121
|
+
} catch (error) {
|
|
2122
|
+
Log.error(`GuildManager: Guild ${guild_id} : ${error} `);
|
|
2123
|
+
return null;
|
|
2124
|
+
}
|
|
2135
2125
|
}
|
|
2136
2126
|
/**
|
|
2137
2127
|
* Search channel by ID (TextChannel, DMChannel, ThreadChannel)
|
|
@@ -2170,7 +2160,7 @@ var GuildManager = class {
|
|
|
2170
2160
|
*/
|
|
2171
2161
|
static async fetchAllMembers(guildId, MAX_ATTEMPTS = 3, RETRY_DELAY = Time.minute.MIN_05.toMilliseconds()) {
|
|
2172
2162
|
let guild;
|
|
2173
|
-
if (guildId instanceof
|
|
2163
|
+
if (guildId instanceof Guild2) {
|
|
2174
2164
|
guild = guildId;
|
|
2175
2165
|
} else {
|
|
2176
2166
|
let tmp = Bot.client.guilds.cache.get(guildId);
|
|
@@ -2502,7 +2492,7 @@ var SimpleMutex = class {
|
|
|
2502
2492
|
// package.json
|
|
2503
2493
|
var package_default = {
|
|
2504
2494
|
name: "@spatulox/simplediscordbot",
|
|
2505
|
-
version: "1.0.
|
|
2495
|
+
version: "1.0.42",
|
|
2506
2496
|
author: "Spatulox",
|
|
2507
2497
|
description: "Simple discord bot framework to set up a bot under 30 secondes",
|
|
2508
2498
|
exports: {
|
|
@@ -2516,17 +2506,15 @@ var package_default = {
|
|
|
2516
2506
|
patch: "npm run build && npm version patch",
|
|
2517
2507
|
minor: "npm run build && npm version minor",
|
|
2518
2508
|
major: "npm run build && npm version major",
|
|
2519
|
-
|
|
2520
|
-
"
|
|
2521
|
-
pub: "npm run patch && npm publish --access public",
|
|
2509
|
+
"pub:patch": "npm run patch && npm publish --access public",
|
|
2510
|
+
"pub:minor": "npm run minor && npm publish --access public",
|
|
2522
2511
|
"pub:major": "npm run major && npm publish --access public",
|
|
2523
|
-
"pub:alpha": "npm run premajor:alpha && npm publish --tag alpha --access public",
|
|
2524
2512
|
"test-pack": "npm run patch && npm publish --access public",
|
|
2525
2513
|
dev: "nodemon --exec tsx src/test/index.ts"
|
|
2526
2514
|
},
|
|
2527
2515
|
license: "MIT",
|
|
2528
2516
|
dependencies: {
|
|
2529
|
-
"@spatulox/discord-interaction-manager": "^1.0.
|
|
2517
|
+
"@spatulox/discord-interaction-manager": "^1.0.21",
|
|
2530
2518
|
"discord.js": "^14.25.1"
|
|
2531
2519
|
},
|
|
2532
2520
|
devDependencies: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spatulox/simplediscordbot",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"author": "Spatulox",
|
|
5
5
|
"description": "Simple discord bot framework to set up a bot under 30 secondes",
|
|
6
6
|
"exports": {
|
|
@@ -14,17 +14,15 @@
|
|
|
14
14
|
"patch": "npm run build && npm version patch",
|
|
15
15
|
"minor": "npm run build && npm version minor",
|
|
16
16
|
"major": "npm run build && npm version major",
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"pub": "npm run patch && npm publish --access public",
|
|
17
|
+
"pub:patch": "npm run patch && npm publish --access public",
|
|
18
|
+
"pub:minor": "npm run minor && npm publish --access public",
|
|
20
19
|
"pub:major": "npm run major && npm publish --access public",
|
|
21
|
-
"pub:alpha": "npm run premajor:alpha && npm publish --tag alpha --access public",
|
|
22
20
|
"test-pack": "npm run patch && npm publish --access public",
|
|
23
21
|
"dev": "nodemon --exec tsx src/test/index.ts"
|
|
24
22
|
},
|
|
25
23
|
"license": "MIT",
|
|
26
24
|
"dependencies": {
|
|
27
|
-
"@spatulox/discord-interaction-manager": "^1.0.
|
|
25
|
+
"@spatulox/discord-interaction-manager": "^1.0.21",
|
|
28
26
|
"discord.js": "^14.25.1"
|
|
29
27
|
},
|
|
30
28
|
"devDependencies": {
|