@open-discord-bots/framework 0.3.3 → 0.3.5

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.
@@ -22,6 +22,7 @@ export * from "./modules/progressbar.js";
22
22
  export * from "./modules/responder.js";
23
23
  export * from "./modules/session.js";
24
24
  export * from "./modules/startscreen.js";
25
+ export * from "./modules/state.js";
25
26
  export * from "./modules/statistic.js";
26
27
  export * from "./modules/verifybar.js";
27
28
  export * from "./modules/worker.js";
package/dist/api/index.js CHANGED
@@ -24,6 +24,7 @@ export * from "./modules/progressbar.js";
24
24
  export * from "./modules/responder.js";
25
25
  export * from "./modules/session.js";
26
26
  export * from "./modules/startscreen.js";
27
+ export * from "./modules/state.js";
27
28
  export * from "./modules/statistic.js";
28
29
  export * from "./modules/verifybar.js";
29
30
  export * from "./modules/worker.js";
@@ -23,6 +23,7 @@ import { ODClientManager } from "./modules/client.js";
23
23
  import { ODSharedFuseManager } from "./modules/fuse.js";
24
24
  import { ODStartScreenManager } from "./modules/startscreen.js";
25
25
  import { ODComponentManager } from "./modules/component.js";
26
+ import { ODStateManager } from "./modules/state.js";
26
27
  /**## ODMainManagers `interface`
27
28
  * The global properties for the main class of the bot.
28
29
  */
