Binato/server/commands/Lock.ts

17 lines
596 B
TypeScript
Raw Normal View History

2023-09-10 12:59:22 +01:00
import Channel from "../objects/Channel";
import User from "../objects/User";
import BaseCommand from "./BaseCommand";
2023-08-20 13:03:01 +01:00
2023-09-10 12:59:22 +01:00
export default class LockCommand extends BaseCommand {
2023-08-20 13:03:01 +01:00
public readonly helpDescription:string = "Locks/Unlocks a channel and limits conversation to mods and above.";
public exec(channel:Channel, sender:User, args:Array<string>) {
if (channel.isSpecial) {
channel.SendBotMessage("Multiplayer channels cannot be locked");
return;
}
channel.isLocked = !channel.isLocked;
channel.SendBotMessage(`Channel is now ${channel.isLocked ? "locked" : "unlocked"}`);
}
}