blob: 0fdb8ccbde28162f3865f303172e9eac2e6b0f0b (
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
|
#---
#statedir: /home/jrayhawk/.local/state/bungmobott/
#tempdir: /tmp/bungmobott/
#listen: 0.0.0.0:5555
#join_channels:
# twitch:
# - bungmonkey
# - dopefish
# # - yackamov
# gamesurge:
# - bungmonkey
#twitch_user_id: 59895482 # saves a lookup
#chat_user:
# twitch: bungmonkey
# gamesurge: bungmoBott
#match:
# '^gamesurge|twitch$'
# '^#bungmonkey$'
# '^!help$': [ { perm: [ any ], func: say, arg: ['| https://bungmonkey.omgwallhack.org/txt/commands.txt'] } ]
module BungmoBott
EXE = "bungmobott"
class ChatUser
include YAML::Serializable
include YAML::Serializable::Unmapped
property twitch : String?
property gamesurge : String?
end
# Do we turn this into a class? Maybe an Enum?
# class Permissions
# include YAML::Serializable
# include YAML::Serializable::Unmapped
# property any
# property sub
# property mod
# property vip
# end
class Commands
include YAML::Serializable
include YAML::Serializable::Unmapped
property perm : Array( String )? = nil
property func : String
property arg : Array( String )? = nil
end
class JoinChannels
include YAML::Serializable
include YAML::Serializable::Unmapped
property twitch : Array(String)?
property gamesurge : Array(String)?
end
class Config
include YAML::Serializable
include YAML::Serializable::Unmapped
property statedir : String = (
ENV["LOCALAPPDATA"]? && Path.windows( ENV["LOCALAPPDATA"] + "\\#{EXE}\\state\\" ).to_s ||
ENV["XDG_STATE_HOME"]? && ENV["XDG_STATE_HOME"] + "/#{EXE}/" ||
Path.home./(".local/state/#{EXE}").to_s
)
property tempdir : String = (
ENV["TEMP"]? && ENV["TEMP"] + "\\#{EXE}\\" ||
"/tmp/#{EXE}/"
)
property rundir : String = (
ENV["XDG_RUNTIME_DIR"]? && ENV["XDG_RUNTIME_DIR"] + "/#{EXE}/" ||
"/tmp/#{EXE}/"
) # FIXME: do sockets and such even work on Windows?
# Should probably warn about that somewhere around here.
#@[YAML::Field(emit_null: true)]
property bungmobott_listen : String? = nil
property bungmobott_connect : String? = nil
#@[YAML::Field(emit_null: true)]
property obs_connect : String? = nil
property chat_user : ChatUser? = ChatUser.from_yaml("---")
property join_channels : JoinChannels? = JoinChannels.from_yaml("---")
property match : Hash( String, # network regex
Hash( String, # channel regex
Hash( String, # text regex
Array( Commands ) ) ) )?
@[YAML::Field(emit_null: true)]
property twitch_user_id : UInt32? = nil
@[YAML::Field(emit_null: true)]
property voice_list : String? = nil
def after_initialize()
if @voice_list.is_a?( Nil )
@voice_list = Path.new( @statedir, "voices.txt" ).normalize.to_s
end
end
end
class Secrets
include YAML::Serializable
include YAML::Serializable::Unmapped
@[YAML::Field(emit_null: true)]
property twitch_access_token : String?
@[YAML::Field(emit_null: true)]
property twitch_client_id : String?
@[YAML::Field(emit_null: true)]
property gcloud_token : String?
@[YAML::Field(emit_null: true)]
property gamesurge_password : String?
@[YAML::Field(emit_null: true)]
property obs_password : String?
@[YAML::Field(emit_null: true)]
property bungmobott_key : String?
end
end
|