mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-11 20:55:01 +00:00
Update to new Knub 30 beta. Code clean-up.
This commit is contained in:
parent
5d579446c5
commit
2f470dc37a
299 changed files with 1075 additions and 1004 deletions
|
@ -1,9 +1,9 @@
|
|||
import { Member, TextChannel } from "eris";
|
||||
import { LogType } from "src/data/LogType";
|
||||
import { LogType } from "../../../data/LogType";
|
||||
import { IgnoredEventType, ModActionsPluginType } from "../types";
|
||||
import { errorMessage, resolveUser, resolveMember } from "src/utils";
|
||||
import { PluginData } from "knub";
|
||||
import { sendErrorMessage, canActOn, sendSuccessMessage } from "src/pluginUtils";
|
||||
import { errorMessage, resolveUser, resolveMember } from "../../../utils";
|
||||
import { GuildPluginData } from "knub";
|
||||
import { sendErrorMessage, canActOn, sendSuccessMessage } from "../../../pluginUtils";
|
||||
import { hasPermission } from "knub/dist/helpers";
|
||||
import { readContactMethodsFromArgs } from "./readContactMethodsFromArgs";
|
||||
import { formatReasonWithAttachments } from "./formatReasonWithAttachments";
|
||||
|
@ -12,7 +12,7 @@ import { ignoreEvent } from "./ignoreEvent";
|
|||
import { isBanned } from "./isBanned";
|
||||
|
||||
export async function actualKickMemberCmd(
|
||||
pluginData: PluginData<ModActionsPluginType>,
|
||||
pluginData: GuildPluginData<ModActionsPluginType>,
|
||||
msg,
|
||||
args: {
|
||||
user: string;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { Member, Message, TextChannel, User } from "eris";
|
||||
import { asSingleLine, isDiscordRESTError, UnknownUser } from "../../../utils";
|
||||
import { hasPermission, sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
|
||||
import { PluginData } from "knub";
|
||||
import { GuildPluginData } from "knub";
|
||||
import { ModActionsPluginType } from "../types";
|
||||
import humanizeDuration from "humanize-duration";
|
||||
import { formatReasonWithAttachments } from "./formatReasonWithAttachments";
|
||||
|
@ -16,7 +16,7 @@ import { logger } from "../../../logger";
|
|||
* The only difference between the two commands is in target member validation.
|
||||
*/
|
||||
export async function actualMuteUserCmd(
|
||||
pluginData: PluginData<ModActionsPluginType>,
|
||||
pluginData: GuildPluginData<ModActionsPluginType>,
|
||||
user: User | UnknownUser,
|
||||
msg: Message,
|
||||
args: { time?: number; reason?: string; mod: Member; notify?: string; "notify-channel"?: TextChannel },
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
import { PluginData } from "knub";
|
||||
import { GuildPluginData } from "knub";
|
||||
import { ModActionsPluginType } from "../types";
|
||||
import { User, Message, Member } from "eris";
|
||||
import { UnknownUser, asSingleLine } from "src/utils";
|
||||
import { sendErrorMessage, sendSuccessMessage, hasPermission } from "src/pluginUtils";
|
||||
import { UnknownUser, asSingleLine } from "../../../utils";
|
||||
import { sendErrorMessage, sendSuccessMessage, hasPermission } from "../../../pluginUtils";
|
||||
import { formatReasonWithAttachments } from "./formatReasonWithAttachments";
|
||||
import { MutesPlugin } from "src/plugins/Mutes/MutesPlugin";
|
||||
import { MutesPlugin } from "../../../plugins/Mutes/MutesPlugin";
|
||||
import humanizeDuration from "humanize-duration";
|
||||
|
||||
export async function actualUnmuteCmd(
|
||||
pluginData: PluginData<ModActionsPluginType>,
|
||||
pluginData: GuildPluginData<ModActionsPluginType>,
|
||||
user: User | UnknownUser,
|
||||
msg: Message,
|
||||
args: { time?: number; reason?: string; mod?: Member },
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { PluginData } from "knub";
|
||||
import { GuildPluginData } from "knub";
|
||||
import { BanOptions, BanResult, IgnoredEventType, ModActionsPluginType } from "../types";
|
||||
import { notifyUser, resolveUser, stripObjectToScalars, ucfirst, UserNotificationResult } from "../../../utils";
|
||||
import { User } from "eris";
|
||||
|
@ -13,7 +13,7 @@ import { CaseTypes } from "../../../data/CaseTypes";
|
|||
* Ban the specified user id, whether or not they're actually on the server at the time. Generates a case.
|
||||
*/
|
||||
export async function banUserId(
|
||||
pluginData: PluginData<ModActionsPluginType>,
|
||||
pluginData: GuildPluginData<ModActionsPluginType>,
|
||||
userId: string,
|
||||
reason: string = null,
|
||||
banOptions: BanOptions = {},
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { PluginData } from "knub";
|
||||
import { GuildPluginData } from "knub";
|
||||
import { IgnoredEventType, ModActionsPluginType } from "../types";
|
||||
|
||||
export function clearIgnoredEvents(
|
||||
pluginData: PluginData<ModActionsPluginType>,
|
||||
pluginData: GuildPluginData<ModActionsPluginType>,
|
||||
type: IgnoredEventType,
|
||||
userId: string,
|
||||
) {
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import { PluginData } from "knub";
|
||||
import { GuildPluginData } from "knub";
|
||||
import { ModActionsPluginType } from "../types";
|
||||
import { UserNotificationMethod } from "../../../utils";
|
||||
import { TextChannel } from "eris";
|
||||
|
||||
export function getDefaultContactMethods(
|
||||
pluginData: PluginData<ModActionsPluginType>,
|
||||
pluginData: GuildPluginData<ModActionsPluginType>,
|
||||
type: "warn" | "kick" | "ban",
|
||||
): UserNotificationMethod[] {
|
||||
const methods: UserNotificationMethod[] = [];
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { PluginData } from "knub";
|
||||
import { GuildPluginData } from "knub";
|
||||
import { IgnoredEventType, ModActionsPluginType } from "../types";
|
||||
import { SECONDS } from "../../../utils";
|
||||
import { clearIgnoredEvents } from "./clearIgnoredEvents";
|
||||
|
@ -6,7 +6,7 @@ import { clearIgnoredEvents } from "./clearIgnoredEvents";
|
|||
const DEFAULT_TIMEOUT = 15 * SECONDS;
|
||||
|
||||
export function ignoreEvent(
|
||||
pluginData: PluginData<ModActionsPluginType>,
|
||||
pluginData: GuildPluginData<ModActionsPluginType>,
|
||||
type: IgnoredEventType,
|
||||
userId: string,
|
||||
timeout = DEFAULT_TIMEOUT,
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { PluginData } from "knub";
|
||||
import { GuildPluginData } from "knub";
|
||||
import { ModActionsPluginType } from "../types";
|
||||
import { isDiscordHTTPError } from "../../../utils";
|
||||
|
||||
export async function isBanned(pluginData: PluginData<ModActionsPluginType>, userId: string): Promise<boolean> {
|
||||
export async function isBanned(pluginData: GuildPluginData<ModActionsPluginType>, userId: string): Promise<boolean> {
|
||||
try {
|
||||
const bans = await pluginData.guild.getBans();
|
||||
return bans.some(b => b.user.id === userId);
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
import { PluginData } from "knub";
|
||||
import { GuildPluginData } from "knub";
|
||||
import { IgnoredEventType, ModActionsPluginType } from "../types";
|
||||
|
||||
export function isEventIgnored(pluginData: PluginData<ModActionsPluginType>, type: IgnoredEventType, userId: string) {
|
||||
export function isEventIgnored(
|
||||
pluginData: GuildPluginData<ModActionsPluginType>,
|
||||
type: IgnoredEventType,
|
||||
userId: string,
|
||||
) {
|
||||
return pluginData.state.ignoredEvents.some(info => type === info.type && userId === info.userId);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { PluginData } from "knub";
|
||||
import { GuildPluginData } from "knub";
|
||||
import { IgnoredEventType, KickOptions, KickResult, ModActionsPluginType } from "../types";
|
||||
import { Member } from "eris";
|
||||
import { notifyUser, resolveUser, stripObjectToScalars, ucfirst, UserNotificationResult } from "../../../utils";
|
||||
|
@ -13,7 +13,7 @@ import { CasesPlugin } from "../../Cases/CasesPlugin";
|
|||
* Kick the specified server member. Generates a case.
|
||||
*/
|
||||
export async function kickMember(
|
||||
pluginData: PluginData<ModActionsPluginType>,
|
||||
pluginData: GuildPluginData<ModActionsPluginType>,
|
||||
member: Member,
|
||||
reason: string = null,
|
||||
kickOptions: KickOptions = {},
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { PluginData } from "knub";
|
||||
import { GuildPluginData } from "knub";
|
||||
import { ModActionsPluginType, WarnOptions, WarnResult } from "../types";
|
||||
import { Member } from "eris";
|
||||
import { getDefaultContactMethods } from "./getDefaultContactMethods";
|
||||
|
@ -9,7 +9,7 @@ import { CaseTypes } from "../../../data/CaseTypes";
|
|||
import { LogType } from "../../../data/LogType";
|
||||
|
||||
export async function warnMember(
|
||||
pluginData: PluginData<ModActionsPluginType>,
|
||||
pluginData: GuildPluginData<ModActionsPluginType>,
|
||||
member: Member,
|
||||
reason: string,
|
||||
warnOptions: WarnOptions = {},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue