riddim: Exit when disconnected from server

Wed, 15 Mar 2023 12:11:01 +0000

author
Matthew Wild <mwild1@gmail.com>
date
Wed, 15 Mar 2023 12:11:01 +0000
changeset 170
eae589a33624
parent 169
72d3ca5225f3
child 171
7362add76bcd

riddim: Exit when disconnected from server

This allows e.g. a supervisor to restart the bot according to whatever policy
is desired.

init.lua file | annotate | diff | comparison | revisions
--- a/init.lua	Wed Mar 15 12:10:00 2023 +0000
+++ b/init.lua	Wed Mar 15 12:11:01 2023 +0000
@@ -151,6 +151,11 @@
 	
 	c:hook("ready", function () b:start(); end);
 
+	c:hook("disconnected", function ()
+		print("Disconnected from server, riddim will exit now");
+		os.exit();
+	end, -1);
+
 	if config.connect_host then
 		c.connect_host = config.connect_host;
 	end

mercurial