mirror of
https://github.com/smogon/pokemon-showdown.git
synced 2026-04-25 15:40:31 -05:00
Chat: Support specifying priority for chatfilters (#7792)
This commit is contained in:
parent
7156fec779
commit
9a9b06ffc9
|
|
@ -84,7 +84,7 @@ export type SettingsHandler = (
|
|||
* 2. return an altered string - to alter a user's message
|
||||
* 3. return undefined to send the original message through
|
||||
*/
|
||||
export type ChatFilter = (
|
||||
export type ChatFilter = ((
|
||||
this: CommandContext,
|
||||
message: string,
|
||||
user: User,
|
||||
|
|
@ -92,7 +92,7 @@ export type ChatFilter = (
|
|||
connection: Connection,
|
||||
targetUser: User | null,
|
||||
originalMessage: string
|
||||
) => string | false | null | undefined;
|
||||
) => string | false | null | undefined) & {priority?: number};
|
||||
|
||||
export type NameFilter = (name: string, user: User) => string;
|
||||
export type NicknameFilter = (name: string, user: User) => string | false;
|
||||
|
|
@ -1740,6 +1740,7 @@ export const Chat = new class {
|
|||
this.loadPlugin(`chat-plugins/${file}`);
|
||||
}
|
||||
Chat.oldPlugins = {};
|
||||
Utils.sortBy(Chat.filters, filter => filter.priority || 0);
|
||||
}
|
||||
destroy() {
|
||||
for (const handler of Chat.destroyHandlers) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user