diff --git a/.idea/Janitor.iml b/.idea/Janitor.iml
index d723844..828bd95 100644
--- a/.idea/Janitor.iml
+++ b/.idea/Janitor.iml
@@ -5,6 +5,6 @@
-
+
\ No newline at end of file
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 17dfe68..30507c1 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -2,9 +2,10 @@
+
-
+
@@ -15,12 +16,22 @@
-
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
@@ -29,8 +40,8 @@
-
-
+
+
@@ -44,8 +55,9 @@
@@ -75,7 +87,6 @@
-
@@ -91,6 +102,7 @@
+
@@ -119,33 +131,34 @@
1492353576138
-
+
+
-
+
-
+
-
-
+
+
-
+
-
+
-
+
-
-
+
+
@@ -160,14 +173,6 @@
-
-
-
-
-
-
-
-
@@ -176,5 +181,45 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Janitor.rb b/Janitor.rb
index 0ac4c21..e8d913d 100644
--- a/Janitor.rb
+++ b/Janitor.rb
@@ -17,9 +17,14 @@ class Janitor
ts.command('sendtextmessage', {targetmode: 3, target: 1, msg: msg})
end
- def listen()
+ def listen(global)
ts = login()
- return ts.command('servernotifyregister', event: 'textserver')[0]['msg']
+ if global = true
+ return ts.command('servernotifyregister', event: 'textserver')[0]['msg']
+ else
+ return ts.command('servernotifyregister', event: 'textchannel', id: 218 )[0]['msg']
+ end
+
end
def get_clients()
diff --git a/notification.rb b/notification.rb
index d38b7f6..51ad963 100644
--- a/notification.rb
+++ b/notification.rb
@@ -1,4 +1,4 @@
-#!/usr/bin/env ruby
+ #!/usr/bin/env ruby
require_relative 'Janitor'
@@ -6,17 +6,17 @@
jan = Janitor.new
while (i > 0)
begin
- cmd = jan.listen()
+ cmd = jan.listen(true)
puts cmd
if cmd == '!help'
- msg = "I am Janitor, you can tell me to do things."
- jan.gsay(msg)
+ msg = "I am Janitor, you can tell me to do things."
+ jan.gsay(msg)
msg = "Try !roll to roll a dice"
jan.gsay(msg)
end
if cmd == "!stop"
msg = "JAN Will stop listening"
- jan.gsay(msg)
+ jan.gsay(msg)
puts "Stopping"
i = -1
end
@@ -38,7 +38,7 @@
jan.gsay(jan.roll)
end
- rescue Exception => e
- puts "Error: Some kind of time out? " + e.message
- end
+ rescue Exception => e
+ puts "Error: Some kind of time out? " + e.message
+ end
end