- verify if commandchannel is joined, before posting something
authorAndreas Scherbaum <andreas@scherbaum.biz>
Sat, 19 May 2012 21:32:43 +0000 (23:32 +0200)
committerAndreas Scherbaum <andreas@scherbaum.biz>
Sat, 19 May 2012 21:32:43 +0000 (23:32 +0200)
docbot.pl

index 26afe0906f7a9e4869014bad72c9aaaf91b69bae..686eb1bb410df21a93c6d4235972872a3e428dae 100755 (executable)
--- a/docbot.pl
+++ b/docbot.pl
@@ -928,6 +928,12 @@ sub send_to_commandchannel {
 
     my $commandchannel = config_get_key2('bot', 'commandchannel');
 
+    if (!session_for_channel($commandchannel)) {
+        print_msg("commandchannel: $msg", DEBUG);
+        print_msg("commandchannel ($commandchannel) not joined!", ERROR);
+        return;
+    }
+
     print_msg("commandchannel: $msg", DEBUG);
     send_to_channel(config_get_key2('bot', 'commandchannel'), $msg)
 }