mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-10 12:25:02 +00:00
Organise all imports, make Mutes depend on Logs
This commit is contained in:
parent
a94e7593ec
commit
6ac9d2f2a2
437 changed files with 1912 additions and 2027 deletions
|
@ -1,18 +1,18 @@
|
|||
import { zeppelinGuildPlugin } from "../ZeppelinPluginBlueprint";
|
||||
import { PluginOptions } from "knub";
|
||||
import { ConfigSchema, SlowmodePluginType } from "./types";
|
||||
import { GuildSlowmodes } from "../../data/GuildSlowmodes";
|
||||
import { GuildSavedMessages } from "../../data/GuildSavedMessages";
|
||||
import { GuildLogs } from "../../data/GuildLogs";
|
||||
import { GuildSavedMessages } from "../../data/GuildSavedMessages";
|
||||
import { GuildSlowmodes } from "../../data/GuildSlowmodes";
|
||||
import { SECONDS } from "../../utils";
|
||||
import { onMessageCreate } from "./util/onMessageCreate";
|
||||
import { clearExpiredSlowmodes } from "./util/clearExpiredSlowmodes";
|
||||
import { SlowmodeDisableCmd } from "./commands/SlowmodeDisableCmd";
|
||||
import { SlowmodeClearCmd } from "./commands/SlowmodeClearCmd";
|
||||
import { SlowmodeListCmd } from "./commands/SlowmodeListCmd";
|
||||
import { SlowmodeGetCmd } from "./commands/SlowmodeGetCmd";
|
||||
import { SlowmodeSetCmd } from "./commands/SlowmodeSetCmd";
|
||||
import { LogsPlugin } from "../Logs/LogsPlugin";
|
||||
import { zeppelinGuildPlugin } from "../ZeppelinPluginBlueprint";
|
||||
import { SlowmodeClearCmd } from "./commands/SlowmodeClearCmd";
|
||||
import { SlowmodeDisableCmd } from "./commands/SlowmodeDisableCmd";
|
||||
import { SlowmodeGetCmd } from "./commands/SlowmodeGetCmd";
|
||||
import { SlowmodeListCmd } from "./commands/SlowmodeListCmd";
|
||||
import { SlowmodeSetCmd } from "./commands/SlowmodeSetCmd";
|
||||
import { ConfigSchema, SlowmodePluginType } from "./types";
|
||||
import { clearExpiredSlowmodes } from "./util/clearExpiredSlowmodes";
|
||||
import { onMessageCreate } from "./util/onMessageCreate";
|
||||
|
||||
const BOT_SLOWMODE_CLEAR_INTERVAL = 60 * SECONDS;
|
||||
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
import { commandTypeHelpers as ct } from "../../../commandTypes";
|
||||
import { sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
|
||||
import { slowmodeCmd } from "../types";
|
||||
import { clearBotSlowmodeFromUserId } from "../util/clearBotSlowmodeFromUserId";
|
||||
import { asSingleLine, disableInlineCode } from "../../../utils";
|
||||
import { getMissingChannelPermissions } from "../../../utils/getMissingChannelPermissions";
|
||||
import { BOT_SLOWMODE_CLEAR_PERMISSIONS } from "../requiredPermissions";
|
||||
import { missingPermissionError } from "../../../utils/missingPermissionError";
|
||||
import { BOT_SLOWMODE_CLEAR_PERMISSIONS } from "../requiredPermissions";
|
||||
import { slowmodeCmd } from "../types";
|
||||
import { clearBotSlowmodeFromUserId } from "../util/clearBotSlowmodeFromUserId";
|
||||
|
||||
export const SlowmodeClearCmd = slowmodeCmd({
|
||||
trigger: ["slowmode clear", "slowmode c"],
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { TextChannel } from "discord.js";
|
||||
import humanizeDuration from "humanize-duration";
|
||||
import { commandTypeHelpers as ct } from "../../../commandTypes";
|
||||
import { slowmodeCmd } from "../types";
|
||||
|
||||
import humanizeDuration from "humanize-duration";
|
||||
import { TextChannel } from "discord.js";
|
||||
|
||||
export const SlowmodeGetCmd = slowmodeCmd({
|
||||
trigger: "slowmode",
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import { slowmodeCmd } from "../types";
|
||||
|
||||
import { GuildChannel, TextChannel } from "discord.js";
|
||||
import humanizeDuration from "humanize-duration";
|
||||
import { createChunkedMessage } from "knub/dist/helpers";
|
||||
import { errorMessage } from "../../../utils";
|
||||
import humanizeDuration from "humanize-duration";
|
||||
import { GuildChannel, TextChannel } from "discord.js";
|
||||
import { slowmodeCmd } from "../types";
|
||||
|
||||
|
||||
export const SlowmodeListCmd = slowmodeCmd({
|
||||
trigger: ["slowmode list", "slowmode l", "slowmodes"],
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
import { commandTypeHelpers as ct } from "../../../commandTypes";
|
||||
import { slowmodeCmd } from "../types";
|
||||
|
||||
import { Permissions, TextChannel } from "discord.js";
|
||||
import humanizeDuration from "humanize-duration";
|
||||
import { commandTypeHelpers as ct } from "../../../commandTypes";
|
||||
import { sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
|
||||
import { asSingleLine, DAYS, disableInlineCode, HOURS, MINUTES } from "../../../utils";
|
||||
import { disableBotSlowmodeForChannel } from "../util/disableBotSlowmodeForChannel";
|
||||
import { actualDisableSlowmodeCmd } from "../util/actualDisableSlowmodeCmd";
|
||||
import { getMissingPermissions } from "../../../utils/getMissingPermissions";
|
||||
import { missingPermissionError } from "../../../utils/missingPermissionError";
|
||||
import { BOT_SLOWMODE_PERMISSIONS, NATIVE_SLOWMODE_PERMISSIONS } from "../requiredPermissions";
|
||||
import { Permissions, TextChannel } from "discord.js";
|
||||
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
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import * as t from "io-ts";
|
||||
import { BasePluginType, typedGuildCommand, typedGuildEventListener } from "knub";
|
||||
import { GuildSlowmodes } from "../../data/GuildSlowmodes";
|
||||
import { GuildSavedMessages } from "../../data/GuildSavedMessages";
|
||||
import { GuildLogs } from "../../data/GuildLogs";
|
||||
import { GuildSavedMessages } from "../../data/GuildSavedMessages";
|
||||
import { GuildSlowmodes } from "../../data/GuildSlowmodes";
|
||||
|
||||
export const ConfigSchema = t.type({
|
||||
use_native_slowmode: t.boolean,
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import { Message, TextChannel } from "discord.js";
|
||||
import { sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
|
||||
import { disableBotSlowmodeForChannel } from "./disableBotSlowmodeForChannel";
|
||||
import { noop } from "../../../utils";
|
||||
import { getMissingChannelPermissions } from "../../../utils/getMissingChannelPermissions";
|
||||
import { BOT_SLOWMODE_DISABLE_PERMISSIONS } from "../requiredPermissions";
|
||||
import { missingPermissionError } from "../../../utils/missingPermissionError";
|
||||
import { Message, TextChannel } from "discord.js";
|
||||
import { BOT_SLOWMODE_DISABLE_PERMISSIONS } from "../requiredPermissions";
|
||||
import { disableBotSlowmodeForChannel } from "./disableBotSlowmodeForChannel";
|
||||
|
||||
export async function actualDisableSlowmodeCmd(msg: Message, args, pluginData) {
|
||||
const botSlowmode = await pluginData.state.slowmodes.getChannelSlowmode(args.channel.id);
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import { SlowmodePluginType } from "../types";
|
||||
import { GuildChannel, Permissions, TextChannel } from "discord.js";
|
||||
import { GuildPluginData } from "knub";
|
||||
|
||||
import { isDiscordRESTError, stripObjectToScalars, UnknownUser } from "../../../utils";
|
||||
import { LogType } from "../../../data/LogType";
|
||||
import { logger } from "../../../logger";
|
||||
import { GuildChannel, TextChannel, Permissions } from "discord.js";
|
||||
import { isDiscordRESTError, stripObjectToScalars, UnknownUser } from "../../../utils";
|
||||
import { SlowmodePluginType } from "../types";
|
||||
|
||||
|
||||
export async function applyBotSlowmodeToUserId(
|
||||
pluginData: GuildPluginData<SlowmodePluginType>,
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
import { GuildChannel, TextChannel } from "discord.js";
|
||||
import { GuildPluginData } from "knub";
|
||||
import { SlowmodePluginType } from "../types";
|
||||
import { LogType } from "../../../data/LogType";
|
||||
import { logger } from "../../../logger";
|
||||
|
||||
import { stripObjectToScalars, UnknownUser } from "../../../utils";
|
||||
import { SlowmodePluginType } from "../types";
|
||||
import { clearBotSlowmodeFromUserId } from "./clearBotSlowmodeFromUserId";
|
||||
import { GuildChannel, TextChannel } from "discord.js";
|
||||
|
||||
|
||||
export async function clearExpiredSlowmodes(pluginData: GuildPluginData<SlowmodePluginType>) {
|
||||
const expiredSlowmodeUsers = await pluginData.state.slowmodes.getExpiredSlowmodeUsers();
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
import { SavedMessage } from "../../../data/entities/SavedMessage";
|
||||
|
||||
import { GuildPluginData } from "knub";
|
||||
import { SlowmodePluginType } from "../types";
|
||||
import { resolveMember } from "../../../utils";
|
||||
import { applyBotSlowmodeToUserId } from "./applyBotSlowmodeToUserId";
|
||||
import { hasPermission } from "../../../pluginUtils";
|
||||
import { getMissingChannelPermissions } from "../../../utils/getMissingChannelPermissions";
|
||||
import { BOT_SLOWMODE_PERMISSIONS } from "../requiredPermissions";
|
||||
import { LogsPlugin } from "../../Logs/LogsPlugin";
|
||||
import { LogType } from "../../../data/LogType";
|
||||
import { missingPermissionError } from "../../../utils/missingPermissionError";
|
||||
import { messageLock } from "../../../utils/lockNameHelpers";
|
||||
import { TextChannel } from "discord.js";
|
||||
import { GuildPluginData } from "knub";
|
||||
import { SavedMessage } from "../../../data/entities/SavedMessage";
|
||||
import { LogType } from "../../../data/LogType";
|
||||
import { hasPermission } from "../../../pluginUtils";
|
||||
import { resolveMember } from "../../../utils";
|
||||
import { getMissingChannelPermissions } from "../../../utils/getMissingChannelPermissions";
|
||||
import { messageLock } from "../../../utils/lockNameHelpers";
|
||||
import { missingPermissionError } from "../../../utils/missingPermissionError";
|
||||
import { LogsPlugin } from "../../Logs/LogsPlugin";
|
||||
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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue