discord.js-backup-v13 13.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/LICENSE +21 -0
  2. package/lib/create.d.ts +35 -0
  3. package/lib/create.js +152 -0
  4. package/lib/index.d.ts +34 -0
  5. package/lib/index.js +240 -0
  6. package/lib/load.d.ts +30 -0
  7. package/lib/load.js +256 -0
  8. package/lib/types/AfkData.d.ts +4 -0
  9. package/lib/types/AfkData.js +2 -0
  10. package/lib/types/BackupData.d.ts +25 -0
  11. package/lib/types/BackupData.js +2 -0
  12. package/lib/types/BackupInfos.d.ts +6 -0
  13. package/lib/types/BackupInfos.js +2 -0
  14. package/lib/types/BanData.d.ts +5 -0
  15. package/lib/types/BanData.js +2 -0
  16. package/lib/types/BaseChannelData.d.ts +8 -0
  17. package/lib/types/BaseChannelData.js +2 -0
  18. package/lib/types/CategoryData.d.ts +6 -0
  19. package/lib/types/CategoryData.js +2 -0
  20. package/lib/types/ChannelPermissionData.d.ts +5 -0
  21. package/lib/types/ChannelPermissionData.js +2 -0
  22. package/lib/types/ChannelsData.d.ts +5 -0
  23. package/lib/types/ChannelsData.js +2 -0
  24. package/lib/types/CreateOptions.d.ts +9 -0
  25. package/lib/types/CreateOptions.js +2 -0
  26. package/lib/types/EmojiData.d.ts +5 -0
  27. package/lib/types/EmojiData.js +2 -0
  28. package/lib/types/LoadOptions.d.ts +6 -0
  29. package/lib/types/LoadOptions.js +2 -0
  30. package/lib/types/MemberData.d.ts +9 -0
  31. package/lib/types/MemberData.js +2 -0
  32. package/lib/types/MessageData.d.ts +10 -0
  33. package/lib/types/MessageData.js +2 -0
  34. package/lib/types/RoleData.d.ts +9 -0
  35. package/lib/types/RoleData.js +2 -0
  36. package/lib/types/TextChannelData.d.ts +10 -0
  37. package/lib/types/TextChannelData.js +2 -0
  38. package/lib/types/ThreadChannelData.d.ts +11 -0
  39. package/lib/types/ThreadChannelData.js +2 -0
  40. package/lib/types/VoiceChannelData.d.ts +5 -0
  41. package/lib/types/VoiceChannelData.js +2 -0
  42. package/lib/types/WidgetData.d.ts +4 -0
  43. package/lib/types/WidgetData.js +2 -0
  44. package/lib/types/index.d.ts +17 -0
  45. package/lib/types/index.js +33 -0
  46. package/lib/util.d.ts +27 -0
  47. package/lib/util.js +334 -0
  48. package/package.json +21 -0
package/lib/load.js ADDED
@@ -0,0 +1,256 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.loadEmbedChannel = exports.loadBans = exports.loadEmojis = exports.loadAFK = exports.loadChannels = exports.loadRoles = exports.loadConfig = void 0;
4
+ const util_1 = require("./util");
5
+ /**
6
+ * Restores the guild configuration
7
+ */
8
+ const loadConfig = (guild, backupData) => {
9
+ const configPromises = [];
10
+ if (backupData.name) {
11
+ configPromises.push(guild.setName(backupData.name));
12
+ }
13
+ if (backupData.iconBase64) {
14
+ configPromises.push(guild.setIcon(Buffer.from(backupData.iconBase64, 'base64')));
15
+ }
16
+ else if (backupData.iconURL) {
17
+ configPromises.push(guild.setIcon(backupData.iconURL));
18
+ }
19
+ if (backupData.splashBase64) {
20
+ configPromises.push(guild.setSplash(Buffer.from(backupData.splashBase64, 'base64')));
21
+ }
22
+ else if (backupData.splashURL) {
23
+ configPromises.push(guild.setSplash(backupData.splashURL));
24
+ }
25
+ if (backupData.bannerBase64) {
26
+ configPromises.push(guild.setBanner(Buffer.from(backupData.bannerBase64, 'base64')));
27
+ }
28
+ else if (backupData.bannerURL) {
29
+ configPromises.push(guild.setBanner(backupData.bannerURL));
30
+ }
31
+ if (backupData.verificationLevel) {
32
+ configPromises.push(guild.setVerificationLevel(backupData.verificationLevel));
33
+ }
34
+ if (backupData.defaultMessageNotifications) {
35
+ configPromises.push(guild.setDefaultMessageNotifications(backupData.defaultMessageNotifications));
36
+ }
37
+ const changeableExplicitLevel = guild.features.includes('COMMUNITY');
38
+ if (backupData.explicitContentFilter && changeableExplicitLevel) {
39
+ configPromises.push(guild.setExplicitContentFilter(backupData.explicitContentFilter));
40
+ }
41
+ return Promise.all(configPromises);
42
+ };
43
+ exports.loadConfig = loadConfig;
44
+ /**
45
+ * Restore the guild roles
46
+ */
47
+ const loadRoles = (guild, backupData) => {
48
+ const rolePromises = [];
49
+ backupData.roles.forEach((roleData) => {
50
+ if (roleData.isEveryone) {
51
+ rolePromises.push(guild.roles.cache.get(guild.id).edit({
52
+ name: roleData.name,
53
+ color: roleData.color,
54
+ permissions: BigInt(roleData.permissions),
55
+ mentionable: roleData.mentionable
56
+ }));
57
+ }
58
+ else {
59
+ rolePromises.push(guild.roles.create({
60
+ name: roleData.name,
61
+ color: roleData.color,
62
+ hoist: roleData.hoist,
63
+ permissions: BigInt(roleData.permissions),
64
+ mentionable: roleData.mentionable
65
+ }));
66
+ }
67
+ });
68
+ return Promise.all(rolePromises);
69
+ };
70
+ exports.loadRoles = loadRoles;
71
+ /**
72
+ * Restore the guild channels
73
+ */
74
+ const loadChannels = (guild, backupData, options) => {
75
+ const loadChannelPromises = [];
76
+ backupData.channels.categories.forEach((categoryData) => {
77
+ if (!categoryData.name) return;
78
+
79
+ loadChannelPromises.push(new Promise(async (resolve) => {
80
+ try {
81
+ const createdCategory = await (0, util_1.loadCategory)(categoryData, guild);
82
+ const childChannelPromises = [];
83
+
84
+ categoryData.children.forEach((channelData) => {
85
+ if (!channelData.name) return;
86
+ childChannelPromises.push((0, util_1.loadChannel)(channelData, guild, createdCategory, options));
87
+ });
88
+
89
+ await Promise.all(childChannelPromises);
90
+ resolve(true);
91
+ } catch (error) {
92
+ resolve(false);
93
+ }
94
+ }));
95
+ });
96
+ backupData.channels.others.forEach((channelData) => {
97
+ if (!channelData.name) return;
98
+ loadChannelPromises.push((0, util_1.loadChannel)(channelData, guild, null, options));
99
+ });
100
+ return Promise.all(loadChannelPromises);
101
+ };
102
+ exports.loadChannels = loadChannels;
103
+
104
+ /**
105
+ * Restore the afk configuration
106
+ */
107
+ const loadAFK = (guild, backupData) => {
108
+ const afkPromises = [];
109
+ if (backupData.afk) {
110
+ afkPromises.push(guild.setAFKChannel(guild.channels.cache.find((ch) => ch.name === backupData.afk.name && ch.type === 'GUILD_VOICE')));
111
+ afkPromises.push(guild.setAFKTimeout(backupData.afk.timeout));
112
+ }
113
+ return Promise.all(afkPromises);
114
+ };
115
+ exports.loadAFK = loadAFK;
116
+ /**
117
+ * Restore guild emojis
118
+ */
119
+ const loadEmojis = (guild, backupData) => {
120
+ const emojiPromises = [];
121
+ backupData.emojis.forEach((emoji) => {
122
+ if (emoji.url) {
123
+ emojiPromises.push(guild.emojis.create(emoji.url, emoji.name));
124
+ }
125
+ else if (emoji.base64) {
126
+ emojiPromises.push(guild.emojis.create(Buffer.from(emoji.base64, 'base64'), emoji.name));
127
+ }
128
+ });
129
+ return Promise.all(emojiPromises);
130
+ };
131
+ exports.loadEmojis = loadEmojis;
132
+ /**
133
+ * Restore guild bans
134
+ */
135
+ const loadBans = (guild, backupData) => {
136
+ const banPromises = [];
137
+ backupData.bans.forEach((ban) => {
138
+ banPromises.push(guild.members.ban(ban.id, {
139
+ reason: ban.reason
140
+ }));
141
+ });
142
+ return Promise.all(banPromises);
143
+ };
144
+ exports.loadBans = loadBans;
145
+ /**
146
+ * Restore embedChannel configuration
147
+ */
148
+ const loadEmbedChannel = (guild, backupData) => {
149
+ const embedChannelPromises = [];
150
+ if (backupData.widget.channel) {
151
+ embedChannelPromises.push(guild.setWidgetSettings({
152
+ enabled: backupData.widget.enabled,
153
+ channel: guild.channels.cache.find((ch) => ch.name === backupData.widget.channel)
154
+ }));
155
+ }
156
+ return Promise.all(embedChannelPromises);
157
+ };
158
+ exports.loadEmbedChannel = loadEmbedChannel;
159
+
160
+ const loadCommunity = async (guild, backupData) => {
161
+ if (!backupData.community) return;
162
+
163
+ const rulesChannelData = backupData.channels.categories.find(c => c.children.find(ch => ch.rulesChannel)) || backupData.channels.others.find(c => c.rulesChannel);
164
+ const publicUpdatesChannelData = backupData.channels.categories.find(c => c.children.find(ch => ch.publicUpdatesChannel)) || backupData.channels.others.find(c => c.publicUpdatesChannel);
165
+
166
+ let rulesChannel;
167
+ let publicUpdatesChannel;
168
+
169
+ try {
170
+ const isCommunityEnabled = guild.features.includes('COMMUNITY');
171
+ const shouldBeCommunityEnabled = backupData.community.enabled;
172
+
173
+ if (shouldBeCommunityEnabled && !isCommunityEnabled) {
174
+ if (!rulesChannel && backupData.community.rulesChannelId)
175
+ rulesChannel = guild.channels.cache.find(ch => ch.name == rulesChannelData?.name && ch.type === 'GUILD_TEXT');
176
+
177
+ if (!publicUpdatesChannel && backupData.community.publicUpdatesChannelId)
178
+ publicUpdatesChannel = guild.channels.cache.filter(ch => ch.name == publicUpdatesChannelData?.name && ch.type === 'GUILD_TEXT' && ch.id !== rulesChannel?.id).first();
179
+
180
+ if (rulesChannel && publicUpdatesChannel) {
181
+ try {
182
+ await guild.setCommunity(true, 'Backup', rulesChannel, publicUpdatesChannel);
183
+ await new Promise(r => setTimeout(r, 3000));
184
+ } catch (error) {
185
+ false
186
+ }
187
+ }
188
+ }
189
+ else if (shouldBeCommunityEnabled && isCommunityEnabled) {
190
+ const currentRulesChannel = guild.rulesChannel;
191
+ const currentPublicUpdatesChannel = guild.publicUpdatesChannel;
192
+
193
+ let newRulesChannel = null;
194
+ let newPublicUpdatesChannel = null;
195
+
196
+ if (backupData.community.rulesChannelId)
197
+ newRulesChannel = guild.channels.cache.find(ch => ch.name == rulesChannelData?.name);
198
+
199
+ if (backupData.community.publicUpdatesChannelId)
200
+ newPublicUpdatesChannel = guild.channels.cache.find(ch => ch.name == publicUpdatesChannelData?.name);
201
+
202
+ const rulesChannelChanged = newRulesChannel && currentRulesChannel?.id !== newRulesChannel.id;
203
+ const updatesChannelChanged = newPublicUpdatesChannel && currentPublicUpdatesChannel?.id !== newPublicUpdatesChannel.id;
204
+
205
+ if ((rulesChannelChanged || updatesChannelChanged) && newRulesChannel && newPublicUpdatesChannel) {
206
+ try {
207
+ await guild.setRulesChannel(newRulesChannel.id).catch(() => false);
208
+ await guild.setPublicUpdatesChannel(newPublicUpdatesChannel.id).catch(() => false);
209
+ } catch (error) { false }
210
+ currentPublicUpdatesChannel.delete().catch(() => false);
211
+ currentRulesChannel.delete().catch(() => false);
212
+ }
213
+ }
214
+ else if (!shouldBeCommunityEnabled && isCommunityEnabled)
215
+ await guild.setCommunity(false, 'Backup');
216
+ } catch (error) {
217
+ false
218
+ }
219
+ };
220
+
221
+ const loadRoleChannelPermissions = async (guild, backupData, options = {}) => {
222
+ const { Permissions } = require('discord.js-selfbot-v13');
223
+
224
+ for (const roleData of backupData.roles) {
225
+ if (!roleData.channelPermissions) continue;
226
+
227
+ let role = guild.roles.cache.find(r => r.name === roleData.name);
228
+ if (!role && roleData.isEveryone) {
229
+ role = guild.roles.cache.get(guild.id);
230
+ }
231
+
232
+ if (!role) continue;
233
+
234
+ for (const [channelName, permissions] of Object.entries(roleData.channelPermissions)) {
235
+ const channel = guild.channels.cache.find(c => c.name === channelName);
236
+ if (!channel) continue;
237
+
238
+ try {
239
+ const allowBitfield = Permissions.resolve(permissions.allow);
240
+ const denyBitfield = Permissions.resolve(permissions.deny);
241
+
242
+ await channel.permissionOverwrites.edit(role.id, {
243
+ allow: allowBitfield,
244
+ deny: denyBitfield
245
+ });
246
+
247
+ await new Promise(r => setTimeout(r, 200));
248
+ } catch (error) {
249
+ continue;
250
+ }
251
+ }
252
+ }
253
+ };
254
+
255
+ exports.loadCommunity = loadCommunity;
256
+ exports.loadRoleChannelPermissions = loadRoleChannelPermissions;
@@ -0,0 +1,4 @@
1
+ export interface AfkData {
2
+ name: string;
3
+ timeout: number;
4
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,25 @@
1
+ import { DefaultMessageNotificationLevel, ExplicitContentFilterLevel, Snowflake, VerificationLevel } from 'discord.js';
2
+ import { AfkData, BanData, ChannelsData, EmojiData, RoleData, WidgetData } from './';
3
+ import { MemberData } from './MemberData';
4
+ export interface BackupData {
5
+ name: string;
6
+ iconURL?: string;
7
+ iconBase64?: string;
8
+ verificationLevel: VerificationLevel;
9
+ explicitContentFilter: ExplicitContentFilterLevel;
10
+ defaultMessageNotifications: DefaultMessageNotificationLevel | number;
11
+ afk?: AfkData;
12
+ widget: WidgetData;
13
+ splashURL?: string;
14
+ splashBase64?: string;
15
+ bannerURL?: string;
16
+ bannerBase64?: string;
17
+ channels: ChannelsData;
18
+ roles: RoleData[];
19
+ bans: BanData[];
20
+ emojis: EmojiData[];
21
+ members: MemberData[];
22
+ createdTimestamp: number;
23
+ guildID: string;
24
+ id: Snowflake;
25
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,6 @@
1
+ import { BackupData } from './';
2
+ export interface BackupInfos {
3
+ id: string;
4
+ size: number;
5
+ data: BackupData;
6
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,5 @@
1
+ import { Snowflake } from 'discord.js';
2
+ export interface BanData {
3
+ id: Snowflake;
4
+ reason: string;
5
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,8 @@
1
+ import { TextBasedChannelTypes, VoiceBasedChannelTypes, ThreadChannelTypes } from 'discord.js';
2
+ import { ChannelPermissionsData } from './';
3
+ export interface BaseChannelData {
4
+ type: TextBasedChannelTypes | VoiceBasedChannelTypes | ThreadChannelTypes;
5
+ name: string;
6
+ parent?: string;
7
+ permissions: ChannelPermissionsData[];
8
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,6 @@
1
+ import { ChannelPermissionsData, TextChannelData, VoiceChannelData } from './';
2
+ export interface CategoryData {
3
+ name: string;
4
+ permissions: ChannelPermissionsData[];
5
+ children: Array<TextChannelData | VoiceChannelData>;
6
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,5 @@
1
+ export interface ChannelPermissionsData {
2
+ roleName: string;
3
+ allow: string;
4
+ deny: string;
5
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,5 @@
1
+ import { CategoryData, TextChannelData, VoiceChannelData } from './';
2
+ export interface ChannelsData {
3
+ categories: CategoryData[];
4
+ others: Array<TextChannelData | VoiceChannelData>;
5
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,9 @@
1
+ export interface CreateOptions {
2
+ backupID?: string;
3
+ maxMessagesPerChannel?: number;
4
+ jsonSave?: boolean;
5
+ jsonBeautify?: boolean;
6
+ doNotBackup?: string[];
7
+ backupMembers?: boolean;
8
+ saveImages?: string;
9
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,5 @@
1
+ export interface EmojiData {
2
+ name: string;
3
+ url?: string;
4
+ base64?: string;
5
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,6 @@
1
+ import { MessageMentionOptions } from "discord.js";
2
+ export interface LoadOptions {
3
+ clearGuildBeforeRestore: boolean;
4
+ maxMessagesPerChannel?: number;
5
+ allowedMentions?: MessageMentionOptions;
6
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,9 @@
1
+ export interface MemberData {
2
+ userId: string;
3
+ username: string;
4
+ discriminator: string;
5
+ avatarUrl: string;
6
+ joinedTimestamp: number;
7
+ roles: string[];
8
+ bot: boolean;
9
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,10 @@
1
+ import { MessageEmbed, FileOptions } from 'discord.js';
2
+ export interface MessageData {
3
+ username: string;
4
+ avatar?: string;
5
+ content?: string;
6
+ embeds?: MessageEmbed[];
7
+ files?: FileOptions[];
8
+ pinned?: boolean;
9
+ sentAt: string;
10
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,9 @@
1
+ export interface RoleData {
2
+ name: string;
3
+ color: `#${string}`;
4
+ hoist: boolean;
5
+ permissions: string;
6
+ mentionable: boolean;
7
+ position: number;
8
+ isEveryone: boolean;
9
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,10 @@
1
+ import { BaseChannelData, MessageData, ThreadChannelData } from './';
2
+ export interface TextChannelData extends BaseChannelData {
3
+ nsfw: boolean;
4
+ parent?: string;
5
+ topic?: string;
6
+ rateLimitPerUser?: number;
7
+ isNews: boolean;
8
+ messages: MessageData[];
9
+ threads: ThreadChannelData[];
10
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,11 @@
1
+ import { ThreadAutoArchiveDuration, ThreadChannelTypes } from "discord.js";
2
+ import { MessageData } from "./MessageData";
3
+ export interface ThreadChannelData {
4
+ type: ThreadChannelTypes;
5
+ name: string;
6
+ archived: boolean;
7
+ autoArchiveDuration: ThreadAutoArchiveDuration;
8
+ locked: boolean;
9
+ rateLimitPerUser: number;
10
+ messages: MessageData[];
11
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,5 @@
1
+ import { BaseChannelData } from './';
2
+ export interface VoiceChannelData extends BaseChannelData {
3
+ bitrate: number;
4
+ userLimit: number;
5
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,4 @@
1
+ export interface WidgetData {
2
+ enabled: boolean;
3
+ channel?: string;
4
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,17 @@
1
+ export * from './AfkData';
2
+ export * from './BackupData';
3
+ export * from './BackupInfos';
4
+ export * from './BanData';
5
+ export * from './BaseChannelData';
6
+ export * from './CategoryData';
7
+ export * from './ChannelPermissionData';
8
+ export * from './ChannelsData';
9
+ export * from './CreateOptions';
10
+ export * from './EmojiData';
11
+ export * from './LoadOptions';
12
+ export * from './MessageData';
13
+ export * from './RoleData';
14
+ export * from './TextChannelData';
15
+ export * from './ThreadChannelData';
16
+ export * from './VoiceChannelData';
17
+ export * from './WidgetData';
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./AfkData"), exports);
18
+ __exportStar(require("./BackupData"), exports);
19
+ __exportStar(require("./BackupInfos"), exports);
20
+ __exportStar(require("./BanData"), exports);
21
+ __exportStar(require("./BaseChannelData"), exports);
22
+ __exportStar(require("./CategoryData"), exports);
23
+ __exportStar(require("./ChannelPermissionData"), exports);
24
+ __exportStar(require("./ChannelsData"), exports);
25
+ __exportStar(require("./CreateOptions"), exports);
26
+ __exportStar(require("./EmojiData"), exports);
27
+ __exportStar(require("./LoadOptions"), exports);
28
+ __exportStar(require("./MessageData"), exports);
29
+ __exportStar(require("./RoleData"), exports);
30
+ __exportStar(require("./TextChannelData"), exports);
31
+ __exportStar(require("./ThreadChannelData"), exports);
32
+ __exportStar(require("./VoiceChannelData"), exports);
33
+ __exportStar(require("./WidgetData"), exports);
package/lib/util.d.ts ADDED
@@ -0,0 +1,27 @@
1
+ import type { CategoryData, ChannelPermissionsData, CreateOptions, LoadOptions, MessageData, TextChannelData, VoiceChannelData } from './types';
2
+ import type { CategoryChannel, Guild, TextChannel, VoiceChannel, NewsChannel, ThreadChannel } from 'discord.js';
3
+ /**
4
+ * Gets the permissions for a channel
5
+ */
6
+ export declare function fetchChannelPermissions(channel: TextChannel | VoiceChannel | CategoryChannel | NewsChannel): ChannelPermissionsData[];
7
+ /**
8
+ * Fetches the voice channel data that is necessary for the backup
9
+ */
10
+ export declare function fetchVoiceChannelData(channel: VoiceChannel): Promise<VoiceChannelData>;
11
+ export declare function fetchChannelMessages(channel: TextChannel | NewsChannel | ThreadChannel, options: CreateOptions): Promise<MessageData[]>;
12
+ /**
13
+ * Fetches the text channel data that is necessary for the backup
14
+ */
15
+ export declare function fetchTextChannelData(channel: TextChannel | NewsChannel, options: CreateOptions): Promise<TextChannelData>;
16
+ /**
17
+ * Creates a category for the guild
18
+ */
19
+ export declare function loadCategory(categoryData: CategoryData, guild: Guild): Promise<CategoryChannel>;
20
+ /**
21
+ * Create a channel and returns it
22
+ */
23
+ export declare function loadChannel(channelData: TextChannelData | VoiceChannelData, guild: Guild, category?: CategoryChannel, options?: LoadOptions): Promise<unknown>;
24
+ /**
25
+ * Delete all roles, all channels, all emojis, etc... of a guild
26
+ */
27
+ export declare function clearGuild(guild: Guild): Promise<void>;