@spatulox/simplediscordbot 2.2.2 → 3.0.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/CHANGELOG.md +9 -2
- package/dist/index.d.mts +2 -326
- package/dist/index.d.ts +2 -326
- package/dist/index.js +164 -788
- package/dist/index.mjs +143 -757
- package/package.json +3 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
# Changelog
|
|
2
|
-
Date format : dd/mm/
|
|
3
|
-
|
|
2
|
+
Date format : dd/mm/yyyy
|
|
3
|
+
|
|
4
|
+
### 28/04/2026 - 2.2.1
|
|
5
|
+
- Changes :
|
|
6
|
+
- Add dependency to @spatulox/utils
|
|
7
|
+
- `Time/Log/SimpleMutex` are now part of the `@spatulox/utils` package but are still reexported from this package
|
|
8
|
+
- `FileManager/CacheManager` are now part of the `@spatulox/utils` package but are still reexported from this package
|
|
9
|
+
- CacheManager now have a fixed cache folder `.utilscache`
|
|
10
|
+
- The `sendErrorToChannel` param of FileManager.writeJsonFile() have been removed
|
|
4
11
|
|
|
5
12
|
### 27/04/2026 - 2.2.1
|
|
6
13
|
- Add :
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { EmbedBuilder, ContainerBuilder, ActionRowBuilder, MessageActionRowComponentBuilder, Message, TextChannel, DMChannel, ThreadChannel, MessageCreateOptions, User, GuildMember, BaseInteraction, InteractionResponse, Client, ActivityType, InteractionDeferReplyOptions, InteractionReplyOptions, InteractionEditReplyOptions, Snowflake, WebhookMessageCreateOptions, EmojiResolvable, Guild, BanOptions, GuildBasedChannel, GuildChannelCreateOptions, ForumChannel, NewsChannel, StageChannel, StartThreadOptions, VoiceChannel, Invite, Channel, Collection, GuildBan, ModalBuilder, StringSelectMenuBuilder, UserSelectMenuBuilder, RoleSelectMenuBuilder, MentionableSelectMenuBuilder, ChannelSelectMenuBuilder, ChannelType, SeparatorSpacingSize, ButtonBuilder, AttachmentBuilder, ButtonStyle } from 'discord.js';
|
|
2
2
|
import { BaseSelectMenuBuilder } from '@discordjs/builders';
|
|
3
|
+
export { CacheManager, FileManager, Log, SimpleMutex, Time } from '@spatulox/utils';
|
|
3
4
|
|
|
4
5
|
type SendableComponent = EmbedBuilder | ContainerBuilder | BaseSelectMenuBuilder<any> | ActionRowBuilder<MessageActionRowComponentBuilder>;
|
|
5
6
|
|
|
@@ -157,120 +158,6 @@ declare const BotEnv: {
|
|
|
157
158
|
readonly dev: boolean;
|
|
158
159
|
};
|
|
159
160
|
|
|
160
|
-
declare class FileManager {
|
|
161
|
-
/**
|
|
162
|
-
* Check if a file exist
|
|
163
|
-
* @param filePath File path with file name
|
|
164
|
-
* @returns true si le fichier existe, false sinon
|
|
165
|
-
*/
|
|
166
|
-
static fileExists(filePath: string): Promise<boolean>;
|
|
167
|
-
/**
|
|
168
|
-
* Reads a JSON file synchronously.
|
|
169
|
-
* @param filePath Full path to the JSON file
|
|
170
|
-
* @returns Parsed JSON object or 'Error' string on failure
|
|
171
|
-
*/
|
|
172
|
-
static readJsonFile<T = any>(filePath: string): Promise<T | false>;
|
|
173
|
-
/**
|
|
174
|
-
* Lists all directories in a given path.
|
|
175
|
-
* @param directoryPath Path to scan for directories
|
|
176
|
-
* @returns Array of directory names or false on error
|
|
177
|
-
*/
|
|
178
|
-
static listDirectories(directoryPath: string): Promise<string[] | false>;
|
|
179
|
-
/**
|
|
180
|
-
* Lists all JSON files in a directory.
|
|
181
|
-
* @param directoryPath Path to scan for JSON files
|
|
182
|
-
* @returns Array of JSON filenames or false on error
|
|
183
|
-
*/
|
|
184
|
-
static listJsonFiles(directoryPath: string): Promise<string[] | false>;
|
|
185
|
-
/**
|
|
186
|
-
* Lists files with specific extension in a directory.
|
|
187
|
-
* @param directoryPath Path to scan
|
|
188
|
-
* @param extension File extension (with or without dot)
|
|
189
|
-
* @returns Array of matching filenames or 'Error' string on failure
|
|
190
|
-
*/
|
|
191
|
-
static listFiles(directoryPath: string, extension: string): Promise<string[] | false>;
|
|
192
|
-
/**
|
|
193
|
-
* Creates directory structure and writes JSON data to file.
|
|
194
|
-
* @param directoryPath Full directory path (creates if missing)
|
|
195
|
-
* @param filename Filename without extension
|
|
196
|
-
* @param data Data to write (JSON serializable)
|
|
197
|
-
* @param sendErrorToErrorChannel Send error to the error channel
|
|
198
|
-
* @returns true on success, false on failure
|
|
199
|
-
*/
|
|
200
|
-
static writeJsonFile(directoryPath: string, filename: string, data: any, sendErrorToErrorChannel?: boolean): Promise<boolean>;
|
|
201
|
-
/**
|
|
202
|
-
* Delete a file
|
|
203
|
-
* @param filePath Full file path
|
|
204
|
-
* @returns true si supprimé avec succès, false sinon
|
|
205
|
-
*/
|
|
206
|
-
static deleteFile(filePath: string): Promise<boolean>;
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
declare class CacheManager {
|
|
210
|
-
private static get cacheDir();
|
|
211
|
-
private static cleanCacheId;
|
|
212
|
-
private static createFilePath;
|
|
213
|
-
/**
|
|
214
|
-
* New file with cache_id as name
|
|
215
|
-
* @param cache_id - id which become the cache file name
|
|
216
|
-
* @param initialData - optional initial data
|
|
217
|
-
* @returns true if success, false otherwise
|
|
218
|
-
*/
|
|
219
|
-
static createCache(cache_id: string, initialData?: any): Promise<boolean>;
|
|
220
|
-
/**
|
|
221
|
-
* Read cache data or create empty one
|
|
222
|
-
* @param cache_id
|
|
223
|
-
* @param default_data default data with default key/value This will be send back if the cache doesn't exist and need to be created
|
|
224
|
-
* @returns true if success, false otherwise
|
|
225
|
-
*/
|
|
226
|
-
static getOrCreateCache<T = any>(cache_id: string, default_data: T): Promise<T | false>;
|
|
227
|
-
/**
|
|
228
|
-
* Read cache data
|
|
229
|
-
* @param cache_id - cache_id to read
|
|
230
|
-
* @returns Json data, false otherwise
|
|
231
|
-
*/
|
|
232
|
-
static readCache<T = any>(cache_id: string): Promise<T | false>;
|
|
233
|
-
/**
|
|
234
|
-
* Overwrite cache data with the new data
|
|
235
|
-
* @param cache_id - ID of the cache
|
|
236
|
-
* @param data - new data
|
|
237
|
-
* @returns true if success, false otherwise
|
|
238
|
-
*/
|
|
239
|
-
static writeCache(cache_id: string, data: any): Promise<boolean>;
|
|
240
|
-
/**
|
|
241
|
-
* Update specific property of the cache
|
|
242
|
-
* @param cache_id - ID of the cache
|
|
243
|
-
* @param property - property to update, with key and value
|
|
244
|
-
* @returns true if success, false otherwise
|
|
245
|
-
*/
|
|
246
|
-
static updateCacheProperty(cache_id: string, property: {
|
|
247
|
-
key: string;
|
|
248
|
-
value: any;
|
|
249
|
-
}): Promise<boolean>;
|
|
250
|
-
/**
|
|
251
|
-
* Reset an entire cache
|
|
252
|
-
* @param cache_id - cache ID to reset
|
|
253
|
-
* @returns true if success, false otherwise
|
|
254
|
-
*/
|
|
255
|
-
static resetCache(cache_id: string): Promise<boolean>;
|
|
256
|
-
/**
|
|
257
|
-
* Delete an entire cache
|
|
258
|
-
* @param cache_id - cache ID to delete
|
|
259
|
-
* @returns true if success, false otherwise
|
|
260
|
-
*/
|
|
261
|
-
static deleteCache(cache_id: string): Promise<boolean>;
|
|
262
|
-
/**
|
|
263
|
-
* List every existing cache
|
|
264
|
-
* @returns Array of cache_id, false otherwise
|
|
265
|
-
*/
|
|
266
|
-
static listCaches(): Promise<string[] | false>;
|
|
267
|
-
/**
|
|
268
|
-
* Clean cache data
|
|
269
|
-
* @returns true if success, false otherwise
|
|
270
|
-
*/
|
|
271
|
-
static clearAllCaches(): Promise<boolean>;
|
|
272
|
-
}
|
|
273
|
-
|
|
274
161
|
declare class EmbedManager {
|
|
275
162
|
private static get BOT_ICON();
|
|
276
163
|
private static get DEFAULT_COLOR();
|
|
@@ -878,217 +765,6 @@ declare class ButtonManager {
|
|
|
878
765
|
private static createRowsToReturn;
|
|
879
766
|
}
|
|
880
767
|
|
|
881
|
-
declare class UnitTime {
|
|
882
|
-
private readonly val;
|
|
883
|
-
constructor(val: number);
|
|
884
|
-
toMilliseconds(): number;
|
|
885
|
-
toSeconds(): number;
|
|
886
|
-
toMinutes(): number;
|
|
887
|
-
toHours(): number;
|
|
888
|
-
toDays(): number;
|
|
889
|
-
toString(): string;
|
|
890
|
-
valueOf(): number;
|
|
891
|
-
value(): number;
|
|
892
|
-
}
|
|
893
|
-
declare const Time: {
|
|
894
|
-
milisecond: {
|
|
895
|
-
MS_100: UnitTime;
|
|
896
|
-
MS_200: UnitTime;
|
|
897
|
-
MS_500: UnitTime;
|
|
898
|
-
MS_800: UnitTime;
|
|
899
|
-
MS_1000: UnitTime;
|
|
900
|
-
};
|
|
901
|
-
second: {
|
|
902
|
-
SEC_01: UnitTime;
|
|
903
|
-
SEC_02: UnitTime;
|
|
904
|
-
SEC_03: UnitTime;
|
|
905
|
-
SEC_04: UnitTime;
|
|
906
|
-
SEC_05: UnitTime;
|
|
907
|
-
SEC_06: UnitTime;
|
|
908
|
-
SEC_07: UnitTime;
|
|
909
|
-
SEC_08: UnitTime;
|
|
910
|
-
SEC_09: UnitTime;
|
|
911
|
-
SEC_10: UnitTime;
|
|
912
|
-
SEC_11: UnitTime;
|
|
913
|
-
SEC_12: UnitTime;
|
|
914
|
-
SEC_13: UnitTime;
|
|
915
|
-
SEC_14: UnitTime;
|
|
916
|
-
SEC_15: UnitTime;
|
|
917
|
-
SEC_16: UnitTime;
|
|
918
|
-
SEC_17: UnitTime;
|
|
919
|
-
SEC_18: UnitTime;
|
|
920
|
-
SEC_19: UnitTime;
|
|
921
|
-
SEC_20: UnitTime;
|
|
922
|
-
SEC_21: UnitTime;
|
|
923
|
-
SEC_22: UnitTime;
|
|
924
|
-
SEC_23: UnitTime;
|
|
925
|
-
SEC_24: UnitTime;
|
|
926
|
-
SEC_25: UnitTime;
|
|
927
|
-
SEC_26: UnitTime;
|
|
928
|
-
SEC_27: UnitTime;
|
|
929
|
-
SEC_28: UnitTime;
|
|
930
|
-
SEC_29: UnitTime;
|
|
931
|
-
SEC_30: UnitTime;
|
|
932
|
-
SEC_31: UnitTime;
|
|
933
|
-
SEC_32: UnitTime;
|
|
934
|
-
SEC_33: UnitTime;
|
|
935
|
-
SEC_34: UnitTime;
|
|
936
|
-
SEC_35: UnitTime;
|
|
937
|
-
SEC_36: UnitTime;
|
|
938
|
-
SEC_37: UnitTime;
|
|
939
|
-
SEC_38: UnitTime;
|
|
940
|
-
SEC_39: UnitTime;
|
|
941
|
-
SEC_40: UnitTime;
|
|
942
|
-
SEC_41: UnitTime;
|
|
943
|
-
SEC_42: UnitTime;
|
|
944
|
-
SEC_43: UnitTime;
|
|
945
|
-
SEC_44: UnitTime;
|
|
946
|
-
SEC_45: UnitTime;
|
|
947
|
-
SEC_46: UnitTime;
|
|
948
|
-
SEC_47: UnitTime;
|
|
949
|
-
SEC_48: UnitTime;
|
|
950
|
-
SEC_49: UnitTime;
|
|
951
|
-
SEC_50: UnitTime;
|
|
952
|
-
SEC_51: UnitTime;
|
|
953
|
-
SEC_52: UnitTime;
|
|
954
|
-
SEC_53: UnitTime;
|
|
955
|
-
SEC_54: UnitTime;
|
|
956
|
-
SEC_55: UnitTime;
|
|
957
|
-
SEC_56: UnitTime;
|
|
958
|
-
SEC_57: UnitTime;
|
|
959
|
-
SEC_58: UnitTime;
|
|
960
|
-
SEC_59: UnitTime;
|
|
961
|
-
SEC_60: UnitTime;
|
|
962
|
-
};
|
|
963
|
-
minute: {
|
|
964
|
-
MIN_01: UnitTime;
|
|
965
|
-
MIN_02: UnitTime;
|
|
966
|
-
MIN_03: UnitTime;
|
|
967
|
-
MIN_04: UnitTime;
|
|
968
|
-
MIN_05: UnitTime;
|
|
969
|
-
MIN_06: UnitTime;
|
|
970
|
-
MIN_07: UnitTime;
|
|
971
|
-
MIN_08: UnitTime;
|
|
972
|
-
MIN_09: UnitTime;
|
|
973
|
-
MIN_10: UnitTime;
|
|
974
|
-
MIN_11: UnitTime;
|
|
975
|
-
MIN_12: UnitTime;
|
|
976
|
-
MIN_13: UnitTime;
|
|
977
|
-
MIN_14: UnitTime;
|
|
978
|
-
MIN_15: UnitTime;
|
|
979
|
-
MIN_16: UnitTime;
|
|
980
|
-
MIN_17: UnitTime;
|
|
981
|
-
MIN_18: UnitTime;
|
|
982
|
-
MIN_19: UnitTime;
|
|
983
|
-
MIN_20: UnitTime;
|
|
984
|
-
MIN_21: UnitTime;
|
|
985
|
-
MIN_22: UnitTime;
|
|
986
|
-
MIN_23: UnitTime;
|
|
987
|
-
MIN_24: UnitTime;
|
|
988
|
-
MIN_25: UnitTime;
|
|
989
|
-
MIN_26: UnitTime;
|
|
990
|
-
MIN_27: UnitTime;
|
|
991
|
-
MIN_28: UnitTime;
|
|
992
|
-
MIN_29: UnitTime;
|
|
993
|
-
MIN_30: UnitTime;
|
|
994
|
-
MIN_31: UnitTime;
|
|
995
|
-
MIN_32: UnitTime;
|
|
996
|
-
MIN_33: UnitTime;
|
|
997
|
-
MIN_34: UnitTime;
|
|
998
|
-
MIN_35: UnitTime;
|
|
999
|
-
MIN_36: UnitTime;
|
|
1000
|
-
MIN_37: UnitTime;
|
|
1001
|
-
MIN_38: UnitTime;
|
|
1002
|
-
MIN_39: UnitTime;
|
|
1003
|
-
MIN_40: UnitTime;
|
|
1004
|
-
MIN_41: UnitTime;
|
|
1005
|
-
MIN_42: UnitTime;
|
|
1006
|
-
MIN_43: UnitTime;
|
|
1007
|
-
MIN_44: UnitTime;
|
|
1008
|
-
MIN_45: UnitTime;
|
|
1009
|
-
MIN_46: UnitTime;
|
|
1010
|
-
MIN_47: UnitTime;
|
|
1011
|
-
MIN_48: UnitTime;
|
|
1012
|
-
MIN_49: UnitTime;
|
|
1013
|
-
MIN_50: UnitTime;
|
|
1014
|
-
MIN_51: UnitTime;
|
|
1015
|
-
MIN_52: UnitTime;
|
|
1016
|
-
MIN_53: UnitTime;
|
|
1017
|
-
MIN_54: UnitTime;
|
|
1018
|
-
MIN_55: UnitTime;
|
|
1019
|
-
MIN_56: UnitTime;
|
|
1020
|
-
MIN_57: UnitTime;
|
|
1021
|
-
MIN_58: UnitTime;
|
|
1022
|
-
MIN_59: UnitTime;
|
|
1023
|
-
MIN_60: UnitTime;
|
|
1024
|
-
};
|
|
1025
|
-
hour: {
|
|
1026
|
-
HOUR_01: UnitTime;
|
|
1027
|
-
HOUR_02: UnitTime;
|
|
1028
|
-
HOUR_03: UnitTime;
|
|
1029
|
-
HOUR_04: UnitTime;
|
|
1030
|
-
HOUR_05: UnitTime;
|
|
1031
|
-
HOUR_06: UnitTime;
|
|
1032
|
-
HOUR_07: UnitTime;
|
|
1033
|
-
HOUR_08: UnitTime;
|
|
1034
|
-
HOUR_09: UnitTime;
|
|
1035
|
-
HOUR_10: UnitTime;
|
|
1036
|
-
HOUR_11: UnitTime;
|
|
1037
|
-
HOUR_12: UnitTime;
|
|
1038
|
-
HOUR_13: UnitTime;
|
|
1039
|
-
HOUR_14: UnitTime;
|
|
1040
|
-
HOUR_15: UnitTime;
|
|
1041
|
-
HOUR_16: UnitTime;
|
|
1042
|
-
HOUR_17: UnitTime;
|
|
1043
|
-
HOUR_18: UnitTime;
|
|
1044
|
-
HOUR_19: UnitTime;
|
|
1045
|
-
HOUR_20: UnitTime;
|
|
1046
|
-
HOUR_21: UnitTime;
|
|
1047
|
-
HOUR_22: UnitTime;
|
|
1048
|
-
HOUR_23: UnitTime;
|
|
1049
|
-
HOUR_24: UnitTime;
|
|
1050
|
-
};
|
|
1051
|
-
day: {
|
|
1052
|
-
DAY_01: UnitTime;
|
|
1053
|
-
DAY_02: UnitTime;
|
|
1054
|
-
DAY_03: UnitTime;
|
|
1055
|
-
DAY_04: UnitTime;
|
|
1056
|
-
DAY_05: UnitTime;
|
|
1057
|
-
DAY_06: UnitTime;
|
|
1058
|
-
DAY_07: UnitTime;
|
|
1059
|
-
DAY_08: UnitTime;
|
|
1060
|
-
DAY_09: UnitTime;
|
|
1061
|
-
DAY_10: UnitTime;
|
|
1062
|
-
};
|
|
1063
|
-
readonly DAY: boolean;
|
|
1064
|
-
readonly NIGHT: boolean;
|
|
1065
|
-
};
|
|
1066
|
-
|
|
1067
|
-
declare class Log {
|
|
1068
|
-
private static getPrefix;
|
|
1069
|
-
static info(message: string): void;
|
|
1070
|
-
static warn(message: string): void;
|
|
1071
|
-
static error(message: string): void;
|
|
1072
|
-
static debug(message: string): void;
|
|
1073
|
-
static table(data: Record<string, any>[]): void;
|
|
1074
|
-
}
|
|
1075
|
-
|
|
1076
|
-
declare class SimpleMutex {
|
|
1077
|
-
private _locked;
|
|
1078
|
-
private queue;
|
|
1079
|
-
constructor();
|
|
1080
|
-
/**
|
|
1081
|
-
* Verrouille le mutex. Si le mutex est déjà verrouillé, la méthode retourne une promesse qui sera résolue une fois que le mutex sera disponible.
|
|
1082
|
-
* @returns Une promesse résolue lorsque le mutex est verrouillé.
|
|
1083
|
-
*/
|
|
1084
|
-
lock(): Promise<void>;
|
|
1085
|
-
/**
|
|
1086
|
-
* Déverrouille le mutex. Si une file d'attente existe, débloque le prochain élément dans la file.
|
|
1087
|
-
*/
|
|
1088
|
-
unlock(): void;
|
|
1089
|
-
get locked(): boolean;
|
|
1090
|
-
}
|
|
1091
|
-
|
|
1092
768
|
/**
|
|
1093
769
|
* Classe utilitaire pour valider tous les formats Discord avec regex
|
|
1094
770
|
*/
|
|
@@ -1163,4 +839,4 @@ declare const SimpleDiscordBotInfo: {
|
|
|
1163
839
|
license: string;
|
|
1164
840
|
};
|
|
1165
841
|
|
|
1166
|
-
export { Bot, type BotConfig, BotEnv, ButtonManager, type ButtonOptions,
|
|
842
|
+
export { Bot, type BotConfig, BotEnv, ButtonManager, type ButtonOptions, ComponentManager, type ComponentManagerCreate, type ComponentManagerField, type ComponentManagerFileInput, DiscordRegex, EmbedManager, GuildManager, type ModalField, ModalFieldType, ModalManager, type RandomBotActivity, ReactionManager, type SelectMenuCreateOption, type SelectMenuList, SelectMenuManager, SimpleColor, SimpleDiscordBotInfo, UserManager, WebhookManager };
|