Added !resettoke command to tokebot
This commit is contained in:
parent
d9bab09d53
commit
6639cee8ca
|
|
@ -124,16 +124,12 @@ module.exports = class{
|
|||
}
|
||||
}
|
||||
|
||||
relayUserChat(socket, msg, type, links){
|
||||
const user = this.server.getSocketInfo(socket);
|
||||
this.relayChat(user.user, user.flair, user.highLevel, msg, type, socket.chan, links)
|
||||
}
|
||||
|
||||
//Base chat functions
|
||||
relayChat(user, flair, highLevel, msg, type = 'chat', chan, links){
|
||||
this.server.io.in(chan).emit("chatMessage", {user, flair, highLevel, msg, type, links});
|
||||
}
|
||||
|
||||
relayServerWisper(socket, user, flair, highLevel, msg, type, links){
|
||||
relayPrivateChat(socket, user, flair, highLevel, msg, type, links){
|
||||
socket.emit("chatMessage", {user, flair, highLevel, msg, type, links});
|
||||
}
|
||||
|
||||
|
|
@ -141,18 +137,26 @@ module.exports = class{
|
|||
this.server.io.emit("chatMessage", {user, flair, highLevel, msg, type, links});
|
||||
}
|
||||
|
||||
//User Chat Functions
|
||||
relayUserChat(socket, msg, type, links){
|
||||
const user = this.server.getSocketInfo(socket);
|
||||
this.relayChat(user.user, user.flair, user.highLevel, msg, type, socket.chan, links)
|
||||
}
|
||||
|
||||
//Toke Chat Functions
|
||||
relayTokeCallout(msg, links){
|
||||
this.relayGlobalChat("Tokebot", "", '∞', msg, "toke", links);
|
||||
}
|
||||
|
||||
relayTokeWhisper(socket, msg, links){
|
||||
this.relayServerWisper(socket, "Tokebot", "", '∞', msg, "tokewhisper", links);
|
||||
this.relayPrivateChat(socket, "Tokebot", "", '∞', msg, "tokewhisper", links);
|
||||
}
|
||||
|
||||
relayGlobalTokeWhisper(msg, links){
|
||||
this.relayGlobalChat("Tokebot", "", '∞', msg, "tokewhisper", links);
|
||||
}
|
||||
|
||||
//Announcement Functions
|
||||
relayServerAnnouncement(msg, links){
|
||||
this.relayGlobalChat("Server", "", '∞', msg, "announcement", links);
|
||||
}
|
||||
|
|
@ -166,6 +170,7 @@ module.exports = class{
|
|||
}
|
||||
}
|
||||
|
||||
//Misc Functions
|
||||
clearChat(chan, user){
|
||||
const activeChan = this.server.activeChannels.get(chan);
|
||||
|
||||
|
|
|
|||
|
|
@ -213,7 +213,24 @@ class commandProcessor{
|
|||
//send it
|
||||
this.chatHandler.relayServerAnnouncement(commandObj.message, commandObj.links);
|
||||
|
||||
//throw send flag
|
||||
//disble send flag
|
||||
return false;
|
||||
}
|
||||
|
||||
//throw send flag
|
||||
return true;
|
||||
}
|
||||
|
||||
async resettoke(commandObj, preprocessor){
|
||||
//Check if the user has permission, and publicly shame them if they don't (lmao)
|
||||
if(await permissionModel.permCheck(commandObj.socket.user, 'resetToke')){
|
||||
//Acknowledge command
|
||||
this.chatHandler.relayTokeWhisper(commandObj.socket, 'Toke cooldown reset.');
|
||||
|
||||
//Tell tokebot to reset the toke
|
||||
preprocessor.tokebot.resetToke();
|
||||
|
||||
//disable send flag
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -229,7 +246,7 @@ class commandProcessor{
|
|||
if(await chanDB.permCheck(commandObj.socket.user, 'clearChat')){
|
||||
//Send off the command
|
||||
this.chatHandler.clearChat(commandObj.socket.chan, commandObj.argumentArray[1]);
|
||||
//throw send flag
|
||||
//disable send flag
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -176,4 +176,12 @@ module.exports = class tokebot{
|
|||
}
|
||||
}
|
||||
|
||||
resetToke(){
|
||||
//Set cooldown to 0
|
||||
this.cooldownCounter = 0;
|
||||
|
||||
//Null out the timer
|
||||
this.cooldownTimer = null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,6 +51,12 @@ const permissionSchema = new mongoose.Schema({
|
|||
default: "admin",
|
||||
required: true
|
||||
},
|
||||
resetToke: {
|
||||
type: mongoose.SchemaTypes.String,
|
||||
enum: rankEnum,
|
||||
default: "admin",
|
||||
required: true
|
||||
},
|
||||
editTokeCommands: {
|
||||
type: mongoose.SchemaTypes.String,
|
||||
enum: rankEnum,
|
||||
|
|
|
|||
Loading…
Reference in a new issue