diff --git a/src/server/handlers/tools.js b/src/server/handlers/tools.js index 7e23f41..183a959 100644 --- a/src/server/handlers/tools.js +++ b/src/server/handlers/tools.js @@ -33,6 +33,8 @@ App.server.setHandler('tools', (context, parts) => { html += ' | '; html += 'Bot-Send'; html += ' | '; + html += 'Bot-Login'; + html += ' | '; html += 'Seen'; html += ' | '; html += 'Clear User-Data'; @@ -56,6 +58,9 @@ App.server.setHandler('tools', (context, parts) => { case 'botsend': toolBotSend(context, html, parts); break; + case 'botlogin': + toolBotLogin(context, html, parts); + break; case 'seen': toolSeen(context, html, parts); break; @@ -154,6 +159,43 @@ function toolBotSend(context, html, parts) { context.endWithWebPage(html, {title: "Develoment Tools - Showdown ChatBot", scripts: ['/static/jquery-3.0.0.min.js']}); } +function toolBotLogin(context, html, parts) { + if (context.post.snd) { + /* Bot-Login action */ + let result = ''; + if (context.post.botuser) { + if (App.bot.isConnected()) { + App.bot.rename(context.post.botuser, context.post.botpass); + App.logServerAction(context.user.id, "Tool Bot-Login used. Bot Username: " + context.post.botuser); + result += '
Login request sucessfully sent.
'; + } else { + result += 'Error: The bot is not connected.
'; + } + } else { + result += 'Cannot login using a blanck username.
'; + } + return context.endWithText(result); + } + html += ''; + html += 'Bot Username: ' + + '
Password: ' + + '
' + + ''; + html += '