mirror of https://github.com/calzoneman/sync.git
Add permission for /clear and log it
This commit is contained in:
parent
0e8e0aef54
commit
b28fd9e4a8
|
@ -375,12 +375,13 @@ ChatModule.prototype.handleCmdSay = function (user, msg, meta) {
|
|||
};
|
||||
|
||||
ChatModule.prototype.handleCmdClear = function (user, msg, meta) {
|
||||
if (user.account.effectiveRank < 2) {
|
||||
if (!this.channel.modules.permissions.canClearChat(user)) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.buffer = [];
|
||||
this.channel.broadcastAll("clearchat");
|
||||
this.channel.logger.log("[mod] " + user.getName() + " used /clear");
|
||||
};
|
||||
|
||||
ChatModule.prototype.handleCmdAdminflair = function (user, msg, meta) {
|
||||
|
|
|
@ -38,7 +38,8 @@ const DEFAULT_PERMISSIONS = {
|
|||
playlistlock: 2, // Lock/unlock the playlist
|
||||
leaderctl: 2, // Give/take leader
|
||||
drink: 1.5, // Use the /d command
|
||||
chat: 0 // Send chat messages
|
||||
chat: 0, // Send chat messages
|
||||
chatclear: 2 // Use the /clear command
|
||||
};
|
||||
|
||||
function PermissionsModule(channel) {
|
||||
|
@ -292,6 +293,10 @@ PermissionsModule.prototype.canChat = function (actor) {
|
|||
return this.hasPermission(actor, "chat");
|
||||
};
|
||||
|
||||
PermissionsModule.prototype.canClearChat = function (actor) {
|
||||
return this.hasPermission(actor, "chatclear");
|
||||
};
|
||||
|
||||
PermissionsModule.prototype.canSetOptions = function (actor) {
|
||||
if (actor instanceof User) {
|
||||
actor = actor.account;
|
||||
|
@ -361,7 +366,8 @@ PermissionsModule.prototype.loadUnregistered = function () {
|
|||
playlistlock: 2, // Lock/unlock the playlist
|
||||
leaderctl: 0, // Give/take leader
|
||||
drink: 0, // Use the /d command
|
||||
chat: 0 // Send chat messages
|
||||
chat: 0, // Send chat messages
|
||||
chatclear: 2 // Use the /clear command
|
||||
};
|
||||
|
||||
for (var key in perms) {
|
||||
|
|
|
@ -1770,6 +1770,7 @@ function genPermissionsEditor() {
|
|||
addDivider("Misc");
|
||||
makeOption("Drink calls", "drink", modleader, CHANNEL.perms.drink+"");
|
||||
makeOption("Chat", "chat", noanon, CHANNEL.perms.chat+"");
|
||||
makeOption("Clear Chat", "chatclear", modleader, CHANNEL.perms.chatclear+"");
|
||||
|
||||
var sgroup = $("<div/>").addClass("form-group").appendTo(form);
|
||||
var sgroupinner = $("<div/>").addClass("col-sm-8 col-sm-offset-4").appendTo(sgroup);
|
||||
|
|
Loading…
Reference in New Issue