Bot Handling - Zirak/SO-ChatBot GitHub Wiki
So, you want to run the bot. Getting it running is easy enough (see the readme), but what about other things? Note that most of these operations require a basic literacy of js and your browser's js console.
Changing the invocation pattern
By default, you get the bot's attention by prepending a message with !!
, which is stored in bot.config.pattern
. Change that to whatever you wish, e.g.
bot.config.pattern = 'beer!'
To get the bot's attention by prepending the message with beer!
In general you'll want to keep configs in, well, bot.config
. While it's supposed to auto-save, remember to bot.memory.save('config')
.
Saving and loading memory
The bot "remembers" things by storing them in localStorage
, abstracted with bot.memory
. Getting a full memory dump is pretty straightforward:
JSON.stringify(localStorage)
And loading it (assuming o
is the js object you get from parsing the above):
Object.keys(o).forEach(function (k) {
if (k.indexOf("bot_") === 0) {
localStorage[k] = o[k];
}
});
Rooms
The room you run the bot in is pretty important. Currently, it's a single entity which you can invite to separate rooms - but some operations can only be done on the main room (looking up user ids and messages are the main problem). So choose wisely.
And...I can't think of anything else. If anything is missing, feel free to edit or raise an issue or ping me or send me a carrier pigeon.