Skip to content

Commit

Permalink
Merge branch 'main' into feat/member-argument-discrim-slice
Browse files Browse the repository at this point in the history
  • Loading branch information
favna authored Oct 16, 2021
2 parents b7ee4e9 + 9097cf5 commit 257cb21
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/errorListeners/CoreCommandError.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export class CoreEvent extends Listener<typeof Events.CommandError> {
super(context, { event: Events.CommandError });
}

public run(error: Error, context: CommandErrorPayload) {
public run(error: unknown, context: CommandErrorPayload) {
const { name, location } = context.piece;
this.container.logger.error(`Encountered error on command "${name}" at path "${location.full}"`, error);
}
Expand Down
4 changes: 2 additions & 2 deletions src/lib/parsers/Result.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export function isErr<T, E>(x: Result<T, E>): x is Err<E> {
* @typeparam T The result's type.
* @typeparam E The error's type.
*/
export function from<T, E = Error>(cb: (...args: unknown[]) => T): Result<T, E> {
export function from<T, E = unknown>(cb: (...args: unknown[]) => T): Result<T, E> {
try {
return ok(cb());
} catch (error) {
Expand All @@ -88,7 +88,7 @@ export function from<T, E = Error>(cb: (...args: unknown[]) => T): Result<T, E>
* @typeparam T The result's type.
* @typeparam E The error's type.
*/
export async function fromAsync<T, E = Error>(promiseOrCb: Awaitable<T> | ((...args: unknown[]) => Awaitable<T>)): Promise<Result<T, E>> {
export async function fromAsync<T, E = unknown>(promiseOrCb: Awaitable<T> | ((...args: unknown[]) => Awaitable<T>)): Promise<Result<T, E>> {
try {
return ok(await (isFunction(promiseOrCb) ? promiseOrCb() : promiseOrCb));
} catch (error) {
Expand Down
6 changes: 3 additions & 3 deletions src/lib/types/Events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ declare module 'discord.js' {
[Events.PieceUnload]: [store: Store<Piece>, piece: Piece];
[Events.PiecePostLoad]: [store: Store<Piece>, piece: Piece];
[Events.MentionPrefixOnly]: [message: Message];
[Events.ListenerError]: [error: Error, payload: ListenerErrorPayload];
[Events.ListenerError]: [error: unknown, payload: ListenerErrorPayload];
[Events.PreMessageParsed]: [message: Message];
[Events.PrefixedMessage]: [message: Message, prefix: string | RegExp];
[Events.UnknownCommandName]: [payload: UnknownCommandNamePayload];
Expand All @@ -147,9 +147,9 @@ declare module 'discord.js' {
[Events.CommandAccepted]: [payload: CommandAcceptedPayload];
[Events.CommandRun]: [message: Message, command: Command, payload: CommandRunPayload];
[Events.CommandSuccess]: [payload: CommandSuccessPayload];
[Events.CommandError]: [error: Error, payload: CommandErrorPayload];
[Events.CommandError]: [error: unknown, payload: CommandErrorPayload];
[Events.CommandFinish]: [message: Message, command: Command, payload: CommandFinishPayload];
[Events.CommandTypingError]: [error: Error, payload: CommandTypingErrorPayload];
[Events.CommandTypingError]: [error: unknown, payload: CommandTypingErrorPayload];
[Events.PluginLoaded]: [hook: PluginHook, name: string | undefined];
[Events.NonPrefixedMessage]: [message: Message];
// #endregion Sapphire load cycle events
Expand Down
2 changes: 1 addition & 1 deletion src/listeners/command-handler/CoreCommandTyping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export class CoreListener extends Listener<typeof Events.CommandRun> {
try {
await message.channel.sendTyping();
} catch (error) {
message.client.emit(Events.CommandTypingError, error as Error, { ...payload, command, message });
message.client.emit(Events.CommandTypingError, error, { ...payload, command, message });
}
}
}

0 comments on commit 257cb21

Please sign in to comment.