Added !serverannounce command.

This commit is contained in:
rainbow napkin 2024-12-08 15:09:25 -05:00
parent 375cdfb3d8
commit df18b4d783
4 changed files with 35 additions and 0 deletions

View file

@ -84,6 +84,11 @@ module.exports = class{
this.server.io.in(socket.chan).emit("chatMessage", {user: user.user, flair: user.flair, highLevel: user.highLevel, msg, type});
}
relayServerAnnouncement(msg){
//This codebase is always at a 10
this.server.io.emit("chatMessage", {user: "Server", flair: "", highLevel: 10, msg, type: "announcement"});
}
relayChannelAnnouncement(socket, msg){
//This codebase is always at a 10
this.server.io.in(socket.chan).emit("chatMessage", {user: "Channel", flair: "", highLevel: 10, msg, type: "announcement"});

View file

@ -18,6 +18,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.*/
const validator = require('validator');//No express here, so regular validator it is!
//Local Imports
const permissionModel = require('../../schemas/permissionSchema');
const channelModel = require('../../schemas/channel/channelSchema');
module.exports = class commandPreprocessor{
@ -112,4 +113,14 @@ class commandProcessor{
this.server.chatHandler.relayChannelAnnouncement(this.preprocessor.socket, this.preprocessor.commandArray.join(''));
}
}
async serverannounce(){
//Check if the user has permission, and publicly shame them if they don't (lmao)
if(!(this.preprocessor.sendFlag = !(await permissionModel.permCheck(this.preprocessor.socket.user, 'announce')))){
//splice out our whisper
this.preprocessor.commandArray.splice(0,2);
//send it
this.server.chatHandler.relayServerAnnouncement(this.preprocessor.commandArray.join(''));
}
}
}