Testing new move and listen

This commit is contained in:
promostarr 2017-04-17 14:50:39 +01:00
parent 8d7e2a4712
commit 8534fb248d
2 changed files with 35 additions and 19 deletions

34
.idea/workspace.xml generated
View file

@ -2,6 +2,7 @@
<project version="4">
<component name="ChangeListManager">
<list default="true" id="ecb21532-0ae7-441d-90a8-4b144fd51290" name="Default" comment="">
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/Janitor.rb" afterPath="$PROJECT_DIR$/Janitor.rb" />
</list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
@ -17,8 +18,8 @@
<file leaf-file-name="Janitor.rb" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/Janitor.rb">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="480">
<caret line="24" column="79" lean-forward="false" selection-start-line="24" selection-start-column="79" selection-end-line="24" selection-end-column="79" />
<state relative-caret-position="409">
<caret line="31" column="20" lean-forward="false" selection-start-line="31" selection-start-column="20" selection-end-line="31" selection-end-column="20" />
<folding />
</state>
</provider>
@ -27,7 +28,7 @@
<file leaf-file-name="notification.rb" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/notification.rb">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="400">
<state relative-caret-position="389">
<caret line="20" column="13" lean-forward="true" selection-start-line="20" selection-start-column="13" selection-end-line="20" selection-end-column="13" />
<folding />
</state>
@ -129,16 +130,15 @@
<option name="presentableId" value="Default" />
<updated>1492353576138</updated>
<workItem from="1492353577745" duration="1817000" />
<workItem from="1492433677612" duration="2404000" />
<workItem from="1492433677612" duration="3322000" />
</task>
<servers />
</component>
<component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="4221000" />
<option name="totallyTimeSpent" value="5139000" />
</component>
<component name="ToolWindowManager">
<frame x="0" y="27" width="1920" height="1020" extended-state="6" />
<editor active="true" />
<layout>
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.1234375" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
@ -147,7 +147,7 @@
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.26970032" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Terminal" active="true" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.26859045" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
@ -194,6 +194,14 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/notification.rb">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="389">
<caret line="20" column="13" lean-forward="true" selection-start-line="20" selection-start-column="13" selection-end-line="20" selection-end-column="13" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/core.rb">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="400">
@ -202,18 +210,10 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/notification.rb">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="400">
<caret line="20" column="13" lean-forward="true" selection-start-line="20" selection-start-column="13" selection-end-line="20" selection-end-column="13" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/Janitor.rb">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="480">
<caret line="24" column="79" lean-forward="false" selection-start-line="24" selection-start-column="79" selection-end-line="24" selection-end-column="79" />
<state relative-caret-position="409">
<caret line="31" column="20" lean-forward="false" selection-start-line="31" selection-start-column="20" selection-end-line="31" selection-end-column="20" />
<folding />
</state>
</provider>

View file

@ -1,6 +1,8 @@
require 'teamspeak-ruby'
class Janitor
debug_mode = true
def login()
ts = Teamspeak::Client.new('ts3.vereto.net')
ts.login('serveradmin', ENV["SrvQry"].dup)
@ -14,7 +16,12 @@ class Janitor
def gsay(msg)
ts = login()
ts.command('sendtextmessage', {targetmode: 3, target: 1, msg: msg})
if debug_mode == true
ts.command('sendtextmessage', {targetmode: 3, target: 1, msg: msg})
else
ts.command('sendtextmessage', {targetmode: 1, target: 13, msg: msg})
end
end
def listen(global)
@ -22,9 +29,9 @@ class Janitor
if global == true
return ts.command('servernotifyregister', event: 'textserver')[0]['msg']
else
move_self('218')
return ts.command('servernotifyregister', event: 'textchannel', id: '218' )[0]['msg']
end
end
def get_clients()
@ -42,6 +49,15 @@ class Janitor
return ts.command('clientfind', pattern: name)
end
def move_client(clid, cid)
ts = log()
return ts.command('clientmove', clid: clid, cid: cid)
end
def move_self(cid)
return move_client(find_client('serveradmin from'), cid)
end
def check_channels()
ts = login()