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,9 +1,9 @@
|
|||
import { PluginOptions } from "knub";
|
||||
import { ConfigSchema, NameHistoryPluginType } from "./types";
|
||||
import { zeppelinPlugin } from "../ZeppelinPluginBlueprint";
|
||||
import { GuildNicknameHistory } from "src/data/GuildNicknameHistory";
|
||||
import { UsernameHistory } from "src/data/UsernameHistory";
|
||||
import { Queue } from "src/Queue";
|
||||
import { zeppelinGuildPlugin } from "../ZeppelinPluginBlueprint";
|
||||
import { GuildNicknameHistory } from "../../data/GuildNicknameHistory";
|
||||
import { UsernameHistory } from "../../data/UsernameHistory";
|
||||
import { Queue } from "../../Queue";
|
||||
import { NamesCmd } from "./commands/NamesCmd";
|
||||
import { ChannelJoinEvt, MessageCreateEvt } from "./events/UpdateNameEvts";
|
||||
|
||||
|
@ -21,7 +21,7 @@ const defaultOptions: PluginOptions<NameHistoryPluginType> = {
|
|||
],
|
||||
};
|
||||
|
||||
export const NameHistoryPlugin = zeppelinPlugin<NameHistoryPluginType>()("name_history", {
|
||||
export const NameHistoryPlugin = zeppelinGuildPlugin<NameHistoryPluginType>()("name_history", {
|
||||
showInDocs: false,
|
||||
|
||||
configSchema: ConfigSchema,
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
import { nameHistoryCmd } from "../types";
|
||||
import { commandTypeHelpers as ct } from "../../../commandTypes";
|
||||
import { createChunkedMessage, disableCodeBlocks } from "knub/dist/helpers";
|
||||
import { NICKNAME_RETENTION_PERIOD } from "src/data/cleanup/nicknames";
|
||||
import { DAYS } from "src/utils";
|
||||
import { MAX_NICKNAME_ENTRIES_PER_USER } from "src/data/GuildNicknameHistory";
|
||||
import { MAX_USERNAME_ENTRIES_PER_USER } from "src/data/UsernameHistory";
|
||||
import { sendErrorMessage } from "src/pluginUtils";
|
||||
import { NICKNAME_RETENTION_PERIOD } from "../../../data/cleanup/nicknames";
|
||||
import { DAYS } from "../../../utils";
|
||||
import { MAX_NICKNAME_ENTRIES_PER_USER } from "../../../data/GuildNicknameHistory";
|
||||
import { MAX_USERNAME_ENTRIES_PER_USER } from "../../../data/UsernameHistory";
|
||||
import { sendErrorMessage } from "../../../pluginUtils";
|
||||
|
||||
export const NamesCmd = nameHistoryCmd({
|
||||
trigger: "names",
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import * as t from "io-ts";
|
||||
import { BasePluginType, command, eventListener } from "knub";
|
||||
import { GuildNicknameHistory } from "src/data/GuildNicknameHistory";
|
||||
import { UsernameHistory } from "src/data/UsernameHistory";
|
||||
import { Queue } from "src/Queue";
|
||||
import { BasePluginType, guildCommand, guildEventListener } from "knub";
|
||||
import { GuildNicknameHistory } from "../../data/GuildNicknameHistory";
|
||||
import { UsernameHistory } from "../../data/UsernameHistory";
|
||||
import { Queue } from "../../Queue";
|
||||
|
||||
export const ConfigSchema = t.type({
|
||||
can_view: t.boolean,
|
||||
|
@ -18,5 +18,5 @@ export interface NameHistoryPluginType extends BasePluginType {
|
|||
};
|
||||
}
|
||||
|
||||
export const nameHistoryCmd = command<NameHistoryPluginType>();
|
||||
export const nameHistoryEvt = eventListener<NameHistoryPluginType>();
|
||||
export const nameHistoryCmd = guildCommand<NameHistoryPluginType>();
|
||||
export const nameHistoryEvt = guildEventListener<NameHistoryPluginType>();
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { Member } from "eris";
|
||||
import { PluginData } from "knub";
|
||||
import { GuildPluginData } from "knub";
|
||||
import { NameHistoryPluginType } from "./types";
|
||||
|
||||
export async function updateNickname(pluginData: PluginData<NameHistoryPluginType>, member: Member) {
|
||||
export async function updateNickname(pluginData: GuildPluginData<NameHistoryPluginType>, member: Member) {
|
||||
if (!member) return;
|
||||
const latestEntry = await pluginData.state.nicknameHistory.getLastEntry(member.id);
|
||||
if (!latestEntry || latestEntry.nickname !== member.nick) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue