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

Deprecate GuildActions. Fix double case posting when muting a user for message spam. Update to new mute/case style when muting a user for "other" spam.

GuildActions turned out to be a fairly pointless abstraction in the end.
It didn't really solve the problems it was meant to solve (that is,
reduce code spaghetti by having all inter-plugin calls go through a
single service, and allow easier ways to replace core plugins with
alternatives that share the same interface) any better than simply
using `this.getPlugin()` when needed, and introduced extra complexity
and made static analysis messier.
This commit is contained in:
Dragory 2019-04-20 17:36:28 +03:00
parent b95da113b2
commit 9a206455dc
10 changed files with 319 additions and 376 deletions

View file

@ -8,6 +8,7 @@ import { SavedMessage } from "../data/entities/SavedMessage";
import { GuildSavedMessages } from "../data/GuildSavedMessages";
const NATIVE_SLOWMODE_LIMIT = 6 * 60 * 60; // 6 hours
const MAX_SLOWMODE = 60 * 60 * 24 * 365 * 100; // 100 years
interface ISlowmodePluginConfig {
use_native_slowmode: boolean;
@ -238,6 +239,15 @@ export class SlowmodePlugin extends ZeppelinPlugin<ISlowmodePluginConfig> {
const seconds = Math.ceil(convertDelayStringToMS(args.time, "s") / 1000);
const useNativeSlowmode = this.getConfigForChannel(channel).use_native_slowmode && seconds <= NATIVE_SLOWMODE_LIMIT;
if (seconds === 0) {
return this.disableSlowmodeCmd(msg, { channel: args.channel });
}
if (seconds > MAX_SLOWMODE) {
this.sendErrorMessage(msg.channel, `Sorry, slowmodes can be at most 100 years long. Maybe 99 would be enough?`);
return;
}
if (useNativeSlowmode) {
// Native slowmode