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
|
@ -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),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue