Share
Go down
jasonbro
Posts : 4
Reputation : 2
Join date : 2017-12-22
View user profile

New example module

on Thu Jan 04, 2018 2:22 am
Message reputation : 100% (1 vote)
Yo after reading the docs I think i have some improvements to the example on the getting started page (https://dev.somiibo.com/docs/getting-started/).

i think mine follows the rest of the docs better

Let me know what you think

Code:

//my settings
var userSettings =
{
  "textbox1": {
    "input": {"type": "text", "default": "https://google.com", "title": "Enter a website", "placeholder": "include the http"}
  }
}

//my variables
var myFirstVariable = 42;
var userWebsite;

//my bot script
async function run(currentTab) {
  bot.generalProcedure()

  if (bot.getProtocol() == 'init') {
    userWebsite = bot.getSetting('bot', 'bot_custom_main_textbox1')
    bot.setProtocol('main')
  }

  if (bot.getProtocol() == 'main') {
    await bot.navigateUrl(userWebsite)
    if (bot.getProperty('urlLoaded') == true) {
      bot.alertBox({title: 'Made it!', text: 'Successfully navigated to '+userWebsite, type: 'success', confirmButtonText: 'Ok'})
    } else {
      bot.alertBox({title: 'Oops!', text: 'We never got to '+userWebsite, type: 'warning', confirmButtonText: 'Ok'})
    }
    bot.end();
  }

  setTimeout(function () { run() }, bot.getRunDelay());
}
Ian
Admin
Posts : 423
Reputation : 65
Join date : 2017-09-13
View user profilehttps://somiibo.com

Re: New example module

on Thu Jan 04, 2018 7:07 pm
Message reputation : 100% (2 votes)
Dude this is excellent, thank you for taking the time to help us with the Docs.

I sent you a PM about getting Somiibo Premium for free, let me know if you want this as a thank you from the entire Somiibo team
avatar
Posts : 3
Reputation : 0
Join date : 2019-02-01
View user profile

Re: New example module

on Fri Feb 01, 2019 4:34 am
I've tried to run this version and the version linked to in the developer guide. Neither have worked. I just updated Somiibo. Running on Mac OS X Sierra 10.12.6.

I got the following when hitting Cmd + I and going to Console:

/Applications/Somiibo.app/Contents/Resources/app.asar/node_modules/@sentry/browser/dist/index.js:3579 Module setup date = Fri Feb 01 2019 05:31:44 GMT-0700 (MST) botId = bot_custom_main cache = 0.2.36-r-0-2-1-2019
myFirstScript.js:1 Uncaught SyntaxError: Invalid or unexpected token
/Applications/Somiibo.app/Contents/Resources/app.asar/node_modules/@sentry/browser/dist/index.js:3141 Uncaught TypeError: run is not a function
at bot_custom_main.js?v=0.2.36-r-0-2-1-2019:42
at wrapped (/Applications/Somiibo.app/Contents/Resources/app.asar/node_modules/@sentry/browser/dist/index.js:3117)



Ian
Admin
Posts : 423
Reputation : 65
Join date : 2017-09-13
View user profilehttps://somiibo.com

Re: New example module

on Mon Feb 04, 2019 6:35 pm
Hmm I just tried the script in this post from jasonbro and it seems to work but I'll look into it and see if there's any deprecated calls that might be causing it to break.
Sponsored content

Re: New example module

Back to top
Permissions in this forum:
You cannot reply to topics in this forum