From eada918e81dc097f8dd2c2e8280bff9c53c3f086 Mon Sep 17 00:00:00 2001 From: AgustinSRG Date: Sun, 14 Apr 2024 15:09:39 +0200 Subject: [PATCH] Core: Add 'reconnect' command --- package-lock.json | 4 +- package.json | 2 +- src/bot-modules/core/botmodule.json | 59 ++++++++++++++++-------- src/bot-modules/core/commands/control.js | 11 +++++ 4 files changed, 55 insertions(+), 21 deletions(-) diff --git a/package-lock.json b/package-lock.json index b84015d..f158e96 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "showdown-chatbot", - "version": "2.11.0", + "version": "2.11.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "showdown-chatbot", - "version": "2.11.0", + "version": "2.11.1", "license": "MIT", "dependencies": { "busboy": "1.6.0", diff --git a/package.json b/package.json index ae801b4..2cc6a52 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "showdown-chatbot", - "version": "2.11.0", + "version": "2.11.1", "author": { "name": "Agustin San Roman", "email": "agustinsanromanguzman@gmail.com", diff --git a/src/bot-modules/core/botmodule.json b/src/bot-modules/core/botmodule.json index b3dd0b0..434869f 100644 --- a/src/bot-modules/core/botmodule.json +++ b/src/bot-modules/core/botmodule.json @@ -4,33 +4,56 @@ "main": "core.js", "commands": [ "commands/exec-cmd.js", - "commands/seen.js", - "commands/control.js", - "commands/cmd-admin.js" + "commands/seen.js", + "commands/control.js", + "commands/cmd-admin.js" ], "permissions": { - "commands": {"excepted": true}, - "grant": {"excepted": true}, - "set": {"group": "owner"}, - "joinroom": {"group": "admin"}, - "leaveroom": {"group": "admin"}, - "send": {"group": "admin"}, - "say": {"group": "mod"}, - "saycmd": {"group": "mod"}, - "alts": {"group": "user"}, - "fullalts": {"group": "admin"} + "commands": { + "excepted": true + }, + "grant": { + "excepted": true + }, + "reconnect": { + "excepted": true + }, + "set": { + "group": "owner" + }, + "joinroom": { + "group": "admin" + }, + "leaveroom": { + "group": "admin" + }, + "send": { + "group": "admin" + }, + "say": { + "group": "mod" + }, + "saycmd": { + "group": "mod" + }, + "alts": { + "group": "user" + }, + "fullalts": { + "group": "admin" + } }, "handlers": [ "handlers/autojoin.js", - "handlers/login.js" + "handlers/login.js" ], "langfiles": [ "../../command-parser.translations", - "../../command-usage.translations", + "../../command-usage.translations", "./commands/cmd-admin.translations", - "./commands/control.translations", - "./commands/exec-cmd.translations", - "./commands/seen.translations" + "./commands/control.translations", + "./commands/exec-cmd.translations", + "./commands/seen.translations" ], "description": "Essential Module" } \ No newline at end of file diff --git a/src/bot-modules/core/commands/control.js b/src/bot-modules/core/commands/control.js index 84595e2..5baabbb 100644 --- a/src/bot-modules/core/commands/control.js +++ b/src/bot-modules/core/commands/control.js @@ -15,6 +15,7 @@ * time: gets the bot time * uptime: gets the process uptime * contime: gets the connection time + * reconnect: Forces the bot to reconnect to the server */ 'use strict'; @@ -66,6 +67,16 @@ module.exports = { } }, + /* Reconnect */ + + restart: 'reconnect', + reconnect: function (App) { + this.setLangFile(Lang_File); + if (!this.can('reconnect', this.room)) return this.replyAccessDenied('reconnect'); + this.addToSecurityLog(); + App.restartBot(); + }, + /* Custom send */ custom: function () {