3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-07-08 03:27:20 +00:00

Merge branch '240811_application_commands_merge_2' into next

This commit is contained in:
Dragory 2024-08-11 22:28:41 +03:00
commit 43b8017985
No known key found for this signature in database
279 changed files with 6192 additions and 3044 deletions

View file

@ -2,6 +2,7 @@ import { PluginOptions, guildPlugin } from "knub";
import { Queue } from "../../Queue.js";
import { GuildNicknameHistory } from "../../data/GuildNicknameHistory.js";
import { UsernameHistory } from "../../data/UsernameHistory.js";
import { CommonPlugin } from "../Common/CommonPlugin.js";
import { NamesCmd } from "./commands/NamesCmd.js";
import { NameHistoryPluginType, zNameHistoryConfig } from "./types.js";
@ -44,4 +45,8 @@ export const NameHistoryPlugin = guildPlugin<NameHistoryPluginType>()({
state.usernameHistory = new UsernameHistory();
state.updateQueue = new Queue();
},
beforeStart(pluginData) {
pluginData.state.common = pluginData.getPlugin(CommonPlugin);
},
});

View file

@ -4,7 +4,6 @@ import { commandTypeHelpers as ct } from "../../../commandTypes.js";
import { MAX_NICKNAME_ENTRIES_PER_USER } from "../../../data/GuildNicknameHistory.js";
import { MAX_USERNAME_ENTRIES_PER_USER } from "../../../data/UsernameHistory.js";
import { NICKNAME_RETENTION_PERIOD } from "../../../data/cleanup/nicknames.js";
import { sendErrorMessage } from "../../../pluginUtils.js";
import { DAYS, renderUsername } from "../../../utils.js";
import { nameHistoryCmd } from "../types.js";
@ -21,7 +20,7 @@ export const NamesCmd = nameHistoryCmd({
const usernames = await pluginData.state.usernameHistory.getByUserId(args.userId);
if (nicknames.length === 0 && usernames.length === 0) {
sendErrorMessage(pluginData, msg.channel, "No name history found");
void pluginData.state.common.sendErrorMessage(msg, "No name history found");
return;
}

View file

@ -1,8 +1,9 @@
import { BasePluginType, guildPluginEventListener, guildPluginMessageCommand } from "knub";
import { BasePluginType, guildPluginEventListener, guildPluginMessageCommand, pluginUtils } from "knub";
import z from "zod";
import { Queue } from "../../Queue.js";
import { GuildNicknameHistory } from "../../data/GuildNicknameHistory.js";
import { UsernameHistory } from "../../data/UsernameHistory.js";
import { CommonPlugin } from "../Common/CommonPlugin.js";
export const zNameHistoryConfig = z.strictObject({
can_view: z.boolean(),
@ -14,6 +15,7 @@ export interface NameHistoryPluginType extends BasePluginType {
nicknameHistory: GuildNicknameHistory;
usernameHistory: UsernameHistory;
updateQueue: Queue;
common: pluginUtils.PluginPublicInterface<typeof CommonPlugin>;
};
}