RiveScript itself doesn’t support this but you can implement it on your own in your app code.
Bad JavaScript example to give you a gist:
// you have a dictionary object of timeout objects per user
var timeouts = new Object();
// your custom reply function in your app
async function sendMessage(username,msg) {
let timeout = timeouts[username];
if (timeout !== undefined) {
clearTimeout(timeout); // cancel the timer on every new message
}
let reply = await rs.reply(username, msg, this);
// set a timer to reset the user topic after some while
timeout = setTimeout(async function() {
await rs.setUservar(username, "topic", "random");
}, 1000 * 60 * 60 * 4); // 4 hour delay, in milliseconds
timeouts[username] = timeout; // so we can cancel it later
return reply;
};
(it’s a “bad example” because if this was running on a web browser, the user probably wouldn’t keep it open for 4 hours, so this would be server-side Node.js code, which doesn’t have setTimeout as that’s a browser API… but you get the gist).
The non-JS implementations of RiveScript work about the same way, except all their methods are synchronous, so you don’t have the `await` keyword (which is how modern async JS can write code that feels synchronous like other languages).