Miscellaneous Methods
This page covers public Robot methods that do not fit cleanly into the main attribute, messaging, memory, pipeline, or utility chapters.
Thread subscriptions
These methods let a plugin stay attached to an active thread so later messages in that thread continue to route back to the same plugin logic.
Subscribe()Unsubscribe()
Go
func handler(r robot.Robot, args ...string) robot.TaskRetVal {
if r.Subscribe() {
r.Say("I will keep watching this thread.")
}
return robot.Normal
}
Lua
local gopherbot = require("gopherbot_v1")
local Robot = gopherbot.Robot
local bot = Robot:new()
if bot:Subscribe() then
bot:Say("I will keep watching this thread.")
end
JavaScript
const { Robot } = require("gopherbot_v1")();
const bot = new Robot();
if (bot.Subscribe()) {
bot.Say("I will keep watching this thread.");
}
Bash
if Subscribe
then
Say "I will keep watching this thread."
fi
Python
if bot.Subscribe():
bot.Say("I will keep watching this thread.")
Ruby
if bot.Subscribe()
bot.Say("I will keep watching this thread.")
end
Random helpers
These are convenience methods for lightweight reply variation.
RandomString(...)RandomInt(...)
RandomInt(...) is not exposed consistently in every older scripting binding, so check the binding you are using.
Go
choice := r.RandomString([]string{"Working on it.", "Still running.", "Almost done."})
r.Say(choice)
Lua
local gopherbot = require("gopherbot_v1")
local Robot = gopherbot.Robot
local bot = Robot:new()
local choice = bot:RandomString({"Working on it.", "Still running.", "Almost done."})
bot:Say(choice)
JavaScript
const { Robot } = require("gopherbot_v1")();
const bot = new Robot();
const choice = bot.RandomString(["Working on it.", "Still running.", "Almost done."]);
bot.Say(choice);
Python
choice = bot.RandomString(["Working on it.", "Still running.", "Almost done."])
bot.Say(choice)
Ruby
choice = bot.RandomString(["Working on it.", "Still running.", "Almost done."])
bot.Say(choice)
Compiled Go notes
Two public methods are mostly relevant to compiled Go extensions:
GetMessage()RaisePriv(reason)
They are intentionally not expanded into large user-facing chapters here. If you are writing a compiled Go extension and need direct access to message internals or privileged filesystem behavior, read the engine source and current developer docs alongside this manual.