summaryrefslogtreecommitdiff
path: root/twitchupdate.rb
diff options
context:
space:
mode:
authorJoe Rayhawk <jrayhawk@omgwallhack.org>2015-10-21 16:47:05 -0700
committerJoe Rayhawk <jrayhawk@omgwallhack.org>2015-10-21 16:47:05 -0700
commitd7eef063a7d993dcd91a701f151597a678b09190 (patch)
tree22968b9e611614266bae49d451ad1ff6aea3038e /twitchupdate.rb
downloadtwitchtools-d7eef063a7d993dcd91a701f151597a678b09190.tar.gz
twitchtools-d7eef063a7d993dcd91a701f151597a678b09190.zip
twitchtools: initial commit
Diffstat (limited to 'twitchupdate.rb')
-rwxr-xr-xtwitchupdate.rb32
1 files changed, 32 insertions, 0 deletions
diff --git a/twitchupdate.rb b/twitchupdate.rb
new file mode 100755
index 0000000..946d627
--- /dev/null
+++ b/twitchupdate.rb
@@ -0,0 +1,32 @@
+#!/usr/bin/ruby
+
+require 'twitch'
+require 'pp'
+
+confdir = Dir.home + '/.config/twitch/'
+ENV['APPDATA'] && confdir = ENV['APPDATA'] + "\\twitch\\"
+ENV['XDG_CONFIG_HOME'] && confdir = ENV['XDG_CONFIG_HOME'] + '/twitch/'
+
+access_token = IO.read( confdir + 'access_token' ).chomp
+
+twitch=Twitch.new({
+ :access_token => access_token
+})
+
+channel = twitch.getYourChannel
+
+game = channel[:body]["game"]
+if ARGV[0].to_s.length > 0
+ game = ARGV[0]
+end
+
+status = channel[:body]["status"]
+if ARGV[1].to_s.length > 0
+ status = ARGV[1]
+end
+
+unless ARGV.empty?
+ pp twitch.editChannel(channel[:body]['name'],status,game)
+else
+ pp channel
+end