mirror of
https://github.com/tiramisulabs/seyfert.git
synced 2025-07-03 05:26:07 +00:00
fix custom context in prefix commands (#159)
This commit is contained in:
parent
74159ac1da
commit
c1351f32de
@ -27,7 +27,7 @@ import {
|
||||
import type { DeepPartial, IntentStrings, OmitInsert } from '../common/types/util';
|
||||
import { ComponentHandler } from '../components/handler';
|
||||
import { LangsHandler } from '../langs/handler';
|
||||
import type { ChatInputCommandInteraction, MessageCommandInteraction, UserCommandInteraction } from '../structures';
|
||||
import type { ChatInputCommandInteraction, Message, MessageCommandInteraction, UserCommandInteraction } from '../structures';
|
||||
|
||||
export class BaseClient {
|
||||
rest!: ApiHandler;
|
||||
@ -245,7 +245,8 @@ export interface BaseClientOptions {
|
||||
interaction:
|
||||
| ChatInputCommandInteraction<boolean>
|
||||
| UserCommandInteraction<boolean>
|
||||
| MessageCommandInteraction<boolean>,
|
||||
| MessageCommandInteraction<boolean>
|
||||
| Message
|
||||
) => {};
|
||||
globalMiddlewares?: readonly (keyof RegisteredMiddlewares)[];
|
||||
}
|
||||
|
@ -97,6 +97,8 @@ export async function onMessageCreate(
|
||||
const { options, errors } = await parseOptions(self, command, rawMessage, args, resolved);
|
||||
const optionsResolver = new OptionResolver(self, options, parent as Command, message.guildId, resolved);
|
||||
const context = new CommandContext(self, message, optionsResolver, shardId, command);
|
||||
const extendContext = self.options?.context?.(message) ?? {};
|
||||
Object.assign(context, extendContext);
|
||||
try {
|
||||
if (command.botPermissions && message.guildId) {
|
||||
const meMember = await self.cache.members?.get(self.botId, message.guildId);
|
||||
|
@ -1,7 +1,7 @@
|
||||
import type { InternalRuntimeConfig, InternalRuntimeConfigHTTP, RuntimeConfig, RuntimeConfigHTTP } from './client/base';
|
||||
import { GatewayIntentBits } from './common';
|
||||
import type { ClientNameEvents, EventContext } from './events';
|
||||
import type { ChatInputCommandInteraction, MessageCommandInteraction, UserCommandInteraction } from './structures';
|
||||
import type { ChatInputCommandInteraction, Message, MessageCommandInteraction, UserCommandInteraction } from './structures';
|
||||
|
||||
export { Logger, PermissionFlagsBits, PermissionStrings, Watcher } from './common';
|
||||
//
|
||||
@ -95,7 +95,7 @@ export const config = {
|
||||
* });
|
||||
*/
|
||||
export function extendContext<T extends {}>(
|
||||
cb: (interaction: ChatInputCommandInteraction | UserCommandInteraction | MessageCommandInteraction) => T,
|
||||
cb: (interaction: ChatInputCommandInteraction | UserCommandInteraction | MessageCommandInteraction | Message) => T,
|
||||
) {
|
||||
return cb;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user