mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-11 20:55:01 +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
|
@ -1,4 +1,3 @@
|
|||
import { Member, TextChannel } from "eris";
|
||||
import { LogType } from "../../../data/LogType";
|
||||
import { IgnoredEventType, ModActionsPluginType } from "../types";
|
||||
import { errorMessage, resolveUser, resolveMember } from "../../../utils";
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import { GuildTextableChannel, Member, Message, TextChannel, User } from "eris";
|
||||
import { asSingleLine, isDiscordRESTError, UnknownUser } from "../../../utils";
|
||||
import { hasPermission, sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
|
||||
import { GuildPluginData } from "knub";
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { GuildPluginData } from "knub";
|
||||
import { ModActionsPluginType } from "../types";
|
||||
import { User, Message, Member } from "eris";
|
||||
|
||||
import { UnknownUser, asSingleLine } from "../../../utils";
|
||||
import { sendErrorMessage, sendSuccessMessage, hasPermission } from "../../../pluginUtils";
|
||||
import { formatReasonWithAttachments } from "./formatReasonWithAttachments";
|
||||
|
|
|
@ -8,7 +8,7 @@ import {
|
|||
ucfirst,
|
||||
UserNotificationResult,
|
||||
} from "../../../utils";
|
||||
import { DiscordRESTError, User } from "eris";
|
||||
|
||||
import { renderTemplate } from "../../../templateFormatter";
|
||||
import { getDefaultContactMethods } from "./getDefaultContactMethods";
|
||||
import { LogType } from "../../../data/LogType";
|
||||
|
@ -99,7 +99,7 @@ export async function banUserId(
|
|||
|
||||
const existingTempban = await pluginData.state.tempbans.findExistingTempbanForUserId(user.id);
|
||||
if (banTime && banTime > 0) {
|
||||
const selfId = pluginData.client.user.id;
|
||||
const selfId = pluginData.client.user!.id;
|
||||
if (existingTempban) {
|
||||
pluginData.state.tempbans.updateExpiryTime(user.id, banTime, banOptions.modId ?? selfId);
|
||||
} else {
|
||||
|
@ -108,7 +108,7 @@ export async function banUserId(
|
|||
}
|
||||
|
||||
// Create a case for this action
|
||||
const modId = banOptions.caseArgs?.modId || pluginData.client.user.id;
|
||||
const modId = banOptions.caseArgs?.modId || pluginData.client.user!.id;
|
||||
const casesPlugin = pluginData.getPlugin(CasesPlugin);
|
||||
|
||||
const noteDetails: string[] = [];
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
import { Attachment } from "eris";
|
||||
|
||||
export function formatReasonWithAttachments(reason: string, attachments: Attachment[]) {
|
||||
const attachmentUrls = attachments.map(a => a.url);
|
||||
return ((reason || "") + " " + attachmentUrls.join(" ")).trim();
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import { GuildPluginData } from "knub";
|
||||
import { ModActionsPluginType } from "../types";
|
||||
import { UserNotificationMethod } from "../../../utils";
|
||||
import { TextChannel } from "eris";
|
||||
|
||||
export function getDefaultContactMethods(
|
||||
pluginData: GuildPluginData<ModActionsPluginType>,
|
||||
|
@ -15,7 +14,7 @@ export function getDefaultContactMethods(
|
|||
}
|
||||
|
||||
if (config[`message_on_${type}`] && config.message_channel) {
|
||||
const channel = pluginData.guild.channels.get(config.message_channel);
|
||||
const channel = pluginData.guild.channels.cache.get(config.message_channel);
|
||||
if (channel instanceof TextChannel) {
|
||||
methods.push({
|
||||
type: "channel",
|
||||
|
|
|
@ -4,14 +4,13 @@ import { isDiscordHTTPError, isDiscordRESTError, SECONDS, sleep } from "../../..
|
|||
import { LogsPlugin } from "../../Logs/LogsPlugin";
|
||||
import { LogType } from "../../../data/LogType";
|
||||
import { hasDiscordPermissions } from "../../../utils/hasDiscordPermissions";
|
||||
import { Constants } from "eris";
|
||||
|
||||
export async function isBanned(
|
||||
pluginData: GuildPluginData<ModActionsPluginType>,
|
||||
userId: string,
|
||||
timeout: number = 5 * SECONDS,
|
||||
): Promise<boolean> {
|
||||
const botMember = pluginData.guild.members.get(pluginData.client.user.id);
|
||||
const botMember = pluginData.guild.members.cache.get(pluginData.client.user!.id);
|
||||
if (botMember && !hasDiscordPermissions(botMember.permissions, Constants.Permissions.banMembers)) {
|
||||
pluginData.getPlugin(LogsPlugin).log(LogType.BOT_ALERT, {
|
||||
body: `Missing "Ban Members" permission to check for existing bans`,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { GuildPluginData } from "knub";
|
||||
import { IgnoredEventType, KickOptions, KickResult, ModActionsPluginType } from "../types";
|
||||
import { Member } from "eris";
|
||||
|
||||
import {
|
||||
createUserNotificationError,
|
||||
notifyUser,
|
||||
|
@ -63,7 +63,7 @@ export async function kickMember(
|
|||
};
|
||||
}
|
||||
|
||||
const modId = kickOptions.caseArgs?.modId || pluginData.client.user.id;
|
||||
const modId = kickOptions.caseArgs?.modId || pluginData.client.user!.id;
|
||||
|
||||
// Create a case for this action
|
||||
const casesPlugin = pluginData.getPlugin(CasesPlugin);
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import { TextChannel } from "eris";
|
||||
import { disableUserNotificationStrings, UserNotificationMethod } from "../../../utils";
|
||||
|
||||
export function readContactMethodsFromArgs(args: {
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import { Message } from "eris";
|
||||
import { CaseTypes } from "../../../data/CaseTypes";
|
||||
import { Case } from "../../../data/entities/Case";
|
||||
import { LogType } from "../../../data/LogType";
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { GuildPluginData } from "knub";
|
||||
import { ModActionsPluginType, WarnOptions, WarnResult } from "../types";
|
||||
import { Member } from "eris";
|
||||
|
||||
import { getDefaultContactMethods } from "./getDefaultContactMethods";
|
||||
import {
|
||||
createUserNotificationError,
|
||||
|
@ -62,7 +62,7 @@ export async function warnMember(
|
|||
}
|
||||
}
|
||||
|
||||
const modId = warnOptions.caseArgs?.modId ?? pluginData.client.user.id;
|
||||
const modId = warnOptions.caseArgs?.modId ?? pluginData.client.user!.id;
|
||||
|
||||
const casesPlugin = pluginData.getPlugin(CasesPlugin);
|
||||
const createdCase = await casesPlugin.createCase({
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue