From 7fc87657158f3151350444bd820def306bf0544b Mon Sep 17 00:00:00 2001 From: Ethan Ethan Date: Tue, 9 Jan 2024 01:26:41 +0000 Subject: [PATCH] Add nodejs/controller/commands/invite.js --- nodejs/controller/commands/invite.js | 50 ++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 nodejs/controller/commands/invite.js diff --git a/nodejs/controller/commands/invite.js b/nodejs/controller/commands/invite.js new file mode 100644 index 0000000..77f0d16 --- /dev/null +++ b/nodejs/controller/commands/invite.js @@ -0,0 +1,50 @@ +module.exports = { + 'help': { + desc: `Print the allowed commands.`, + async function(from){ + console.log('called help', from) + let intro = [ + 'I am a bot owned and operated by', + 'wmantly ', + 'You have access to the following commands:' + ] + await this.whisper(from, ...intro, ...this.__reduceCommands(from).map(command => + `${command} -- ${this.commands[command].desc || ''}` + )); + } + }, + 'say': { + desc: `Make the bot say stuff in chat`, + allowed: ['wmantly', 'useless666', 'tux4242', 'pi_chef', '1_cut',], + ignoreLock: true, + async function(from, ...messages){ + await this.say((messages || []).join(' ')); + } + + }, + 'logon': { + desc: `Have bot log on for 10 seconds'`, + allowed: ['wmantly', 'useless666', 'tux4242', 'pi_chef', '1_cut',], + ignoreLock: true, + async function(from, botName){ + this.__unLockCommand(); + + if(botName in his.constructor.bots){ + let bot = this.constructor.bots[botName]; + + if(!bot.isReady){ + try{ + await bot.connect(); + var clear = setTimeout(()=> bot.quit(), 10000); + bot.whisper(from, 'I am ready') + }catch(error){ + console.log('inv error connecting to bot'); + this.whisper('Bot is not available right now, try again in 30 seconds.'); + } + }else{ + await this.whisper(from, `Bot ${bot.bot.entity.username} Already online`); + } + } + } + }, +};