@@ -83,6 +84,8 @@ export interface ODMainManagers {
83
84
  code: ODCodeManager;
84
85
  /**A collection of static Discord post channels. It allows the bot to find back log, transcript or configured channels based on a linked ID. */
85
86
  posts: ODPostManager;
87
+ /**A system for tracking messages or linking metadata, states or progress to Discord messages (ID-based). Features automatic garbage collection. */
88
+ states: ODStateManager;
86
89
  /**A wrapper around the `discord.Client` class. It handles client login, activity and registering text/slash commands. */
87
90
  client: ODClientManager;
88
91
  /**Shared fuses between Open Discord bots. Turn off "default behaviours" from the bot which is useful for replacing default behaviour with a custom implementation. */
@@ -128,6 +131,7 @@ export declare abstract class ODMain implements ODMainManagers {
128
131
  readonly statistics: ODStatisticManager;
129
132
  readonly code: ODCodeManager;
130
133
  readonly posts: ODPostManager;
134
+ readonly states: ODStateManager;
131
135
  readonly client: ODClientManager;
132
136
  readonly sharedFuses: ODSharedFuseManager;
133
137
  readonly env: ODEnvHelper;
package/dist/api/main.js CHANGED
@@ -35,6 +35,7 @@ export class ODMain {
35
35
  statistics;
36
36
  code;
37
37
  posts;
38
+ states;
38
39
  client;
39
40
  sharedFuses;
40
41
  env;
@@ -43,7 +44,7 @@ export class ODMain {
43
44
  constructor(managers, project) {
44
45
  this.project = project;
45
46
  this.versions = managers.versions;
46
- this.versions.add(ODVersion.fromString("opendiscord:api", "v0.3.3"));
47
+ this.versions.add(ODVersion.fromString("opendiscord:api", "v0.3.5"));
47
48
  this.versions.add(ODVersion.fromString("opendiscord:livestatus", "v2.0.0"));
48
49
  this.debugfile = managers.debugfile;
49
50
  this.console = managers.console;
@@ -69,6 +70,7 @@ export class ODMain {
69
70
  this.statistics = managers.statistics;
70
71
  this.code = managers.code;
71
72
  this.posts = managers.posts;
73
+ this.states = managers.states;
72
74
  this.sharedFuses = managers.sharedFuses;
73
75
  this.env = managers.env;
74
76
  this.livestatus = managers.livestatus;
@@ -79,26 +79,27 @@ export declare class ODClientManager<SlashIdList extends ODSlashCommandManagerId
79
79
  checkGuildPerms(guild: discord.Guild): boolean;
80
80
  /**Log-in with a discord auth token. Rejects returns `false` using 'softErrors' on failure. */
81
81
  login(softErrors?: boolean): Promise<boolean>;
82
- /**A simplified shortcut to get a `discord.User` :) */
82
+ /**A simplified shortcut to get a `discord.User`. */
83
83
  fetchUser(id: string): Promise<discord.User | null>;
84
- /**A simplified shortcut to get a `discord.Guild` :) */
84
+ /**A simplified shortcut to get a `discord.Guild`. */
85
85
  fetchGuild(id: string): Promise<discord.Guild | null>;
86
- /**A simplified shortcut to get a `discord.Channel` :) */
86
+ /**A simplified shortcut to get a `discord.Channel`. */
87
87
  fetchChannel(id: string): Promise<discord.Channel | null>;
88
- /**A simplified shortcut to get a `discord.GuildBasedChannel` :) */
88
+ /**A simplified shortcut to get a `discord.TextChannel` (guild or DM). */
89
+ fetchTextChannel(id: string): Promise<discord.TextChannel | discord.DMChannel | discord.PartialDMChannel | null>;
90
+ /**A simplified shortcut to get a `discord.GuildBasedChannel`. */
89
91
  fetchGuildChannel(guildId: string | discord.Guild, id: string): Promise<discord.GuildBasedChannel | null>;
90
- /**A simplified shortcut to get a `discord.TextChannel` :) */
92
+ /**A simplified shortcut to get a `discord.TextChannel`. */
91
93
  fetchGuildTextChannel(guildId: string | discord.Guild, id: string): Promise<discord.TextChannel | null>;
92
- /**A simplified shortcut to get a `discord.CategoryChannel` :) */
94
+ /**A simplified shortcut to get a `discord.CategoryChannel`. */
93
95
  fetchGuildCategoryChannel(guildId: string | discord.Guild, id: string): Promise<discord.CategoryChannel | null>;
94
- /**A simplified shortcut to get a `discord.GuildMember` :) */
96
+ /**A simplified shortcut to get a `discord.GuildMember`. */
95
97
  fetchGuildMember(guildId: string | discord.Guild, id: string): Promise<discord.GuildMember | null>;
96
- /**A simplified shortcut to get a `discord.Role` :) */
98
+ /**A simplified shortcut to get a `discord.Role`. */
97
99
  fetchGuildRole(guildId: string | discord.Guild, id: string): Promise<discord.Role | null>;
98
- /**A simplified shortcut to get a `discord.Message` :) */
99
- fetchGuildChannelMessage(guildId: string | discord.Guild, channelId: string | discord.TextChannel, id: string): Promise<discord.Message<true> | null>;
100
- fetchGuildChannelMessage(channelId: discord.TextChannel, id: string): Promise<discord.Message<true> | null>;
101
- /**A simplified shortcut to send a DM to a user :) */
100
+ /**A simplified shortcut to get a `discord.Message`. */
101
+ fetchChannelMessage(channelId: string | discord.TextChannel | discord.DMChannel, id: string): Promise<discord.Message<boolean> | null>;
102
+ /**A simplified shortcut to send a DM to a user. */
102
103
  sendUserDm(user: string | discord.User, build: ODMessageBuildResult | ODMessageComponentBuildResult): Promise<ODResponderSendResult<false>>;
103
104
  }
104
105
  /**## ODClientActivityType `type`
@@ -96,7 +96,7 @@ export class ODClientManager {
96
96
  /**Get all servers the bot is part of. */
97
97
  async getGuilds() {
98
98
  if (!this.initiated)
99
- throw new ODSystemError("Client isn't initiated yet!");
99
+ throw new ODSystemError("ODClientManager() => Unable to use this method. Client isn't initiated yet.");
100
100
  if (!this.ready)
101
101
  throw new ODSystemError("Client isn't ready yet!");
102
102
  return this.client.guilds.cache.map((guild) => guild);
@@ -122,15 +122,15 @@ export class ODClientManager {
122
122
  login(softErrors) {
123
123
  return new Promise(async (resolve, reject) => {
124
124
  if (!this.initiated)
125
- reject("Client isn't initiated yet!");
125
+ reject("ODClientManager.login() => Unable to use this method. Client isn't initiated yet.");
126
126
  if (!this.token)
127
- reject("Client doesn't have a token!");
127
+ reject("ODClientManager.login() => Unable to login, client does not have a token.");
128
128
  try {
129
129
  this.client.once("clientReady", async () => {
130
130
  this.ready = true;
131
131
  //set slashCommandManager & contextMenuManager to client applicationCommandManager
132
132
  if (!this.client.application)
133
- throw new ODSystemError("Couldn't get client application for slashCommand & contextMenu managers!");
133
+ throw new ODSystemError("ODClientManager.login() => Unable to fetch client application for slashCommand & contextMenu managers.");
134
134
  this.slashCommands.commandManager = this.client.application.commands;
135
135
  this.contextMenus.commandManager = this.client.application.commands;
136
136
  this.autocompletes.commandManager = this.client.application.commands;
@@ -157,12 +157,12 @@ export class ODClientManager {
157
157
  }
158
158
  });
159
159
  }
160
- /**A simplified shortcut to get a `discord.User` :) */
160
+ /**A simplified shortcut to get a `discord.User`. */
161
161
  async fetchUser(id) {
162
162
  if (!this.initiated)
163
- throw new ODSystemError("Client isn't initiated yet!");
163
+ throw new ODSystemError("ODClientManager.fetchUser() => Unable to use this method. Client isn't initiated yet.");
164
164
  if (!this.ready)
165
- throw new ODSystemError("Client isn't ready yet!");
165
+ throw new ODSystemError("ODClientManager.fetchUser() => Unable to use this method. Client isn't ready and logged in yet.");
166
166
  try {
167
167
  return await this.client.users.fetch(id);
168
168
  }
@@ -170,12 +170,12 @@ export class ODClientManager {
170
170
  return null;
171
171
  }
172
172
  }
173
- /**A simplified shortcut to get a `discord.Guild` :) */
173
+ /**A simplified shortcut to get a `discord.Guild`. */
174
174
  async fetchGuild(id) {
175
175
  if (!this.initiated)
176
- throw new ODSystemError("Client isn't initiated yet!");
176
+ throw new ODSystemError("ODClientManager.fetchGuild() => Unable to use this method. Client isn't initiated yet.");
177
177
  if (!this.ready)
178
- throw new ODSystemError("Client isn't ready yet!");
178
+ throw new ODSystemError("ODClientManager.fetchGuild() => Unable to use this method. Client isn't ready and logged in yet.");
179
179
  try {
180
180
  return await this.client.guilds.fetch(id);
181
181
  }
@@ -183,12 +183,12 @@ export class ODClientManager {
183
183
  return null;
184
184
  }
185
185
  }
186
- /**A simplified shortcut to get a `discord.Channel` :) */
186
+ /**A simplified shortcut to get a `discord.Channel`. */
187
187
  async fetchChannel(id) {
188
188
  if (!this.initiated)
189
- throw new ODSystemError("Client isn't initiated yet!");
189
+ throw new ODSystemError("ODClientManager.fetchChannel() => Unable to use this method. Client isn't initiated yet.");
190
190
  if (!this.ready)
191
- throw new ODSystemError("Client isn't ready yet!");
191
+ throw new ODSystemError("ODClientManager.fetchChannel() => Unable to use this method. Client isn't ready and logged in yet.");
192
192
  try {
193
193
  return await this.client.channels.fetch(id);
194
194
  }
@@ -196,12 +196,28 @@ export class ODClientManager {
196
196
  return null;
197
197
  }
198
198
  }
199
- /**A simplified shortcut to get a `discord.GuildBasedChannel` :) */
199
+ /**A simplified shortcut to get a `discord.TextChannel` (guild or DM). */
200
+ async fetchTextChannel(id) {
201
+ if (!this.initiated)
202
+ throw new ODSystemError("ODClientManager.fetchTextChannel() => Unable to use this method. Client isn't initiated yet.");
203
+ if (!this.ready)
204
+ throw new ODSystemError("ODClientManager.fetchTextChannel() => Unable to use this method. Client isn't ready and logged in yet.");
205
+ try {
206
+ const channel = await this.client.channels.fetch(id);
207
+ if (!channel || (channel.type != discord.ChannelType.GuildText && channel.type != discord.ChannelType.DM))
208
+ return null;
209
+ return channel;
210
+ }
211
+ catch {
212
+ return null;
213
+ }
214
+ }
215
+ /**A simplified shortcut to get a `discord.GuildBasedChannel`. */
200
216
  async fetchGuildChannel(guildId, id) {
201
217
  if (!this.initiated)
202
- throw new ODSystemError("Client isn't initiated yet!");
218
+ throw new ODSystemError("ODClientManager.fetchGuildChannel() => Unable to use this method. Client isn't initiated yet.");
203
219
  if (!this.ready)
204
- throw new ODSystemError("Client isn't ready yet!");
220
+ throw new ODSystemError("ODClientManager.fetchGuildChannel() => Unable to use this method. Client isn't ready and logged in yet.");
205
221
  try {
206
222
  const guild = (guildId instanceof discord.Guild) ? guildId : await this.fetchGuild(guildId);
207
223
  if (!guild)
@@ -213,12 +229,12 @@ export class ODClientManager {
213
229
  return null;
214
230
  }
215
231
  }
216
- /**A simplified shortcut to get a `discord.TextChannel` :) */
232
+ /**A simplified shortcut to get a `discord.TextChannel`. */
217
233
  async fetchGuildTextChannel(guildId, id) {
218
234
  if (!this.initiated)
219
- throw new ODSystemError("Client isn't initiated yet!");
235
+ throw new ODSystemError("ODClientManager.fetchGuildTextChannel() => Unable to use this method. Client isn't initiated yet.");
220
236
  if (!this.ready)
221
- throw new ODSystemError("Client isn't ready yet!");
237
+ throw new ODSystemError("ODClientManager.fetchGuildTextChannel() => Unable to use this method. Client isn't ready and logged in yet.");
222
238
  try {
223
239
  const guild = (guildId instanceof discord.Guild) ? guildId : await this.fetchGuild(guildId);
224
240
  if (!guild)
@@ -232,12 +248,12 @@ export class ODClientManager {
232
248
  return null;
233
249
  }
234
250
  }
235
- /**A simplified shortcut to get a `discord.CategoryChannel` :) */
251
+ /**A simplified shortcut to get a `discord.CategoryChannel`. */
236
252
  async fetchGuildCategoryChannel(guildId, id) {
237
253
  if (!this.initiated)
238
- throw new ODSystemError("Client isn't initiated yet!");
254
+ throw new ODSystemError("ODClientManager.fetchGuildCategoryChannel() => Unable to use this method. Client isn't initiated yet.");
239
255
  if (!this.ready)
240
- throw new ODSystemError("Client isn't ready yet!");
256
+ throw new ODSystemError("ODClientManager.fetchGuildCategoryChannel() => Unable to use this method. Client isn't ready and logged in yet.");
241
257
  try {
242
258
  const guild = (guildId instanceof discord.Guild) ? guildId : await this.fetchGuild(guildId);
243
259
  if (!guild)
@@ -251,14 +267,12 @@ export class ODClientManager {
251
267
  return null;
252
268
  }
253
269
  }
254
- /**A simplified shortcut to get a `discord.GuildMember` :) */
270
+ /**A simplified shortcut to get a `discord.GuildMember`. */
255
271
  async fetchGuildMember(guildId, id) {
256
272
  if (!this.initiated)
257
- throw new ODSystemError("Client isn't initiated yet!");
273
+ throw new ODSystemError("ODClientManager.fetchGuildMember() => Unable to use this method. Client isn't initiated yet.");
258
274
  if (!this.ready)
259
- throw new ODSystemError("Client isn't ready yet!");
260
- if (typeof id != "string")
261
- throw new ODSystemError("TEMP ERROR => ODClientManager.fetchGuildMember() => id param isn't string");
275
+ throw new ODSystemError("ODClientManager.fetchGuildMember() => Unable to use this method. Client isn't ready and logged in yet.");
262
276
  try {
263
277
  const guild = (guildId instanceof discord.Guild) ? guildId : await this.fetchGuild(guildId);
264
278
  if (!guild)
@@ -269,14 +283,12 @@ export class ODClientManager {
269
283
  return null;
270
284
  }
271
285
  }
272
- /**A simplified shortcut to get a `discord.Role` :) */
286
+ /**A simplified shortcut to get a `discord.Role`. */
273
287
  async fetchGuildRole(guildId, id) {
274
288
  if (!this.initiated)
275
- throw new ODSystemError("Client isn't initiated yet!");
289
+ throw new ODSystemError("ODClientManager.fetchGuildRole() => Unable to use this method. Client isn't initiated yet.");
276
290
  if (!this.ready)
277
- throw new ODSystemError("Client isn't ready yet!");
278
- if (typeof id != "string")
279
- throw new ODSystemError("TEMP ERROR => ODClientManager.fetchGuildRole() => id param isn't string");
291
+ throw new ODSystemError("ODClientManager.fetchGuildRole() => Unable to use this method. Client isn't ready and logged in yet.");
280
292
  try {
281
293
  const guild = (guildId instanceof discord.Guild) ? guildId : await this.fetchGuild(guildId);
282
294
  if (!guild)
@@ -287,35 +299,28 @@ export class ODClientManager {
287
299
  return null;
288
300
  }
289
301
  }
290
- async fetchGuildChannelMessage(guildId, channelId, id) {
302
+ /**A simplified shortcut to get a `discord.Message`. */
303
+ async fetchChannelMessage(channelId, id) {
291
304
  if (!this.initiated)
292
- throw new ODSystemError("Client isn't initiated yet!");
305
+ throw new ODSystemError("ODClientManager.fetchChannelMessage() => Unable to use this method. Client isn't initiated yet.");
293
306
  if (!this.ready)
294
- throw new ODSystemError("Client isn't ready yet!");
307
+ throw new ODSystemError("ODClientManager.fetchChannelMessage() => Unable to use this method. Client isn't ready and logged in yet.");
295
308
  try {
296
- if (guildId instanceof discord.TextChannel && typeof channelId == "string") {
297
- const channel = guildId;
298
- return await channel.messages.fetch(channelId);
299
- }
300
- else if (!(guildId instanceof discord.TextChannel) && id) {
301
- const channel = (channelId instanceof discord.TextChannel) ? channelId : await this.fetchGuildTextChannel(guildId, channelId);
302
- if (!channel)
303
- return null;
304
- return await channel.messages.fetch(id);
305
- }
306
- else
309
+ const channel = (channelId instanceof discord.TextChannel || channelId instanceof discord.DMChannel) ? channelId : await this.fetchTextChannel(channelId);
310
+ if (!channel)
307
311
  return null;
312
+ return await channel.messages.fetch(id);
308
313
  }
309
314
  catch {
310
315
  return null;
311
316
  }
312
317
  }
313
- /**A simplified shortcut to send a DM to a user :) */
318
+ /**A simplified shortcut to send a DM to a user. */
314
319
  async sendUserDm(user, build) {
315
320
  if (!this.initiated)
316
- throw new ODSystemError("Client isn't initiated yet!");
321
+ throw new ODSystemError("ODClientManager.sendUserDm() => Unable to use this method. Client isn't initiated yet.");
317
322
  if (!this.ready)
318
- throw new ODSystemError("Client isn't ready yet!");
323
+ throw new ODSystemError("ODClientManager.sendUserDm() => Unable to use this method. Client isn't ready and logged in yet.");
319
324
  try {
320
325
  const msgFlags = [];
321
326
  let msgData;
@@ -340,31 +345,31 @@ export class ODClientManager {
340
345
  const finalMessage = Object.assign(msgData, { flags: msgFlags });
341
346
  if (user instanceof discord.User) {
342
347
  if (user.bot)
343
- return { success: false, message: null };
348
+ return { success: false };
344
349
  const channel = await user.createDM();
345
350
  const msg = await channel.send(finalMessage);
346
- return { success: true, message: msg };
351
+ return { success: true, message: msg, ephemeral: false };
347
352
  }
348
353
  else {
349
354
  const newUser = await this.fetchUser(user);
350
355
  if (!newUser)
351
356
  throw new Error();
352
357
  if (newUser.bot)
353
- return { success: false, message: null };
358
+ return { success: false };
354
359
  const channel = await newUser.createDM();
355
360
  const msg = await channel.send(finalMessage);
356
- return { success: true, message: msg };
361
+ return { success: true, message: msg, ephemeral: false };
357
362
  }
358
363
  }
359
364
  catch {
360
365
  try {
361
- this.debug.console.log("Failed to send DM to user! ", "warning", [
366
+ this.debug.console.log("ODClientManager.sendUserDm() => Failed to send DM. User may have DMs disabled for non-friends. ", "warning", [
362
367
  { key: "id", value: (user instanceof discord.User ? user.id : user) },
363
368
  { key: "message-build", value: build.id.value }
364
369
  ]);
365
370
  }
366
371
  catch { }
367
- return { success: false, message: null };
372
+ return { success: false };
368
373
  }
369
374
  }
370
375
  }
@@ -423,7 +428,7 @@ export class ODClientActivityManager {
423
428
  /**Update the client status */
424
429
  updateClientActivity(type, text) {
425
430
  if (!this.client.client.user)
426
- throw new ODSystemError("Couldn't set client status: client.user == undefined");
431
+ throw new ODSystemError("ODClientActivityManager.updateClientActivity() => Couldn't set client status: client.user is 'undefined'.");
427
432
  if (type == false) {
428
433
  this.client.client.user.setActivity();
429
434
  return;
@@ -191,7 +191,9 @@ export class ODError {
191
191
  }
192
192
  /**Create a more-detailed, non-colored version of this error to store it in the `debug.txt` file! */
193
193
  toDebugString() {
194
- return "[UNKNOWN OD ERROR]: " + this.error.message + " | origin: " + this.origin + "\n" + this.error.stack;
194
+ const date = new Date();
195
+ const dstring = `${date.getDate()}/${date.getMonth() + 1}/${date.getFullYear()} ${date.getHours()}:${date.getMinutes()}:${date.getSeconds()}`;
196
+ return "[" + dstring + " UNKNOWN OPENDISCORD ERROR]: " + this.error.message + " | Error Origin: " + this.origin + " | Stacktrace:\n" + this.error.stack;
195
197
  }
196
198
  }
197
199
  /**## ODConsoleManager `class`
@@ -48,7 +48,7 @@ export declare abstract class ODDatabase<IdList extends ODDatabaseIdConstraint =
48
48
  abstract get<CategoryId extends keyof ODNoGeneric<IdList>>(category: CategoryId, key: string): ODOptionalPromise<IdList[CategoryId] | undefined>;
49
49
  abstract get(category: string, key: string): ODOptionalPromise<ODValidJsonType | undefined>;
50
50
  abstract get(category: string, key: string): ODOptionalPromise<ODValidJsonType | undefined>;
51
- /**Delete a specific category & key in the database */
51
+ /**Delete a specific category & key in the database. Returns `true` when deleted. */
52
52
  abstract delete<CategoryId extends keyof ODNoGeneric<IdList>>(category: CategoryId, key: string): ODOptionalPromise<boolean>;
53
53
  abstract delete(category: string, key: string): ODOptionalPromise<boolean>;
54
54
  abstract delete(category: string, key: string): ODOptionalPromise<boolean>;
@@ -118,8 +118,6 @@ export interface ODSharedFuseList {
118
118
  clientActivityLoading: boolean;
119
119
  /**Load the default Open Discord client activity initialization (& status refresh). */
120
120
  clientActivityInitiating: boolean;
121
- /**Load the default Open Discord priority levels. */
122
- priorityLoading: boolean;
123
121
  /**Load the default Open Discord slash commands. */
124
122
  slashCommandLoading: boolean;
125
123
  /**Load the default Open Discord slash command registerer (register slash cmds in discord). */
@@ -138,6 +136,10 @@ export interface ODSharedFuseList {
138
136
  allowContextMenuRemoval: boolean;
139
137
  /**Load the default Open Discord text commands. */
140
138
  textCommandLoading: boolean;
139
+ /**Load the default Open Discord message states. */
140
+ stateLoading: boolean;
141
+ /**Initiate the default Open Discord message states. */
142
+ stateInitiating: boolean;
141
143
  /**Load the default Open Discord button builders. */
142
144
  buttonBuildersLoading: boolean;
143
145
  /**Load the default Open Discord dropdown builders. */
@@ -70,7 +70,6 @@ export class ODSharedFuseManager extends ODFuseManager {
70
70
  clientMultiGuildWarning: true,
71
71
  clientActivityLoading: true,
72
72
  clientActivityInitiating: true,
73
- priorityLoading: true,
74
73
  slashCommandLoading: true,
75
74
  slashCommandRegistering: true,
76
75
  forceSlashCommandRegistration: false,
@@ -80,6 +79,8 @@ export class ODSharedFuseManager extends ODFuseManager {
80
79
  forceContextMenuRegistration: false,
81
80
  allowContextMenuRemoval: true,
82
81
  textCommandLoading: true,
82
+ stateLoading: true,
83
+ stateInitiating: true,
83
84
  buttonBuildersLoading: true,
84
85
  dropdownBuildersLoading: true,
85
86
  fileBuildersLoading: true,
@@ -129,7 +129,7 @@ export declare class ODPermissionManager<IdList extends ODPermissionManagerIdCon
129
129
  private defaultGlobalCalculation;
130
130
  /**Check for channel permissions. Result will be compared with the global perms in `#defaultCalculation()`. */
131
131
  private defaultChannelCalculation;
132
- /**Check the permissions for a certain command of the bot. */
132
+ /**Check the permissions for a certain command of the bot. Permission mode: `none`, `everyone`, `admin` or any valid discord role ID. */
133
133
  checkCommandPerms(permissionMode: string, requiredLevel: ODPermissionType, user: discord.User, member?: discord.GuildMember | null, channel?: discord.Channel | null, guild?: discord.Guild | null, settings?: ODPermissionSettings): Promise<ODPermissionCommandResult>;
134
134
  get<PermissionId extends keyof ODNoGeneric<IdList>>(id: PermissionId): IdList[PermissionId];
135
135
  get(id: ODValidId): ODPermission | null;
@@ -238,7 +238,7 @@ export class ODPermissionManager extends ODManager {
238
238
  //spread result to prevent accidental modification because of referencing
239
239
  return { ...this.defaultResult };
240
240
  }
241
- /**Check the permissions for a certain command of the bot. */
241
+ /**Check the permissions for a certain command of the bot. Permission mode: `none`, `everyone`, `admin` or any valid discord role ID. */
242
242
  async checkCommandPerms(permissionMode, requiredLevel, user, member, channel, guild, settings) {
243
243
  if (permissionMode === "none") {
244
244
  return { hasPerms: false, reason: "disabled" };
@@ -85,14 +85,14 @@ export class ODPost extends ODManagerData {
85
85
  /**Send a message to this channel using the Open Discord builder system */
86
86
  async send(build) {
87
87
  if (!this.channel || !this.channel.isTextBased())
88
- return { success: false, message: null };
88
+ return { success: false };
89
89
  try {
90
90
  const finalMessage = this.getMessageFromBuildResult(build, "message");
91
91
  const sent = await this.channel.send(finalMessage);
92
- return { success: true, message: sent };
92
+ return { success: true, message: sent, ephemeral: false };
93
93
  }
94
94
  catch {
95
- return { success: false, message: null };
95
+ return { success: false };
96
96
  }
97
97
  }
98
98
  /**Get the final `messageCreateOptions` from a returned build result from builders/components. */
@@ -33,11 +33,11 @@ export type ODResponderSendResult<InGuild extends boolean> = {
33
33
  success: true;
34
34
  /**The message that got sent. */
35
35
  message: discord.Message<InGuild>;
36
+ /**Was the message sent as ephemeral? */
37
+ ephemeral: boolean;
36
38
  } | {
37
39
  /**Did the message get sent successfully? */
38
- success: boolean;
39
- /**The message that got sent. */
40
- message: null;
40
+ success: false;
41
41
  };
42
42
  /**## ODResponderManager `class`
43
43
  * This is an Open Discord responder manager.