File tree 2 files changed +17
-0
lines changed
listeners/command-handler
2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -120,6 +120,11 @@ export interface SapphireClientOptions {
120
120
* @default "No cooldown options"
121
121
*/
122
122
defaultCooldown ?: CooldownOptions ;
123
+ /**
124
+ * Controls whether the bot has mention as a prefix disabled
125
+ * @default false
126
+ */
127
+ disableMentionPrefix ?: boolean ;
123
128
}
124
129
125
130
/**
@@ -211,6 +216,16 @@ export class SapphireClient<Ready extends boolean = boolean> extends Client<Read
211
216
*/
212
217
public logger : ILogger ;
213
218
219
+ /**
220
+ * Whether the bot has mention as a prefix disabled
221
+ * @default false
222
+ * @example
223
+ * ```typescript
224
+ * client.disableMentionPrefix = false;
225
+ * ```
226
+ */
227
+ public disableMentionPrefix ?: boolean ;
228
+
214
229
/**
215
230
* The registered stores.
216
231
* @since 1.0.0
@@ -237,6 +252,7 @@ export class SapphireClient<Ready extends boolean = boolean> extends Client<Read
237
252
container . stores = this . stores ;
238
253
239
254
this . fetchPrefix = options . fetchPrefix ?? ( ( ) => this . options . defaultPrefix ?? null ) ;
255
+ this . disableMentionPrefix = options . disableMentionPrefix ;
240
256
241
257
for ( const plugin of SapphireClient . plugins . values ( PluginHook . PreInitialization ) ) {
242
258
plugin . hook . call ( this , options ) ;
Original file line number Diff line number Diff line change @@ -49,6 +49,7 @@ export class CoreListener extends Listener<typeof Events.PreMessageParsed> {
49
49
}
50
50
51
51
private getMentionPrefix ( message : Message ) : string | null {
52
+ if ( this . container . client . disableMentionPrefix ) return null ;
52
53
// If the content is shorter than 20 characters, or does not start with `<@` then skip early:
53
54
if ( message . content . length < 20 || ! message . content . startsWith ( '<@' ) ) return null ;
54
55
You can’t perform that action at this time.
0 commit comments