mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-10 20:35:02 +00:00
Update to Knub30.0.0-beta.37 and Eris 0.15, first pass
This commit is contained in:
parent
84da543205
commit
f6be4f4af6
133 changed files with 6507 additions and 380 deletions
|
@ -42,7 +42,8 @@ const defaultOptions: PluginOptions<SpamPluginType> = {
|
|||
],
|
||||
};
|
||||
|
||||
export const SpamPlugin = zeppelinGuildPlugin<SpamPluginType>()("spam", {
|
||||
export const SpamPlugin = zeppelinGuildPlugin<SpamPluginType>()({
|
||||
name: "spam",
|
||||
showInDocs: true,
|
||||
info: {
|
||||
prettyName: "Spam protection",
|
||||
|
@ -63,7 +64,7 @@ export const SpamPlugin = zeppelinGuildPlugin<SpamPluginType>()("spam", {
|
|||
SpamVoiceSwitchEvt,
|
||||
],
|
||||
|
||||
onLoad(pluginData) {
|
||||
afterLoad(pluginData) {
|
||||
const { state, guild } = pluginData;
|
||||
|
||||
state.logs = new GuildLogs(guild.id);
|
||||
|
@ -81,7 +82,7 @@ export const SpamPlugin = zeppelinGuildPlugin<SpamPluginType>()("spam", {
|
|||
state.savedMessages.events.on("create", state.onMessageCreateFn);
|
||||
},
|
||||
|
||||
onUnload(pluginData) {
|
||||
beforeUnload(pluginData) {
|
||||
pluginData.state.savedMessages.events.off("create", pluginData.state.onMessageCreateFn);
|
||||
},
|
||||
});
|
||||
|
|
|
@ -8,7 +8,7 @@ export const SpamVoiceJoinEvt = spamEvt({
|
|||
const member = meta.args.member;
|
||||
const channel = meta.args.newChannel;
|
||||
|
||||
const config = meta.pluginData.config.getMatchingConfig({ member, channelId: channel.id });
|
||||
const config = await meta.pluginData.config.getMatchingConfig({ member, channelId: channel.id });
|
||||
const maxVoiceMoves = config.max_voice_moves;
|
||||
if (maxVoiceMoves) {
|
||||
logAndDetectOtherSpam(
|
||||
|
@ -33,7 +33,7 @@ export const SpamVoiceSwitchEvt = spamEvt({
|
|||
const member = meta.args.member;
|
||||
const channel = meta.args.newChannel;
|
||||
|
||||
const config = meta.pluginData.config.getMatchingConfig({ member, channelId: channel.id });
|
||||
const config = await meta.pluginData.config.getMatchingConfig({ member, channelId: channel.id });
|
||||
const maxVoiceMoves = config.max_voice_moves;
|
||||
if (maxVoiceMoves) {
|
||||
logAndDetectOtherSpam(
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import * as t from "io-ts";
|
||||
import { BasePluginType, guildEventListener } from "knub";
|
||||
import { BasePluginType, typedGuildEventListener } from "knub";
|
||||
import { tNullable } from "../../utils";
|
||||
import { GuildLogs } from "../../data/GuildLogs";
|
||||
import { GuildArchives } from "../../data/GuildArchives";
|
||||
|
@ -77,4 +77,4 @@ export interface SpamPluginType extends BasePluginType {
|
|||
};
|
||||
}
|
||||
|
||||
export const spamEvt = guildEventListener<SpamPluginType>();
|
||||
export const spamEvt = typedGuildEventListener<SpamPluginType>();
|
||||
|
|
|
@ -5,7 +5,7 @@ import { logAndDetectMessageSpam } from "./logAndDetectMessageSpam";
|
|||
|
||||
export async function logCensor(pluginData: GuildPluginData<SpamPluginType>, savedMessage: SavedMessage) {
|
||||
const member = pluginData.guild.members.get(savedMessage.user_id);
|
||||
const config = pluginData.config.getMatchingConfig({
|
||||
const config = await pluginData.config.getMatchingConfig({
|
||||
userId: savedMessage.user_id,
|
||||
channelId: savedMessage.channel_id,
|
||||
member,
|
||||
|
|
|
@ -8,7 +8,7 @@ export async function onMessageCreate(pluginData: GuildPluginData<SpamPluginType
|
|||
if (savedMessage.is_bot) return;
|
||||
|
||||
const member = pluginData.guild.members.get(savedMessage.user_id);
|
||||
const config = pluginData.config.getMatchingConfig({
|
||||
const config = await pluginData.config.getMatchingConfig({
|
||||
userId: savedMessage.user_id,
|
||||
channelId: savedMessage.channel_id,
|
||||
member,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue