blob: 7896e5a5b3f02a32f3b4f5fb5f9ca9474a0011bc (
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
33
34
35
36
37
38
39
40
41
42
43
44
45
|
#!/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/'
client_id = IO.read( confdir+'client_id' ).chomp
secret_key = IO.read( confdir+'secret_key' ).chomp
redirect_uri = IO.read( confdir+'redirect_uri' ).chomp
# Feel free to use https://www.omgwallhack.org/toys/env.cgi as a redirect URI; I am probably too lazy to steal your oauth token.
scope = '
user_read
user_blocks_edit
user_blocks_read
user_follows_edit
channel_read
channel_editor
channel_commercial
channel_stream
channel_subscriptions
channel_check_subscription
chat_login
'.split.sort.uniq
twitch = Twitch.new({
:client_id => client_id,
:secret_key => secret_key,
:redirect_uri => redirect_uri,
:scope => scope,
})
print( twitch.getLink + "\n" )
#access_token = twitch.auth(code)[:body]["access_token"]
#
#twitch=Twitch.new({
# :access_token => access_token
#})
#
#channel = twitch.getYourChannel
|