3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-03-15 05:41:51 +00:00

Formatting and initial ButtonRoles DB work

This commit is contained in:
Dark 2021-06-08 02:23:30 +02:00
parent 6ac9d2f2a2
commit 5efdf5ce95
No known key found for this signature in database
GPG key ID: 2CD6ACB6B0A87B8A
108 changed files with 253 additions and 303 deletions

View file

@ -2,7 +2,6 @@ import { connect } from "../data/db";
import { setIsAPI } from "../globals";
import "./loadEnv";
if (!process.env.KEY) {
// tslint:disable-next-line:no-console
console.error("Project root .env with KEY is required!");

View file

@ -2,16 +2,16 @@ import { GuildChannel, GuildMember, User } from "discord.js";
import { baseCommandParameterTypeHelpers, baseTypeConverters, CommandContext, TypeConversionError } from "knub";
import { createTypeHelper } from "knub-command-manager";
import {
channelMentionRegex,
convertDelayStringToMS,
disableCodeBlocks,
disableInlineCode,
isValidSnowflake,
resolveMember,
resolveUser,
resolveUserId,
roleMentionRegex,
UnknownUser
channelMentionRegex,
convertDelayStringToMS,
disableCodeBlocks,
disableInlineCode,
isValidSnowflake,
resolveMember,
resolveUser,
resolveUserId,
roleMentionRegex,
UnknownUser,
} from "./utils";
import { isValidTimezone } from "./utils/isValidTimezone";
import { MessageTarget, resolveMessageTarget } from "./utils/resolveMessageTarget";

View file

@ -0,0 +1,50 @@
import { getRepository, Repository } from "typeorm";
import { BaseGuildRepository } from "./BaseGuildRepository";
import { ButtonRole } from "./entities/ButtonRole";
export class GuildButtonRoles extends BaseGuildRepository {
private buttonRoles: Repository<ButtonRole>;
constructor(guildId) {
super(guildId);
this.buttonRoles = getRepository(ButtonRole);
}
async getForButtonId(buttonId: string) {
return this.buttonRoles.findOne({
guild_id: this.guildId,
button_id: buttonId,
});
}
async getAllForMessageId(messageId: string) {
return this.buttonRoles.find({
guild_id: this.guildId,
message_id: messageId,
});
}
async removeForButtonId(buttonId: string) {
return this.buttonRoles.delete({
guild_id: this.guildId,
button_id: buttonId,
});
}
async removeAllForMessageId(messageId: string) {
return this.buttonRoles.delete({
guild_id: this.guildId,
message_id: messageId,
});
}
async add(messageId: string, buttonId: string, buttonGroup: string, buttonName: string) {
await this.buttonRoles.insert({
guild_id: this.guildId,
message_id: messageId,
button_id: buttonId,
button_group: buttonGroup,
button_name: buttonName,
});
}
}

View file

@ -5,12 +5,7 @@ import { DAYS, DBDateFormat, HOURS, MINUTES } from "../utils";
import { BaseGuildRepository } from "./BaseGuildRepository";
import { connection } from "./db";
import { Counter } from "./entities/Counter";
import {
CounterTrigger,
isValidCounterComparisonOp,
TriggerComparisonOp
} from "./entities/CounterTrigger";
import { CounterTrigger, isValidCounterComparisonOp, TriggerComparisonOp } from "./entities/CounterTrigger";
import { CounterTriggerState } from "./entities/CounterTriggerState";
import { CounterValue } from "./entities/CounterValue";

View file

@ -0,0 +1,20 @@
import { Column, Entity, PrimaryColumn, Unique } from "typeorm";
@Entity("button_roles")
export class ButtonRole {
@Column()
@PrimaryColumn()
guild_id: string;
@Column()
@PrimaryColumn()
message_id: string;
@Column()
@PrimaryColumn()
button_id: string;
@Column() button_group: string;
@Column() button_name: string;
}

View file

@ -21,9 +21,6 @@ import { ZeppelinGlobalConfig, ZeppelinGuildConfig } from "./types";
import { startUptimeCounter } from "./uptime";
import { errorMessage, isDiscordHTTPError, isDiscordRESTError, successMessage } from "./utils";
const fsp = fs.promises;
if (!process.env.KEY) {

View file

@ -0,0 +1,44 @@
import { MigrationInterface, QueryRunner, Table } from "typeorm";
export class CreateButtonRolesTable1623018101018 implements MigrationInterface {
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.createTable(
new Table({
name: "button_roles",
columns: [
{
name: "guild_id",
type: "bigint",
isPrimary: true,
},
{
name: "message_id",
type: "bigint",
isPrimary: true,
},
{
name: "button_id",
type: "varchar",
length: "100",
isPrimary: true,
isUnique: true,
},
{
name: "button_group",
type: "varchar",
length: "100",
},
{
name: "button_name",
type: "varchar",
length: "100",
},
],
}),
);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.dropTable("button_roles");
}
}

View file

@ -7,7 +7,6 @@ import { missingPermissionError } from "../../../utils/missingPermissionError";
import { readChannelPermissions } from "../../../utils/readChannelPermissions";
import { autoReactionsCmd } from "../types";
const requiredPermissions = readChannelPermissions | Permissions.FLAGS.ADD_REACTIONS;
export const NewAutoReactionsCmd = autoReactionsCmd({

View file

@ -7,7 +7,6 @@ import { readChannelPermissions } from "../../../utils/readChannelPermissions";
import { LogsPlugin } from "../../Logs/LogsPlugin";
import { autoReactionsEvt } from "../types";
const p = Permissions.FLAGS;
export const AddReactionsEvt = autoReactionsEvt({

View file

@ -4,12 +4,12 @@ import { erisAllowedMentionsToDjsMentionOptions } from "src/utils/erisAllowedMen
import { LogType } from "../../../data/LogType";
import { renderTemplate, TemplateParseError } from "../../../templateFormatter";
import {
createChunkedMessage,
messageLink,
stripObjectToScalars,
tAllowedMentions,
tNormalizedNullOptional,
verboseChannelMention
createChunkedMessage,
messageLink,
stripObjectToScalars,
tAllowedMentions,
tNormalizedNullOptional,
verboseChannelMention,
} from "../../../utils";
import { LogsPlugin } from "../../Logs/LogsPlugin";
import { automodAction } from "../helpers";

View file

@ -1,12 +1,5 @@
import * as t from "io-ts";
import {
convertDelayStringToMS,
nonNullish,
tDelayString,
tNullable,
unique
} from "../../../utils";
import { convertDelayStringToMS, nonNullish, tDelayString, tNullable, unique } from "../../../utils";
import { CaseArgs } from "../../Cases/types";
import { ModActionsPlugin } from "../../ModActions/ModActionsPlugin";
import { resolveActionContactMethods } from "../functions/resolveActionContactMethods";

View file

@ -1,14 +1,7 @@
import * as t from "io-ts";
import { LogType } from "../../../data/LogType";
import { ERRORS, RecoverablePluginError } from "../../../RecoverablePluginError";
import {
convertDelayStringToMS,
nonNullish,
tDelayString,
tNullable,
unique
} from "../../../utils";
import { convertDelayStringToMS, nonNullish, tDelayString, tNullable, unique } from "../../../utils";
import { CaseArgs } from "../../Cases/types";
import { LogsPlugin } from "../../Logs/LogsPlugin";
import { MutesPlugin } from "../../Mutes/MutesPlugin";

View file

@ -10,7 +10,6 @@ import { LogsPlugin } from "../../Logs/LogsPlugin";
import { ignoreRoleChange } from "../functions/ignoredRoleChanges";
import { automodAction } from "../helpers";
const p = Permissions.FLAGS;
export const RemoveRolesAction = automodAction({

View file

@ -3,22 +3,20 @@ import * as t from "io-ts";
import { LogType } from "../../../data/LogType";
import { renderTemplate } from "../../../templateFormatter";
import {
convertDelayStringToMS,
noop,
renderRecursively,
stripObjectToScalars,
tDelayString,
tMessageContent,
tNullable,
unique,
verboseChannelMention
convertDelayStringToMS,
noop,
renderRecursively,
stripObjectToScalars,
tDelayString,
tMessageContent,
tNullable,
unique,
verboseChannelMention,
} from "../../../utils";
import { hasDiscordPermissions } from "../../../utils/hasDiscordPermissions";
import { automodAction } from "../helpers";
import { AutomodContext } from "../types";
export const ReplyAction = automodAction({
configType: t.union([
t.string,

View file

@ -4,7 +4,6 @@ import { ERRORS, RecoverablePluginError } from "../../../RecoverablePluginError"
import { disableUserNotificationStrings, UserNotificationMethod } from "../../../utils";
import { AutomodPluginType } from "../types";
export function resolveActionContactMethods(
pluginData: GuildPluginData<AutomodPluginType>,
actionConfig: {

View file

@ -1,11 +1,5 @@
import * as t from "io-ts";
import {
asSingleLine,
disableInlineCode,
messageSummary,
verboseChannelMention
} from "../../../utils";
import { asSingleLine, disableInlineCode, messageSummary, verboseChannelMention } from "../../../utils";
import { automodTrigger } from "../helpers";
interface MatchResultType {

View file

@ -1,11 +1,5 @@
import * as t from "io-ts";
import {
getInviteCodesInString,
GuildInvite,
isGuildInvite,
resolveInvite,
tNullable
} from "../../../utils";
import { getInviteCodesInString, GuildInvite, isGuildInvite, resolveInvite, tNullable } from "../../../utils";
import { getTextMatchPartialSummary } from "../functions/getTextMatchPartialSummary";
import { MatchableTextType, matchMultipleTextTypesOnMessage } from "../functions/matchMultipleTextTypesOnMessage";
import { automodTrigger } from "../helpers";

View file

@ -1,11 +1,7 @@
import escapeStringRegexp from "escape-string-regexp";
import * as t from "io-ts";
import { allowTimeout } from "../../../RegExpRunner";
import {
disableInlineCode,
getUrlsInString,
tNullable
} from "../../../utils";
import { disableInlineCode, getUrlsInString, tNullable } from "../../../utils";
import { TRegex } from "../../../validatorUtils";
import { getTextMatchPartialSummary } from "../functions/getTextMatchPartialSummary";
import { MatchableTextType, matchMultipleTextTypesOnMessage } from "../functions/matchMultipleTextTypesOnMessage";

View file

@ -19,7 +19,6 @@ import { RemoveDashboardUserCmd } from "./commands/RemoveDashboardUserCmd";
import { ServersCmd } from "./commands/ServersCmd";
import { BotControlPluginType, ConfigSchema } from "./types";
const defaultOptions = {
config: {
can_use: false,

View file

@ -9,7 +9,6 @@ import { CasesPluginType } from "../types";
import { getCaseColor } from "./getCaseColor";
import { resolveCaseId } from "./resolveCaseId";
export async function getCaseEmbed(
pluginData: GuildPluginData<CasesPluginType>,
caseOrCaseId: Case | number,

View file

@ -2,14 +2,7 @@ import { GuildPluginData } from "knub";
import { splitMessageIntoChunks } from "knub/dist/helpers";
import moment from "moment-timezone";
import { Case } from "../../../data/entities/Case";
import {
convertDelayStringToMS,
DAYS,
DBDateFormat,
disableLinkPreviews,
messageLink
} from "../../../utils";
import { convertDelayStringToMS, DAYS, DBDateFormat, disableLinkPreviews, messageLink } from "../../../utils";
import { TimeAndDatePlugin } from "../../TimeAndDate/TimeAndDatePlugin";
import { caseAbbreviations } from "../caseAbbreviations";
import { CasesPluginType } from "../types";

View file

@ -7,7 +7,6 @@ import { CasesPluginType } from "../types";
import { getCaseEmbed } from "./getCaseEmbed";
import { resolveCaseId } from "./resolveCaseId";
export async function postToCaseLogChannel(
pluginData: GuildPluginData<CasesPluginType>,
content: MessageOptions,

View file

@ -9,7 +9,6 @@ import { getInviteCodesInString, getUrlsInString, isGuildInvite, resolveInvite,
import { CensorPluginType } from "../types";
import { censorMessage } from "./censorMessage";
export async function applyFiltersToMsg(
pluginData: GuildPluginData<CensorPluginType>,
savedMessage: SavedMessage,

View file

@ -6,7 +6,6 @@ import { LogsPlugin } from "../../Logs/LogsPlugin";
import { CompanionChannelsPluginType, TCompanionChannelOpts } from "../types";
import { getCompanionChannelOptsForVoiceChannelId } from "./getCompanionChannelOptsForVoiceChannelId";
const ERROR_COOLDOWN_KEY = "errorCooldown";
const ERROR_COOLDOWN = 5 * MINUTES;

View file

@ -2,10 +2,10 @@ import { EventEmitter } from "events";
import { PluginOptions } from "knub";
import { ConfigPreprocessorFn } from "knub/dist/config/configTypes";
import {
buildCounterConditionString,
CounterTrigger,
getReverseCounterComparisonOp,
parseCounterConditionString
buildCounterConditionString,
CounterTrigger,
getReverseCounterComparisonOp,
parseCounterConditionString,
} from "../../data/entities/CounterTrigger";
import { GuildCounters } from "../../data/GuildCounters";
import { mapToPublicFn } from "../../pluginUtils";

View file

@ -7,7 +7,6 @@ import { resolveUser, UnknownUser } from "../../../utils";
import { changeCounterValue } from "../functions/changeCounterValue";
import { CountersPluginType } from "../types";
export const AddCounterCmd = typedGuildCommand<CountersPluginType>()({
trigger: ["counters add", "counter add", "addcounter"],
permission: "can_edit",

View file

@ -5,7 +5,6 @@ import { confirm, noop, trimMultilineString } from "../../../utils";
import { resetAllCounterValues } from "../functions/resetAllCounterValues";
import { CountersPluginType } from "../types";
export const ResetAllCounterValuesCmd = typedGuildCommand<CountersPluginType>()({
trigger: ["counters reset_all"],
permission: "can_reset_all",

View file

@ -7,7 +7,6 @@ import { resolveUser, UnknownUser } from "../../../utils";
import { setCounterValue } from "../functions/setCounterValue";
import { CountersPluginType } from "../types";
export const ResetCounterCmd = typedGuildCommand<CountersPluginType>()({
trigger: ["counters reset", "counter reset", "resetcounter"],
permission: "can_edit",

View file

@ -7,7 +7,6 @@ import { resolveUser, UnknownUser } from "../../../utils";
import { setCounterValue } from "../functions/setCounterValue";
import { CountersPluginType } from "../types";
export const SetCounterCmd = typedGuildCommand<CountersPluginType>()({
trigger: ["counters set", "counter set", "setcounter"],
permission: "can_edit",

View file

@ -6,7 +6,6 @@ import { sendErrorMessage } from "../../../pluginUtils";
import { resolveUser, UnknownUser } from "../../../utils";
import { CountersPluginType } from "../types";
export const ViewCounterCmd = typedGuildCommand<CountersPluginType>()({
trigger: ["counters view", "counter view", "viewcounter", "counter"],
permission: "can_view",

View file

@ -11,7 +11,6 @@ import { moveToVoiceChannelAction } from "../actions/moveToVoiceChannelAction";
import { setChannelPermissionOverridesAction } from "../actions/setChannelPermissionOverrides";
import { CustomEventsPluginType, TCustomEvent } from "../types";
export async function runEvent(
pluginData: GuildPluginData<CustomEventsPluginType>,
event: TCustomEvent,

View file

@ -5,7 +5,6 @@ import { LocateUserPluginType } from "../types";
import { moveMember } from "./moveMember";
import { sendWhere } from "./sendWhere";
export async function sendAlerts(pluginData: GuildPluginData<LocateUserPluginType>, userId: string) {
const triggeredAlerts = await pluginData.state.alerts.getAlertsByUserId(userId);
const member = await resolveMember(pluginData.client, pluginData.guild, userId);

View file

@ -4,7 +4,6 @@ import { stripObjectToScalars, UnknownUser } from "../../../utils";
import { safeFindRelevantAuditLogEntry } from "../../../utils/safeFindRelevantAuditLogEntry";
import { logsEvt } from "../types";
export const LogsGuildBanAddEvt = logsEvt({
event: "guildBanAdd",

View file

@ -6,7 +6,6 @@ import { stripObjectToScalars, UnknownUser } from "../../../utils";
import { safeFindRelevantAuditLogEntry } from "../../../utils/safeFindRelevantAuditLogEntry";
import { logsEvt } from "../types";
export const LogsGuildMemberUpdateEvt = logsEvt({
event: "guildMemberUpdate",

View file

@ -5,10 +5,12 @@ import { LogType } from "../../../data/LogType";
import { logger } from "../../../logger";
import { renderTemplate, TemplateParseError } from "../../../templateFormatter";
import {
messageSummary,
renderRecursively, resolveMember, verboseChannelMention, verboseUserMention,
verboseUserName
messageSummary,
renderRecursively,
resolveMember,
verboseChannelMention,
verboseUserMention,
verboseUserName,
} from "../../../utils";
import { TimeAndDatePlugin } from "../../TimeAndDate/TimeAndDatePlugin";
import { FORMAT_NO_TIMESTAMP, LogsPluginType, TLogChannel } from "../types";

View file

@ -7,7 +7,6 @@ import { createChunkedMessage, get, noop } from "../../../utils";
import { LogsPluginType, TLogChannelMap } from "../types";
import { getLogMessage } from "./getLogMessage";
const excludedUserProps = ["user", "member", "mod"];
const excludedRoleProps = ["message.member.roles", "member.roles"];

View file

@ -7,7 +7,6 @@ import { resolveUser, stripObjectToScalars, useMediaUrls } from "../../../utils"
import { TimeAndDatePlugin } from "../../TimeAndDate/TimeAndDatePlugin";
import { FORMAT_NO_TIMESTAMP, LogsPluginType } from "../types";
export async function onMessageDelete(pluginData: GuildPluginData<LogsPluginType>, savedMessage: SavedMessage) {
const user = await resolveUser(pluginData.client, savedMessage.user_id);
const channel = pluginData.guild.channels.cache.get(savedMessage.channel_id);

View file

@ -6,7 +6,6 @@ import { LogType } from "../../../data/LogType";
import { resolveUser, stripObjectToScalars } from "../../../utils";
import { LogsPluginType } from "../types";
export async function onMessageUpdate(
pluginData: GuildPluginData<LogsPluginType>,
savedMessage: SavedMessage,

View file

@ -46,7 +46,6 @@ import { updateCase } from "./functions/updateCase";
import { warnMember } from "./functions/warnMember";
import { BanOptions, ConfigSchema, KickOptions, ModActionsPluginType, WarnOptions } from "./types";
const defaultOptions = {
config: {
dm_on_warn: true,

View file

@ -9,7 +9,6 @@ import { getGuildPrefix } from "../../../utils/getGuildPrefix";
import { CasesPlugin } from "../../Cases/CasesPlugin";
import { modActionsCmd } from "../types";
const opts = {
mod: ct.userId({ option: true }),
};

View file

@ -3,15 +3,12 @@ import { commandTypeHelpers as ct } from "../../../commandTypes";
import { CaseTypes } from "../../../data/CaseTypes";
import { CasesPlugin } from "../../../plugins/Cases/CasesPlugin";
import { sendErrorMessage } from "../../../pluginUtils";
import {
chunkArray, emptyEmbedValue, resolveUser, trimLines, UnknownUser
} from "../../../utils";
import { chunkArray, emptyEmbedValue, resolveUser, trimLines, UnknownUser } from "../../../utils";
import { asyncMap } from "../../../utils/async";
import { getChunkedEmbedFields } from "../../../utils/getChunkedEmbedFields";
import { getGuildPrefix } from "../../../utils/getGuildPrefix";
import { modActionsCmd } from "../types";
const opts = {
expand: ct.bool({ option: true, isSwitch: true, shortcut: "e" }),
hidden: ct.bool({ option: true, isSwitch: true, shortcut: "h" }),

View file

@ -10,7 +10,6 @@ import { LogsPlugin } from "../../Logs/LogsPlugin";
import { TimeAndDatePlugin } from "../../TimeAndDate/TimeAndDatePlugin";
import { modActionsCmd } from "../types";
export const DeleteCaseCmd = modActionsCmd({
trigger: ["delete_case", "deletecase"],
permission: "can_deletecase",

View file

@ -12,7 +12,6 @@ import { formatReasonWithAttachments } from "../functions/formatReasonWithAttach
import { ignoreEvent } from "../functions/ignoreEvent";
import { IgnoredEventType, modActionsCmd } from "../types";
export const MassbanCmd = modActionsCmd({
trigger: "massban",
permission: "can_massban",

View file

@ -11,7 +11,6 @@ import { ignoreEvent } from "../functions/ignoreEvent";
import { isBanned } from "../functions/isBanned";
import { IgnoredEventType, modActionsCmd } from "../types";
export const MassunbanCmd = modActionsCmd({
trigger: "massunban",
permission: "can_massunban",

View file

@ -9,7 +9,6 @@ import { stripObjectToScalars } from "../../../utils";
import { formatReasonWithAttachments } from "../functions/formatReasonWithAttachments";
import { modActionsCmd } from "../types";
export const MassmuteCmd = modActionsCmd({
trigger: "massmute",
permission: "can_massmute",

View file

@ -6,7 +6,6 @@ import { actualMuteUserCmd } from "../functions/actualMuteUserCmd";
import { isBanned } from "../functions/isBanned";
import { modActionsCmd } from "../types";
const opts = {
mod: ct.member({ option: true }),
notify: ct.string({ option: true }),

View file

@ -9,7 +9,6 @@ import { clearIgnoredEvents } from "../functions/clearIgnoredEvents";
import { isEventIgnored } from "../functions/isEventIgnored";
import { IgnoredEventType, modActionsEvt } from "../types";
/**
* Create a BAN case automatically when a user is banned manually.
* Attempts to find the ban's details in the audit log.

View file

@ -10,7 +10,6 @@ import { clearIgnoredEvents } from "../functions/clearIgnoredEvents";
import { isEventIgnored } from "../functions/isEventIgnored";
import { IgnoredEventType, modActionsEvt } from "../types";
/**
* Create a KICK case automatically when a user is kicked manually.
* Attempts to find the kick's details in the audit log.

View file

@ -9,7 +9,6 @@ import { clearIgnoredEvents } from "../functions/clearIgnoredEvents";
import { isEventIgnored } from "../functions/isEventIgnored";
import { IgnoredEventType, modActionsEvt } from "../types";
/**
* Create an UNBAN case automatically when a user is unbanned manually.
* Attempts to find the unban's details in the audit log.

View file

@ -5,7 +5,6 @@ import { hasDiscordPermissions } from "../../../utils/hasDiscordPermissions";
import { LogsPlugin } from "../../Logs/LogsPlugin";
import { modActionsEvt } from "../types";
/**
* Show an alert if a member with prior notes joins the server
*/

View file

@ -7,7 +7,6 @@ import { asSingleLine, UnknownUser } from "../../../utils";
import { ModActionsPluginType } from "../types";
import { formatReasonWithAttachments } from "./formatReasonWithAttachments";
export async function actualUnmuteCmd(
pluginData: GuildPluginData<ModActionsPluginType>,
user: User | UnknownUser,

View file

@ -6,19 +6,18 @@ import { LogType } from "../../../data/LogType";
import { logger } from "../../../logger";
import { renderTemplate } from "../../../templateFormatter";
import {
createUserNotificationError,
notifyUser,
resolveUser,
stripObjectToScalars,
ucfirst,
UserNotificationResult
createUserNotificationError,
notifyUser,
resolveUser,
stripObjectToScalars,
ucfirst,
UserNotificationResult,
} from "../../../utils";
import { CasesPlugin } from "../../Cases/CasesPlugin";
import { BanOptions, BanResult, IgnoredEventType, ModActionsPluginType } from "../types";
import { getDefaultContactMethods } from "./getDefaultContactMethods";
import { ignoreEvent } from "./ignoreEvent";
/**
* Ban the specified user id, whether or not they're actually on the server at the time. Generates a case.
*/

View file

@ -4,19 +4,18 @@ import { CaseTypes } from "../../../data/CaseTypes";
import { LogType } from "../../../data/LogType";
import { renderTemplate } from "../../../templateFormatter";
import {
createUserNotificationError,
notifyUser,
resolveUser,
stripObjectToScalars,
ucfirst,
UserNotificationResult
createUserNotificationError,
notifyUser,
resolveUser,
stripObjectToScalars,
ucfirst,
UserNotificationResult,
} from "../../../utils";
import { CasesPlugin } from "../../Cases/CasesPlugin";
import { IgnoredEventType, KickOptions, KickResult, ModActionsPluginType } from "../types";
import { getDefaultContactMethods } from "./getDefaultContactMethods";
import { ignoreEvent } from "./ignoreEvent";
/**
* Kick the specified server member. Generates a case.
*/

View file

@ -4,19 +4,18 @@ import { CaseTypes } from "../../../data/CaseTypes";
import { LogType } from "../../../data/LogType";
import { renderTemplate } from "../../../templateFormatter";
import {
createUserNotificationError,
notifyUser,
resolveUser,
stripObjectToScalars,
ucfirst,
UserNotificationResult
createUserNotificationError,
notifyUser,
resolveUser,
stripObjectToScalars,
ucfirst,
UserNotificationResult,
} from "../../../utils";
import { waitForButtonConfirm } from "../../../utils/waitForInteraction";
import { CasesPlugin } from "../../Cases/CasesPlugin";
import { ModActionsPluginType, WarnOptions, WarnResult } from "../types";
import { getDefaultContactMethods } from "./getDefaultContactMethods";
export async function warnMember(
pluginData: GuildPluginData<ModActionsPluginType>,
member: GuildMember,

View file

@ -22,7 +22,6 @@ import { onMutesEvent } from "./functions/onMutesEvent";
import { unmuteUser } from "./functions/unmuteUser";
import { ConfigSchema, MutesPluginType } from "./types";
const defaultOptions = {
config: {
mute_role: null,

View file

@ -2,7 +2,6 @@ import { User } from "discord.js";
import { sendSuccessMessage } from "../../../pluginUtils";
import { mutesCmd } from "../types";
export const ClearBannedMutesCmd = mutesCmd({
trigger: "clear_banned_mutes",
permission: "can_cleanup",

View file

@ -4,7 +4,6 @@ import { resolveMember, stripObjectToScalars, UnknownUser } from "../../../utils
import { memberRolesLock } from "../../../utils/lockNameHelpers";
import { MutesPluginType } from "../types";
export async function clearExpiredMutes(pluginData: GuildPluginData<MutesPluginType>) {
const expiredMutes = await pluginData.state.mutes.getExpiredMutes();
for (const mute of expiredMutes) {

View file

@ -8,23 +8,18 @@ import { LogsPlugin } from "../../../plugins/Logs/LogsPlugin";
import { ERRORS, RecoverablePluginError } from "../../../RecoverablePluginError";
import { renderTemplate } from "../../../templateFormatter";
import {
notifyUser,
resolveMember, resolveUser,
stripObjectToScalars,
ucfirst,
UserNotificationMethod, UserNotificationResult
notifyUser,
resolveMember,
resolveUser,
stripObjectToScalars,
ucfirst,
UserNotificationMethod,
UserNotificationResult,
} from "../../../utils";
import { muteLock } from "../../../utils/lockNameHelpers";
import { CasesPlugin } from "../../Cases/CasesPlugin";
import { MuteOptions, MutesPluginType } from "../types";
export async function muteUser(
pluginData: GuildPluginData<MutesPluginType>,
userId: string,

View file

@ -9,7 +9,6 @@ import { CaseArgs } from "../../Cases/types";
import { MutesPluginType, UnmuteResult } from "../types";
import { memberHasMutedRole } from "./memberHasMutedRole";
export async function unmuteUser(
pluginData: GuildPluginData<MutesPluginType>,
userId: string,

View file

@ -9,7 +9,6 @@ import { missingPermissionError } from "../../../utils/missingPermissionError";
import { LogsPlugin } from "../../Logs/LogsPlugin";
import { persistEvt } from "../types";
const p = Permissions.FLAGS;
export const LoadDataEvt = persistEvt({

View file

@ -3,7 +3,6 @@ import intersection from "lodash.intersection";
import { IPartialPersistData } from "../../../data/GuildPersistedData";
import { persistEvt } from "../types";
export const StoreDataEvt = persistEvt({
event: "guildMemberRemove",

View file

@ -7,7 +7,6 @@ import { rgbToInt } from "../../../utils/rgbToInt";
import { postCmd } from "../types";
import { formatContent } from "../util/formatContent";
const COLOR_MATCH_REGEX = /^#?([0-9a-f]{6})$/;
export const EditEmbedCmd = postCmd({

View file

@ -8,7 +8,6 @@ import { postCmd } from "../types";
import { actualPostCmd } from "../util/actualPostCmd";
import { formatContent } from "../util/formatContent";
export const PostEmbedCmd = postCmd({
trigger: "post_embed",
permission: "can_post",

View file

@ -1,8 +1,12 @@
import humanizeDuration from "humanize-duration";
import moment from "moment-timezone";
import {
createChunkedMessage,
DBDateFormat, deactivateMentions, disableCodeBlocks, sorter, trimLines
createChunkedMessage,
DBDateFormat,
deactivateMentions,
disableCodeBlocks,
sorter,
trimLines,
} from "../../../utils";
import { TimeAndDatePlugin } from "../../TimeAndDate/TimeAndDatePlugin";
import { postCmd } from "../types";

View file

@ -5,7 +5,6 @@ import { downloadFile } from "../../../utils";
import { PostPluginType } from "../types";
import { formatContent } from "./formatContent";
const fsp = fs.promises;
export async function postMessage(

View file

@ -7,7 +7,6 @@ import { DBDateFormat, SECONDS, stripObjectToScalars } from "../../../utils";
import { PostPluginType } from "../types";
import { postMessage } from "./postMessage";
const SCHEDULED_POST_CHECK_INTERVAL = 5 * SECONDS;
export async function scheduledPostLoop(pluginData: GuildPluginData<PostPluginType>) {

View file

@ -4,7 +4,6 @@ import { sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
import { isDiscordRESTError } from "../../../utils";
import { reactionRolesCmd } from "../types";
export const ClearReactionRolesCmd = reactionRolesCmd({
trigger: "reaction_roles clear",
permission: "can_manage",

View file

@ -3,7 +3,6 @@ import { noop, resolveMember, sleep } from "../../../utils";
import { reactionRolesEvt } from "../types";
import { addMemberPendingRoleChange } from "../util/addMemberPendingRoleChange";
const CLEAR_ROLES_EMOJI = "❌";
export const AddReactionRoleEvt = reactionRolesEvt({

View file

@ -1,8 +1,4 @@
import {
MessageActionRow,
MessageButton,
MessageComponentInteraction
} from "discord.js";
import { MessageActionRow, MessageButton, MessageComponentInteraction } from "discord.js";
import { LogType } from "src/data/LogType";
import { logger } from "src/logger";
import { LogsPlugin } from "src/plugins/Logs/LogsPlugin";

View file

@ -6,7 +6,6 @@ import { isDiscordRESTError, sleep } from "../../../utils";
import { LogsPlugin } from "../../Logs/LogsPlugin";
import { ReactionRolesPluginType } from "../types";
const CLEAR_ROLES_EMOJI = "❌";
/**

View file

@ -5,7 +5,6 @@ import { canActOn, sendErrorMessage, sendSuccessMessage } from "../../../pluginU
import { resolveRoleId, stripObjectToScalars, verboseUserMention } from "../../../utils";
import { rolesCmd } from "../types";
export const RemoveRoleCmd = rolesCmd({
trigger: "removerole",
permission: "can_assign",

View file

@ -8,7 +8,6 @@ import { getApplyingEntries } from "../util/getApplyingEntries";
import { normalizeRoleNames } from "../util/normalizeRoleNames";
import { splitRoleNames } from "../util/splitRoleNames";
export const RoleAddCmd = selfGrantableRolesCmd({
trigger: ["role", "role add"],
permission: null,

View file

@ -3,7 +3,6 @@ import humanizeDuration from "humanize-duration";
import { commandTypeHelpers as ct } from "../../../commandTypes";
import { slowmodeCmd } from "../types";
export const SlowmodeGetCmd = slowmodeCmd({
trigger: "slowmode",
permission: "can_manage",

View file

@ -4,7 +4,6 @@ import { createChunkedMessage } from "knub/dist/helpers";
import { errorMessage } from "../../../utils";
import { slowmodeCmd } from "../types";
export const SlowmodeListCmd = slowmodeCmd({
trigger: ["slowmode list", "slowmode l", "slowmodes"],
permission: "can_manage",

View file

@ -10,7 +10,6 @@ import { slowmodeCmd } from "../types";
import { actualDisableSlowmodeCmd } from "../util/actualDisableSlowmodeCmd";
import { disableBotSlowmodeForChannel } from "../util/disableBotSlowmodeForChannel";
const MAX_NATIVE_SLOWMODE = 6 * HOURS; // 6 hours
const MAX_BOT_SLOWMODE = DAYS * 365 * 100; // 100 years
const MIN_BOT_SLOWMODE = 15 * MINUTES;

View file

@ -5,7 +5,6 @@ import { logger } from "../../../logger";
import { isDiscordRESTError, stripObjectToScalars, UnknownUser } from "../../../utils";
import { SlowmodePluginType } from "../types";
export async function applyBotSlowmodeToUserId(
pluginData: GuildPluginData<SlowmodePluginType>,
channel: GuildChannel & TextChannel,

View file

@ -6,7 +6,6 @@ import { stripObjectToScalars, UnknownUser } from "../../../utils";
import { SlowmodePluginType } from "../types";
import { clearBotSlowmodeFromUserId } from "./clearBotSlowmodeFromUserId";
export async function clearExpiredSlowmodes(pluginData: GuildPluginData<SlowmodePluginType>) {
const expiredSlowmodeUsers = await pluginData.state.slowmodes.getExpiredSlowmodeUsers();
for (const user of expiredSlowmodeUsers) {

View file

@ -12,7 +12,6 @@ import { BOT_SLOWMODE_PERMISSIONS } from "../requiredPermissions";
import { SlowmodePluginType } from "../types";
import { applyBotSlowmodeToUserId } from "./applyBotSlowmodeToUserId";
export async function onMessageCreate(pluginData: GuildPluginData<SlowmodePluginType>, msg: SavedMessage) {
if (msg.is_bot) return;

View file

@ -10,12 +10,12 @@ import { MutesPlugin } from "../../../plugins/Mutes/MutesPlugin";
import { MuteResult } from "../../../plugins/Mutes/types";
import { ERRORS, RecoverablePluginError } from "../../../RecoverablePluginError";
import {
convertDelayStringToMS,
DBDateFormat,
noop,
resolveMember,
stripObjectToScalars,
trimLines
convertDelayStringToMS,
DBDateFormat,
noop,
resolveMember,
stripObjectToScalars,
trimLines,
} from "../../../utils";
import { LogsPlugin } from "../../Logs/LogsPlugin";
import { RecentActionType, SpamPluginType, TBaseSingleSpamConfig } from "../types";

View file

@ -4,7 +4,6 @@ import { sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
import { starboardCmd } from "../types";
import { saveMessageToStarboard } from "../util/saveMessageToStarboard";
export const MigratePinsCmd = starboardCmd({
trigger: "starboard migrate_pins",
permission: "can_migrate",

View file

@ -5,7 +5,6 @@ import { starboardEvt } from "../types";
import { saveMessageToStarboard } from "../util/saveMessageToStarboard";
import { updateStarboardMessageStarCount } from "../util/updateStarboardMessageStarCount";
export const StarboardReactionAddEvt = starboardEvt({
event: "messageReactionAdd",

View file

@ -2,7 +2,6 @@ import { GuildChannel, Message } from "discord.js";
import path from "path";
import { EmbedWith, EMPTY_CHAR } from "../../../utils";
const imageAttachmentExtensions = ["jpeg", "jpg", "png", "gif", "webp"];
const audioAttachmentExtensions = ["wav", "mp3", "m4a"];
const videoAttachmentExtensions = ["mp4", "mkv", "mov"];

View file

@ -4,7 +4,6 @@ import { StarboardPluginType, TStarboardOpts } from "../types";
import { createStarboardEmbedFromMessage } from "./createStarboardEmbedFromMessage";
import { createStarboardPseudoFooterForMessage } from "./createStarboardPseudoFooterForMessage";
export async function saveMessageToStarboard(
pluginData: GuildPluginData<StarboardPluginType>,
msg: Message,

View file

@ -5,7 +5,6 @@ import { stripObjectToScalars } from "../../../utils";
import { tagsCmd } from "../types";
import { renderTagBody } from "../util/renderTagBody";
export const TagEvalCmd = tagsCmd({
trigger: "tag eval",
permission: "can_create",

View file

@ -9,7 +9,6 @@ import { validate } from "../../../validatorUtils";
import { TagsPluginType } from "../types";
import { matchAndRenderTagFromString } from "./matchAndRenderTagFromString";
export async function onMessageCreate(pluginData: GuildPluginData<TagsPluginType>, msg: SavedMessage) {
if (msg.is_bot) return;
if (!msg.data.content) return;

View file

@ -9,7 +9,6 @@ import { LogsPlugin } from "../../Logs/LogsPlugin";
import { Tag, TagsPluginType } from "../types";
import { renderTagBody } from "./renderTagBody";
export async function renderTagFromString(
pluginData: GuildPluginData<TagsPluginType>,
str: string,

View file

@ -8,7 +8,6 @@ import { EmbedWith, multiSorter, resolveMember, sorter } from "../../../utils";
import { TimeAndDatePlugin } from "../../TimeAndDate/TimeAndDatePlugin";
import { utilityCmd } from "../types";
export const AboutCmd = utilityCmd({
trigger: "about",
description: "Show information about Zeppelin's status on the server",

View file

@ -10,7 +10,6 @@ import { allowTimeout } from "../../../RegExpRunner";
import { DAYS, getInviteCodesInString, noop, SECONDS, stripObjectToScalars } from "../../../utils";
import { utilityCmd, UtilityPluginType } from "../types";
const MAX_CLEAN_COUNT = 150;
const MAX_CLEAN_TIME = 1 * DAYS;
const CLEAN_COMMAND_DELETE_DELAY = 5 * SECONDS;

View file

@ -5,7 +5,6 @@ import { messageLink } from "../../../utils";
import { canReadChannel } from "../../../utils/canReadChannel";
import { utilityCmd } from "../types";
export const ContextCmd = utilityCmd({
trigger: "context",
description: "Get a link to the context of the specified message",

View file

@ -2,7 +2,6 @@ import { TextChannel } from "discord.js";
import { activeReloads } from "../guildReloads";
import { utilityCmd } from "../types";
export const ReloadGuildCmd = utilityCmd({
trigger: "reload_guild",
description: "Reload the Zeppelin configuration and all plugins for the server. This can sometimes fix issues.",

View file

@ -5,7 +5,6 @@ import { chunkArray, sorter, trimLines } from "../../../utils";
import { refreshMembersIfNeeded } from "../refreshMembers";
import { utilityCmd } from "../types";
export const RolesCmd = utilityCmd({
trigger: "roles",
description: "List all roles or roles matching a search",

View file

@ -4,7 +4,6 @@ import { getBaseUrl, sendErrorMessage } from "../../../pluginUtils";
import { canReadChannel } from "../../../utils/canReadChannel";
import { utilityCmd } from "../types";
export const SourceCmd = utilityCmd({
trigger: "source",
description: "View the message source of the specified message id",

View file

@ -2,12 +2,9 @@ import { VoiceChannel } from "discord.js";
import { commandTypeHelpers as ct } from "../../../commandTypes";
import { LogType } from "../../../data/LogType";
import { canActOn, sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
import {
stripObjectToScalars
} from "../../../utils";
import { stripObjectToScalars } from "../../../utils";
import { utilityCmd } from "../types";
export const VcdisconnectCmd = utilityCmd({
trigger: ["vcdisconnect", "vcdisc", "vcdc", "vckick", "vck"],
description: "Disconnect a member from their voice channel",

View file

@ -2,17 +2,9 @@ import { VoiceChannel } from "discord.js";
import { commandTypeHelpers as ct } from "../../../commandTypes";
import { LogType } from "../../../data/LogType";
import { canActOn, sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
import {
channelMentionRegex,
isSnowflake,
simpleClosestStringMatch,
stripObjectToScalars
} from "../../../utils";
import { channelMentionRegex, isSnowflake, simpleClosestStringMatch, stripObjectToScalars } from "../../../utils";
import { utilityCmd } from "../types";
export const VcmoveCmd = utilityCmd({
trigger: "vcmove",
description: "Move a member to another voice channel",

View file

@ -7,7 +7,6 @@ import { EmbedWith, formatNumber, preEmbedPadding, trimLines } from "../../../ut
import { TimeAndDatePlugin } from "../../TimeAndDate/TimeAndDatePlugin";
import { UtilityPluginType } from "../types";
const TEXT_CHANNEL_ICON =
"https://cdn.discordapp.com/attachments/740650744830623756/740656843545772062/text-channel.png";
const VOICE_CHANNEL_ICON =

View file

@ -4,21 +4,19 @@ import { GuildPluginData } from "knub";
import moment from "moment-timezone";
import { ChannelTypeStrings } from "src/types";
import {
EmbedWith,
formatNumber,
GroupDMInvite,
inviteHasCounts,
isGroupDMInvite,
isGuildInvite,
preEmbedPadding,
resolveInvite,
trimLines
EmbedWith,
formatNumber,
GroupDMInvite,
inviteHasCounts,
isGroupDMInvite,
isGuildInvite,
preEmbedPadding,
resolveInvite,
trimLines,
} from "../../../utils";
import { snowflakeToTimestamp } from "../../../utils/snowflakeToTimestamp";
import { UtilityPluginType } from "../types";
export async function getInviteInfoEmbed(
pluginData: GuildPluginData<UtilityPluginType>,
inviteCode: string,

View file

@ -8,7 +8,6 @@ import { chunkMessageLines, EmbedWith, messageLink, preEmbedPadding, trimEmptyLi
import { TimeAndDatePlugin } from "../../TimeAndDate/TimeAndDatePlugin";
import { UtilityPluginType } from "../types";
const MESSAGE_ICON = "https://cdn.discordapp.com/attachments/740650744830623756/740685652152025088/message.png";
export async function getMessageInfoEmbed(

View file

@ -3,21 +3,20 @@ import humanizeDuration from "humanize-duration";
import { GuildPluginData } from "knub";
import moment from "moment-timezone";
import {
EmbedWith,
formatNumber,
inviteHasCounts,
memoize,
MINUTES,
preEmbedPadding,
resolveInvite,
resolveUser,
trimLines
EmbedWith,
formatNumber,
inviteHasCounts,
memoize,
MINUTES,
preEmbedPadding,
resolveInvite,
resolveUser,
trimLines,
} from "../../../utils";
import { TimeAndDatePlugin } from "../../TimeAndDate/TimeAndDatePlugin";
import { UtilityPluginType } from "../types";
import { getGuildPreview } from "./getGuildPreview";
export async function getServerInfoEmbed(
pluginData: GuildPluginData<UtilityPluginType>,
serverId: string,

View file

@ -2,9 +2,7 @@ import { MessageEmbedOptions } from "discord.js";
import humanizeDuration from "humanize-duration";
import { GuildPluginData } from "knub";
import moment from "moment-timezone";
import {
EmbedWith, preEmbedPadding
} from "../../../utils";
import { EmbedWith, preEmbedPadding } from "../../../utils";
import { snowflakeToTimestamp } from "../../../utils/snowflakeToTimestamp";
import { TimeAndDatePlugin } from "../../TimeAndDate/TimeAndDatePlugin";
import { UtilityPluginType } from "../types";

View file

@ -4,10 +4,14 @@ import { GuildPluginData } from "knub";
import moment from "moment-timezone";
import { CaseTypes } from "../../../data/CaseTypes";
import {
EmbedWith, messageLink, preEmbedPadding, resolveMember,
resolveUser,
sorter, trimLines, UnknownUser
EmbedWith,
messageLink,
preEmbedPadding,
resolveMember,
resolveUser,
sorter,
trimLines,
UnknownUser,
} from "../../../utils";
import { TimeAndDatePlugin } from "../../TimeAndDate/TimeAndDatePlugin";
import { UtilityPluginType } from "../types";

Some files were not shown because too many files have changed in this diff Show more