mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-12 21:05:02 +00:00
More rework progress, remove all eris imports
This commit is contained in:
parent
8f7a6510eb
commit
52839cc9f3
181 changed files with 352 additions and 343 deletions
|
@ -2,7 +2,6 @@ import { MatchableTextType } from "./matchMultipleTextTypesOnMessage";
|
|||
import { AutomodContext, AutomodPluginType } from "../types";
|
||||
import { messageSummary, verboseChannelMention } from "../../../utils";
|
||||
import { GuildPluginData } from "knub";
|
||||
import { User } from "eris";
|
||||
|
||||
export function getTextMatchPartialSummary(
|
||||
pluginData: GuildPluginData<AutomodPluginType>,
|
||||
|
@ -11,13 +10,13 @@ export function getTextMatchPartialSummary(
|
|||
) {
|
||||
if (type === "message") {
|
||||
const message = context.message!;
|
||||
const channel = pluginData.guild.channels.get(message.channel_id);
|
||||
const channel = pluginData.guild.channels.cache.get(message.channel_id);
|
||||
const channelMention = channel ? verboseChannelMention(channel) : `\`#${message.channel_id}\``;
|
||||
|
||||
return `message in ${channelMention}:\n${messageSummary(message)}`;
|
||||
} else if (type === "embed") {
|
||||
const message = context.message!;
|
||||
const channel = pluginData.guild.channels.get(message.channel_id);
|
||||
const channel = pluginData.guild.channels.cache.get(message.channel_id);
|
||||
const channelMention = channel ? verboseChannelMention(channel) : `\`#${message.channel_id}\``;
|
||||
|
||||
return `message embed in ${channelMention}:\n${messageSummary(message)}`;
|
||||
|
|
|
@ -2,6 +2,7 @@ import { SavedMessage } from "../../../data/entities/SavedMessage";
|
|||
import { resolveMember } from "../../../utils";
|
||||
import { GuildPluginData } from "knub";
|
||||
import { AutomodPluginType } from "../types";
|
||||
import { Activity, Constants } from "discord.js";
|
||||
|
||||
type TextTriggerWithMultipleMatchTypes = {
|
||||
match_messages: boolean;
|
||||
|
@ -40,19 +41,21 @@ export async function* matchMultipleTextTypesOnMessage(
|
|||
}
|
||||
|
||||
if (trigger.match_visible_names) {
|
||||
yield ["visiblename", member.nick || msg.data.author.username];
|
||||
yield ["visiblename", member.nickname || msg.data.author.username];
|
||||
}
|
||||
|
||||
if (trigger.match_usernames) {
|
||||
yield ["username", `${msg.data.author.username}#${msg.data.author.discriminator}`];
|
||||
}
|
||||
|
||||
if (trigger.match_nicknames && member.nick) {
|
||||
yield ["nickname", member.nick];
|
||||
if (trigger.match_nicknames && member.nickname) {
|
||||
yield ["nickname", member.nickname];
|
||||
}
|
||||
|
||||
// type 4 = custom status
|
||||
if (trigger.match_custom_status && member.game?.type === 4 && member.game?.state) {
|
||||
yield ["customstatus", member.game.state];
|
||||
for (const activity of member.presence.activities) {
|
||||
if (activity.type === Constants.ActivityTypes[4]) {
|
||||
yield ["customstatus", `${activity.emoji} ${activity.name}`];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
import { disableUserNotificationStrings, UserNotificationMethod } from "../../../utils";
|
||||
import { ERRORS, RecoverablePluginError } from "../../../RecoverablePluginError";
|
||||
import { TextChannel } from "eris";
|
||||
|
||||
import { GuildPluginData } from "knub";
|
||||
import { AutomodPluginType } from "../types";
|
||||
import { TextChannel } from "discord.js";
|
||||
|
||||
export function resolveActionContactMethods(
|
||||
pluginData: GuildPluginData<AutomodPluginType>,
|
||||
|
@ -18,7 +19,7 @@ export function resolveActionContactMethods(
|
|||
throw new RecoverablePluginError(ERRORS.NO_USER_NOTIFICATION_CHANNEL);
|
||||
}
|
||||
|
||||
const channel = pluginData.guild.channels.get(actionConfig.notifyChannel);
|
||||
const channel = pluginData.guild.channels.cache.get(actionConfig.notifyChannel);
|
||||
if (!(channel instanceof TextChannel)) {
|
||||
throw new RecoverablePluginError(ERRORS.INVALID_USER_NOTIFICATION_CHANNEL);
|
||||
}
|
||||
|
|
|
@ -5,14 +5,14 @@ import { availableActions } from "../actions/availableActions";
|
|||
import { AutomodTriggerMatchResult } from "../helpers";
|
||||
import { CleanAction } from "../actions/clean";
|
||||
import { checkAndUpdateCooldown } from "./checkAndUpdateCooldown";
|
||||
import { TextChannel } from "eris";
|
||||
import { TextChannel } from "discord.js";
|
||||
|
||||
export async function runAutomod(pluginData: GuildPluginData<AutomodPluginType>, context: AutomodContext) {
|
||||
const userId = context.user?.id || context.member?.id || context.message?.user_id;
|
||||
const user = context.user || (userId && pluginData.client.users.get(userId));
|
||||
const member = context.member || (userId && pluginData.guild.members.get(userId)) || null;
|
||||
const user = context.user || (userId && pluginData.client.users!.cache.get(userId));
|
||||
const member = context.member || (userId && pluginData.guild.members.cache.get(userId)) || null;
|
||||
const channelId = context.message?.channel_id;
|
||||
const channel = channelId ? (pluginData.guild.channels.get(channelId) as TextChannel) : null;
|
||||
const channel = channelId ? (pluginData.guild.channels.cache.get(channelId) as TextChannel) : null;
|
||||
const categoryId = channel?.parentID;
|
||||
|
||||
const config = await pluginData.config.getMatchingConfig({
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import { User } from "eris";
|
||||
import { GuildPluginData } from "knub";
|
||||
import { AutomodPluginType } from "../types";
|
||||
import { LogsPlugin } from "../../Logs/LogsPlugin";
|
||||
import { LogType } from "../../../data/LogType";
|
||||
import { stripObjectToScalars } from "../../../utils";
|
||||
import { runAutomodOnAntiraidLevel } from "../events/runAutomodOnAntiraidLevel";
|
||||
import { User } from "discord.js";
|
||||
|
||||
export async function setAntiraidLevel(
|
||||
pluginData: GuildPluginData<AutomodPluginType>,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue