Skip to content

Instantly share code, notes, and snippets.

@rlemon
Created January 31, 2014 23:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rlemon/8745660 to your computer and use it in GitHub Desktop.
Save rlemon/8745660 to your computer and use it in GitHub Desktop.
Bot Online Storage Proposal

Bot Online Storage Proposal.

Well I have been talking about this for some time now and I think there seems to be some confusion on how (I envision) it will work. Here is my breakdown of how I envision things ending up with the online storage.

The server will have a simple api. Pass it a key (will explain) and your command and it will either save the localStorage to the server, or load the localStorage from the server and update the browser before the bot reads the memory. If there is no key present the entire process will be ignored and the command not loaded, and the localStorage loaded like normal. (so minimal internal changes, and a !!saveMemory command that automatically triggers on an interval of your choice).

The keys will be generated and saved by the server. Admin access (logins can be discussed) will allow you to obtain keys to insert into your loading script. Again to be minimal we could just tell the users to include var MEMORY_KEY = key; in before the script is run and the bot just needs to check for that variable or move on to normal loading.

Main Benefits of all of this.

  1. If a maintainer goes down another maintainer can pick up where he left off without any hassle.
  2. Purging old user taught commands will be easier.
  3. We can expand the bot+chat relationship with userscript that have access to user taught commands.
  4. ???
  5. Profit!!!

If I have missed anything please comment.

@rlemon
Copy link
Author

rlemon commented Jan 31, 2014

Ohhh! Just had an idea... the entire thing can also just be part of the loading script. if we don't want to bake anything into the bot. So there could be a specific loader we can release JUST for us that could facilitate all of this.

@SomeKittens
Copy link

How will updating the bot while running work? Save every ten minutes or something?

@SomeKittens
Copy link

+1 for key as variable to check as well as having it as part of the loading script.

@Zirak
Copy link

Zirak commented Jan 31, 2014

There's the old fashioned async/sync: Until the exchange goes down, what happens? What if we can't communicate with the server?

@rlemon
Copy link
Author

rlemon commented Feb 1, 2014

@Zirak hands off approach. If anything fails we will always have the localStorage (basically nothing changes from the way it is now) and the bot will resume as normal.

@SomeKittens !!saveMemory <- instant save. !!saveMemory 30m <- saves every 30m. if this isn't desired we can also make that part of the loading script (you define the timeout as well as the key..)

@SomeKittens
Copy link

I think it'd be better to have it as part of the loading script, though a saveMemory command would be nice for needed downtime.

@rlemon
Copy link
Author

rlemon commented Feb 1, 2014

that is what I was thinking. The timer would be the big player, but if we wanted to shut the bot down for some time (for whatever unforeseen reason) a quick save might be nice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment