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:
commit
43b8017985
279 changed files with 6192 additions and 3044 deletions
|
@ -1,6 +1,7 @@
|
|||
import { PluginOptions, guildPlugin } from "knub";
|
||||
import { GuildMemberTimezones } from "../../data/GuildMemberTimezones.js";
|
||||
import { makePublicFn } from "../../pluginUtils.js";
|
||||
import { CommonPlugin } from "../Common/CommonPlugin.js";
|
||||
import { ResetTimezoneCmd } from "./commands/ResetTimezoneCmd.js";
|
||||
import { SetTimezoneCmd } from "./commands/SetTimezoneCmd.js";
|
||||
import { ViewTimezoneCmd } from "./commands/ViewTimezoneCmd.js";
|
||||
|
@ -57,4 +58,8 @@ export const TimeAndDatePlugin = guildPlugin<TimeAndDatePluginType>()({
|
|||
|
||||
state.memberTimezones = GuildMemberTimezones.getGuildInstance(guild.id);
|
||||
},
|
||||
|
||||
beforeStart(pluginData) {
|
||||
pluginData.state.common = pluginData.getPlugin(CommonPlugin);
|
||||
},
|
||||
});
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import { sendSuccessMessage } from "../../../pluginUtils.js";
|
||||
import { getGuildTz } from "../functions/getGuildTz.js";
|
||||
import { timeAndDateCmd } from "../types.js";
|
||||
|
||||
|
@ -11,9 +10,8 @@ export const ResetTimezoneCmd = timeAndDateCmd({
|
|||
async run({ pluginData, message }) {
|
||||
await pluginData.state.memberTimezones.reset(message.author.id);
|
||||
const serverTimezone = getGuildTz(pluginData);
|
||||
sendSuccessMessage(
|
||||
pluginData,
|
||||
message.channel,
|
||||
void pluginData.state.common.sendSuccessMessage(
|
||||
message,
|
||||
`Your timezone has been reset to server default, **${serverTimezone}**`,
|
||||
);
|
||||
},
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import { escapeInlineCode } from "discord.js";
|
||||
import { commandTypeHelpers as ct } from "../../../commandTypes.js";
|
||||
import { sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils.js";
|
||||
import { trimLines } from "../../../utils.js";
|
||||
import { parseFuzzyTimezone } from "../../../utils/parseFuzzyTimezone.js";
|
||||
import { timeAndDateCmd } from "../types.js";
|
||||
|
@ -16,9 +15,8 @@ export const SetTimezoneCmd = timeAndDateCmd({
|
|||
async run({ pluginData, message, args }) {
|
||||
const parsedTz = parseFuzzyTimezone(args.timezone);
|
||||
if (!parsedTz) {
|
||||
sendErrorMessage(
|
||||
pluginData,
|
||||
message.channel,
|
||||
void pluginData.state.common.sendErrorMessage(
|
||||
message,
|
||||
trimLines(`
|
||||
Invalid timezone: \`${escapeInlineCode(args.timezone)}\`
|
||||
Zeppelin uses timezone locations rather than specific timezone names.
|
||||
|
@ -29,6 +27,6 @@ export const SetTimezoneCmd = timeAndDateCmd({
|
|||
}
|
||||
|
||||
await pluginData.state.memberTimezones.set(message.author.id, parsedTz);
|
||||
sendSuccessMessage(pluginData, message.channel, `Your timezone is now set to **${parsedTz}**`);
|
||||
void pluginData.state.common.sendSuccessMessage(message, `Your timezone is now set to **${parsedTz}**`);
|
||||
},
|
||||
});
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
import { BasePluginType, guildPluginMessageCommand } from "knub";
|
||||
import { BasePluginType, guildPluginMessageCommand, pluginUtils } from "knub";
|
||||
import { U } from "ts-toolbelt";
|
||||
import z from "zod";
|
||||
import { GuildMemberTimezones } from "../../data/GuildMemberTimezones.js";
|
||||
import { keys } from "../../utils.js";
|
||||
import { zValidTimezone } from "../../utils/zValidTimezone.js";
|
||||
import { CommonPlugin } from "../Common/CommonPlugin.js";
|
||||
import { defaultDateFormats } from "./defaultDateFormats.js";
|
||||
|
||||
const zDateFormatKeys = z.enum(keys(defaultDateFormats) as U.ListOf<keyof typeof defaultDateFormats>);
|
||||
|
@ -18,6 +19,7 @@ export interface TimeAndDatePluginType extends BasePluginType {
|
|||
config: z.infer<typeof zTimeAndDateConfig>;
|
||||
state: {
|
||||
memberTimezones: GuildMemberTimezones;
|
||||
common: pluginUtils.PluginPublicInterface<typeof CommonPlugin>;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue