mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-14 22:05:01 +00:00
Update to new Knub 30 beta. Code clean-up.
This commit is contained in:
parent
5d579446c5
commit
2f470dc37a
299 changed files with 1075 additions and 1004 deletions
|
@ -1,6 +1,10 @@
|
|||
import { PluginData } from "knub";
|
||||
import { GuildPluginData } from "knub";
|
||||
import { defaultDateFormats } from "../defaultDateFormats";
|
||||
import { TimeAndDatePluginType } from "../types";
|
||||
|
||||
export function getDateFormat(pluginData: PluginData<any>, formatName: keyof typeof defaultDateFormats) {
|
||||
export function getDateFormat(
|
||||
pluginData: GuildPluginData<TimeAndDatePluginType>,
|
||||
formatName: keyof typeof defaultDateFormats,
|
||||
) {
|
||||
return pluginData.config.get().date_formats?.[formatName] || defaultDateFormats[formatName];
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { PluginData } from "knub";
|
||||
import { GuildPluginData } from "knub";
|
||||
import { ZeppelinGuildConfig } from "../../../types";
|
||||
import { TimeAndDatePluginType } from "../types";
|
||||
|
||||
export function getGuildTz(pluginData: PluginData<TimeAndDatePluginType>) {
|
||||
export function getGuildTz(pluginData: GuildPluginData<TimeAndDatePluginType>) {
|
||||
return pluginData.config.get().timezone;
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { PluginData } from "knub";
|
||||
import { GuildPluginData } from "knub";
|
||||
import { TimeAndDatePluginType } from "../types";
|
||||
import { getGuildTz } from "./getGuildTz";
|
||||
|
||||
export async function getMemberTz(pluginData: PluginData<TimeAndDatePluginType>, memberId: string) {
|
||||
export async function getMemberTz(pluginData: GuildPluginData<TimeAndDatePluginType>, memberId: string) {
|
||||
const memberTz = await pluginData.state.memberTimezones.get(memberId);
|
||||
return memberTz?.timezone || getGuildTz(pluginData);
|
||||
}
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import { PluginData } from "knub";
|
||||
import { GuildPluginData } from "knub";
|
||||
import { TimeAndDatePluginType } from "../types";
|
||||
import moment from "moment-timezone";
|
||||
import { getGuildTz } from "./getGuildTz";
|
||||
|
||||
export function inGuildTz(pluginData: PluginData<TimeAndDatePluginType>, input?: moment.Moment | number) {
|
||||
export function inGuildTz(pluginData: GuildPluginData<TimeAndDatePluginType>, input?: moment.Moment | number) {
|
||||
let momentObj: moment.Moment;
|
||||
if (typeof input === "number") {
|
||||
momentObj = moment.utc(input, "x");
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
import { PluginData } from "knub";
|
||||
import { GuildPluginData } from "knub";
|
||||
import { TimeAndDatePluginType } from "../types";
|
||||
import moment from "moment-timezone";
|
||||
import { getGuildTz } from "./getGuildTz";
|
||||
import { getMemberTz } from "./getMemberTz";
|
||||
|
||||
export async function inMemberTz(
|
||||
pluginData: PluginData<TimeAndDatePluginType>,
|
||||
pluginData: GuildPluginData<TimeAndDatePluginType>,
|
||||
memberId: string,
|
||||
input?: moment.Moment | number,
|
||||
) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue