mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-10 20:35:02 +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,11 +1,11 @@
|
|||
import { zeppelinPlugin } from "../ZeppelinPluginBlueprint";
|
||||
import { UsernameHistory } from "src/data/UsernameHistory";
|
||||
import { Queue } from "src/Queue";
|
||||
import { zeppelinGuildPlugin } from "../ZeppelinPluginBlueprint";
|
||||
import { UsernameHistory } from "../../data/UsernameHistory";
|
||||
import { Queue } from "../../Queue";
|
||||
import { UsernameSaverPluginType } from "./types";
|
||||
import { MessageCreateUpdateUsernameEvt, VoiceChannelJoinUpdateUsernameEvt } from "./events/UpdateUsernameEvts";
|
||||
import * as t from "io-ts";
|
||||
|
||||
export const UsernameSaverPlugin = zeppelinPlugin<UsernameSaverPluginType>()("username_saver", {
|
||||
export const UsernameSaverPlugin = zeppelinGuildPlugin<UsernameSaverPluginType>()("username_saver", {
|
||||
showInDocs: false,
|
||||
|
||||
configSchema: t.type({}),
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { usernameEvent } from "../types";
|
||||
import { usernameSaverEvt } from "../types";
|
||||
import { updateUsername } from "../updateUsername";
|
||||
|
||||
export const MessageCreateUpdateUsernameEvt = usernameEvent({
|
||||
export const MessageCreateUpdateUsernameEvt = usernameSaverEvt({
|
||||
event: "messageCreate",
|
||||
|
||||
async listener(meta) {
|
||||
|
@ -10,7 +10,7 @@ export const MessageCreateUpdateUsernameEvt = usernameEvent({
|
|||
},
|
||||
});
|
||||
|
||||
export const VoiceChannelJoinUpdateUsernameEvt = usernameEvent({
|
||||
export const VoiceChannelJoinUpdateUsernameEvt = usernameSaverEvt({
|
||||
event: "voiceChannelJoin",
|
||||
|
||||
async listener(meta) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { BasePluginType, eventListener } from "knub";
|
||||
import { UsernameHistory } from "src/data/UsernameHistory";
|
||||
import { Queue } from "src/Queue";
|
||||
import { BasePluginType, guildEventListener } from "knub";
|
||||
import { UsernameHistory } from "../../data/UsernameHistory";
|
||||
import { Queue } from "../../Queue";
|
||||
|
||||
export interface UsernameSaverPluginType extends BasePluginType {
|
||||
state: {
|
||||
|
@ -9,4 +9,4 @@ export interface UsernameSaverPluginType extends BasePluginType {
|
|||
};
|
||||
}
|
||||
|
||||
export const usernameEvent = eventListener<UsernameSaverPluginType>();
|
||||
export const usernameSaverEvt = guildEventListener<UsernameSaverPluginType>();
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { User } from "eris";
|
||||
import { PluginData } from "knub";
|
||||
import { GuildPluginData } from "knub";
|
||||
import { UsernameSaverPluginType } from "./types";
|
||||
|
||||
export async function updateUsername(pluginData: PluginData<UsernameSaverPluginType>, user: User) {
|
||||
export async function updateUsername(pluginData: GuildPluginData<UsernameSaverPluginType>, user: User) {
|
||||
if (!user) return;
|
||||
const newUsername = `${user.username}#${user.discriminator}`;
|
||||
const latestEntry = await pluginData.state.usernameHistory.getLastEntry(user.id);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue