moosee
moosee
SIASapphire - Imagine a framework
Created by moosee on 9/12/2024 in #sapphire-support
messageCommandDenied preventing bot from booting
Hello, I'm using the basic messageCommandDenied code provided in the sapphire docs and it has been working up until today but upon booting up one of my bots I get the following error:
src/listeners/messageCommandDenied.ts:15:27 - error TS2339: Property 'send' does not exist on type 'DMChannel | PartialDMChannel | PartialGroupDMChannel | NewsChannel | StageChannel | TextChannel | PublicThreadChannel<...> | PrivateThreadChannel | VoiceChannel'.
Property 'send' does not exist on type 'PartialGroupDMChannel'.

15 return message.channel.send(error.message);
~~~~


Found 1 error in src/listeners/messageCommandDenied.ts:15
src/listeners/messageCommandDenied.ts:15:27 - error TS2339: Property 'send' does not exist on type 'DMChannel | PartialDMChannel | PartialGroupDMChannel | NewsChannel | StageChannel | TextChannel | PublicThreadChannel<...> | PrivateThreadChannel | VoiceChannel'.
Property 'send' does not exist on type 'PartialGroupDMChannel'.

15 return message.channel.send(error.message);
~~~~


Found 1 error in src/listeners/messageCommandDenied.ts:15
The code I use for this event is directly ripped from the docs here: https://www.sapphirejs.dev/docs/Guide/preconditions/reporting-precondition-failure
import {
Events,
Listener,
type MessageCommandDeniedPayload,
type UserError,
} from "@sapphire/framework";

export class MessageCommandDenied extends Listener<
typeof Events.MessageCommandDenied
> {
public run(error: UserError, { message }: MessageCommandDeniedPayload) {
return message.channel.send(error.message);
}
}
import {
Events,
Listener,
type MessageCommandDeniedPayload,
type UserError,
} from "@sapphire/framework";

export class MessageCommandDenied extends Listener<
typeof Events.MessageCommandDenied
> {
public run(error: UserError, { message }: MessageCommandDeniedPayload) {
return message.channel.send(error.message);
}
}
8 replies
SIASapphire - Imagine a framework
Created by moosee on 8/22/2024 in #sapphire-support
Why is ActivityType.Custom excluded from the presence ActivityOptions[]?
See code here in index.d.ts:
export interface ActivityOptions {
name?: string;
url?: string;
type?: Exclude<ActivityType, ActivityType.Custom>;
shardId?: number | readonly number[];
}
export interface ActivityOptions {
name?: string;
url?: string;
type?: Exclude<ActivityType, ActivityType.Custom>;
shardId?: number | readonly number[];
}
6 replies