Feature/49 ignore channel lists when logging #168
3 changed files with 42 additions and 3 deletions
37
src/commands/ignore.ts
Normal file
37
src/commands/ignore.ts
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
import { ICommandContext } from "../contracts/ICommandContext";
|
||||||
|
import IgnoredChannel from "../entity/IgnoredChannel";
|
||||||
|
import PublicEmbed from "../helpers/embeds/PublicEmbed";
|
||||||
|
import { Command } from "../type/command";
|
||||||
|
|
||||||
|
export default class Ignore extends Command {
|
||||||
|
constructor() {
|
||||||
|
super();
|
||||||
|
|
||||||
|
super.Category = "Moderation";
|
||||||
|
super.Roles = [
|
||||||
|
"moderator"
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public override async execute(context: ICommandContext) {
|
||||||
|
if (!context.message.guild) return;
|
||||||
|
|
||||||
|
const isChannelIgnored = await IgnoredChannel.IsChannelIgnored(context.message.channel.id);
|
||||||
|
|
||||||
|
if (isChannelIgnored) {
|
||||||
|
const entity = await IgnoredChannel.FetchOneById(IgnoredChannel, context.message.channel.id);
|
||||||
|
|
||||||
|
await IgnoredChannel.Remove(IgnoredChannel, entity);
|
||||||
|
|
||||||
|
const embed = new PublicEmbed(context, "Success", "This channel will start being logged again.");
|
||||||
|
await embed.SendToCurrentChannel();
|
||||||
|
} else {
|
||||||
|
const entity = new IgnoredChannel(context.message.channel.id);
|
||||||
|
|
||||||
|
await entity.Save(IgnoredChannel, entity);
|
||||||
|
|
||||||
|
const embed = new PublicEmbed(context, "Success", "This channel will now be ignored from logging.");
|
||||||
|
await embed.SendToCurrentChannel();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -8,6 +8,7 @@ import Code from "./commands/code";
|
||||||
import Config from "./commands/config";
|
import Config from "./commands/config";
|
||||||
import Disable from "./commands/disable";
|
import Disable from "./commands/disable";
|
||||||
import Help from "./commands/help";
|
import Help from "./commands/help";
|
||||||
|
import Ignore from "./commands/ignore";
|
||||||
import Kick from "./commands/kick";
|
import Kick from "./commands/kick";
|
||||||
import Mute from "./commands/mute";
|
import Mute from "./commands/mute";
|
||||||
import Poll from "./commands/poll";
|
import Poll from "./commands/poll";
|
||||||
|
@ -32,7 +33,11 @@ export default class Registry {
|
||||||
CoreClient.RegisterCommand("ban", new Ban());
|
CoreClient.RegisterCommand("ban", new Ban());
|
||||||
CoreClient.RegisterCommand("bunny", new Bunny());
|
CoreClient.RegisterCommand("bunny", new Bunny());
|
||||||
CoreClient.RegisterCommand("clear", new Clear());
|
CoreClient.RegisterCommand("clear", new Clear());
|
||||||
|
CoreClient.RegisterCommand("code", new Code());
|
||||||
|
CoreClient.RegisterCommand("config", new Config());
|
||||||
|
CoreClient.RegisterCommand("disable", new Disable());
|
||||||
CoreClient.RegisterCommand("help", new Help());
|
CoreClient.RegisterCommand("help", new Help());
|
||||||
|
CoreClient.RegisterCommand("ignore", new Ignore());
|
||||||
CoreClient.RegisterCommand("kick", new Kick());
|
CoreClient.RegisterCommand("kick", new Kick());
|
||||||
CoreClient.RegisterCommand("mute", new Mute());
|
CoreClient.RegisterCommand("mute", new Mute());
|
||||||
CoreClient.RegisterCommand("poll", new Poll());
|
CoreClient.RegisterCommand("poll", new Poll());
|
||||||
|
@ -41,9 +46,6 @@ export default class Registry {
|
||||||
CoreClient.RegisterCommand("unmute", new Unmute());
|
CoreClient.RegisterCommand("unmute", new Unmute());
|
||||||
CoreClient.RegisterCommand("warn", new Warn());
|
CoreClient.RegisterCommand("warn", new Warn());
|
||||||
CoreClient.RegisterCommand("setup", new Setup());
|
CoreClient.RegisterCommand("setup", new Setup());
|
||||||
CoreClient.RegisterCommand("config", new Config());
|
|
||||||
CoreClient.RegisterCommand("code", new Code());
|
|
||||||
CoreClient.RegisterCommand("disable", new Disable());
|
|
||||||
|
|
||||||
// Exclusive Commands: MankBot
|
// Exclusive Commands: MankBot
|
||||||
CoreClient.RegisterCommand("lobby", new Lobby(), "501231711271780357");
|
CoreClient.RegisterCommand("lobby", new Lobby(), "501231711271780357");
|
||||||
|
|
Loading…
Reference in a new issue