blob: 946d6270f7e42512c81d9070b4f049f8acc91487 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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
|