mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-10 20:35: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
|
@ -13,7 +13,7 @@ import { ClearMutesWithoutRoleCmd } from "./commands/ClearMutesWithoutRoleCmd";
|
|||
import { ClearMutesCmd } from "./commands/ClearMutesCmd";
|
||||
import { muteUser } from "./functions/muteUser";
|
||||
import { unmuteUser } from "./functions/unmuteUser";
|
||||
import { Member } from "eris";
|
||||
|
||||
import { ClearActiveMuteOnMemberBanEvt } from "./events/ClearActiveMuteOnMemberBanEvt";
|
||||
import { ReapplyActiveMuteOnJoinEvt } from "./events/ReapplyActiveMuteOnJoinEvt";
|
||||
import { mapToPublicFn } from "../../pluginUtils";
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { mutesCmd } from "../types";
|
||||
import { User } from "eris";
|
||||
|
||||
import { sendSuccessMessage } from "../../../pluginUtils";
|
||||
|
||||
export const ClearBannedMutesCmd = mutesCmd({
|
||||
|
|
|
@ -4,7 +4,6 @@ import { DBDateFormat, isFullMessage, MINUTES, noop, resolveMember } from "../..
|
|||
import moment from "moment-timezone";
|
||||
import { humanizeDurationShort } from "../../../humanizeDurationShort";
|
||||
import { getBaseUrl } from "../../../pluginUtils";
|
||||
import { Member } from "eris";
|
||||
|
||||
export const MutesCmd = mutesCmd({
|
||||
trigger: "mutes",
|
||||
|
@ -112,7 +111,7 @@ export const MutesCmd = mutesCmd({
|
|||
const muteCasesById = muteCases.reduce((map, c) => map.set(c.id, c), new Map());
|
||||
|
||||
lines = filteredMutes.map(mute => {
|
||||
const user = pluginData.client.users.get(mute.user_id);
|
||||
const user = pluginData.client.user!.get(mute.user_id);
|
||||
const username = user ? `${user.username}#${user.discriminator}` : "Unknown#0000";
|
||||
const theCase = muteCasesById.get(mute.case_id);
|
||||
const caseName = theCase ? `Case #${theCase.case_number}` : "No case";
|
||||
|
|
|
@ -2,7 +2,7 @@ import { GuildPluginData } from "knub";
|
|||
import { MutesPluginType } from "../types";
|
||||
import { LogType } from "../../../data/LogType";
|
||||
import { resolveMember, stripObjectToScalars, UnknownUser } from "../../../utils";
|
||||
import { MemberOptions } from "eris";
|
||||
|
||||
import { memberRolesLock } from "../../../utils/lockNameHelpers";
|
||||
|
||||
export async function clearExpiredMutes(pluginData: GuildPluginData<MutesPluginType>) {
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import { Member } from "eris";
|
||||
import { GuildPluginData } from "knub";
|
||||
import { MutesPluginType } from "../types";
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ import {
|
|||
UserNotificationMethod,
|
||||
} from "../../../utils";
|
||||
import { renderTemplate } from "../../../templateFormatter";
|
||||
import { MemberOptions, TextChannel, User } from "eris";
|
||||
|
||||
import { CasesPlugin } from "../../Cases/CasesPlugin";
|
||||
import { CaseTypes } from "../../../data/CaseTypes";
|
||||
import { LogType } from "../../../data/LogType";
|
||||
|
@ -42,7 +42,7 @@ export async function muteUser(
|
|||
// No mod specified -> mark Zeppelin as the mod
|
||||
if (!muteOptions.caseArgs?.modId) {
|
||||
muteOptions.caseArgs = muteOptions.caseArgs ?? {};
|
||||
muteOptions.caseArgs.modId = pluginData.client.user.id;
|
||||
muteOptions.caseArgs.modId = pluginData.client.user!.id;
|
||||
}
|
||||
|
||||
const user = await resolveUser(pluginData.client, userId);
|
||||
|
@ -99,7 +99,7 @@ export async function muteUser(
|
|||
throw new RecoverablePluginError(ERRORS.INVALID_MUTE_ROLE_ID);
|
||||
}
|
||||
|
||||
const zep = await resolveMember(pluginData.client, pluginData.guild, pluginData.client.user.id);
|
||||
const zep = await resolveMember(pluginData.client, pluginData.guild, pluginData.client.user!.id);
|
||||
const zepRoles = pluginData.guild.roles.filter(x => zep!.roles.includes(x.id));
|
||||
// If we have roles and one of them is above the muted role, throw generic error
|
||||
if (zepRoles.length >= 0 && zepRoles.some(zepRole => zepRole.position > actualMuteRole.position)) {
|
||||
|
@ -172,7 +172,7 @@ export async function muteUser(
|
|||
}
|
||||
|
||||
const useChannel = existingMute ? config.message_on_update : config.message_on_mute;
|
||||
const channel = config.message_channel && pluginData.guild.channels.get(config.message_channel);
|
||||
const channel = config.message_channel && pluginData.guild.channels.cache.get(config.message_channel);
|
||||
if (useChannel && channel instanceof TextChannel) {
|
||||
contactMethods.push({ type: "channel", channel });
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ import humanizeDuration from "humanize-duration";
|
|||
import { CasesPlugin } from "../../Cases/CasesPlugin";
|
||||
import { CaseTypes } from "../../../data/CaseTypes";
|
||||
import { LogType } from "../../../data/LogType";
|
||||
import { MemberOptions } from "eris";
|
||||
|
||||
import { memberRolesLock } from "../../../utils/lockNameHelpers";
|
||||
|
||||
export async function unmuteUser(
|
||||
|
@ -19,7 +19,7 @@ export async function unmuteUser(
|
|||
const existingMute = await pluginData.state.mutes.findExistingMuteForUserId(userId);
|
||||
const user = await resolveUser(pluginData.client, userId);
|
||||
const member = await resolveMember(pluginData.client, pluginData.guild, userId); // Grab the fresh member so we don't have stale role info
|
||||
const modId = caseArgs.modId || pluginData.client.user.id;
|
||||
const modId = caseArgs.modId || pluginData.client.user!.id;
|
||||
|
||||
if (!existingMute && member && !memberHasMutedRole(pluginData, member)) return null;
|
||||
|
||||
|
@ -85,7 +85,7 @@ export async function unmuteUser(
|
|||
});
|
||||
|
||||
// Log the action
|
||||
const mod = pluginData.client.users.get(modId);
|
||||
const mod = pluginData.client.user!.get(modId);
|
||||
if (unmuteTime) {
|
||||
pluginData.state.serverLogs.log(LogType.MEMBER_TIMED_UNMUTE, {
|
||||
mod: stripObjectToScalars(mod),
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import * as t from "io-ts";
|
||||
import { tNullable, UserNotificationMethod, UserNotificationResult } from "../../utils";
|
||||
import { Mute } from "../../data/entities/Mute";
|
||||
import { Member } from "eris";
|
||||
|
||||
import { Case } from "../../data/entities/Case";
|
||||
import { BasePluginType, typedGuildCommand, typedGuildEventListener } from "knub";
|
||||
import { GuildLogs } from "../../data/GuildLogs";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue