summaryrefslogtreecommitdiff
path: root/crystal/lib
diff options
context:
space:
mode:
Diffstat (limited to 'crystal/lib')
-rw-r--r--crystal/lib/bungmobott/src/bungmobott.cr71
1 files changed, 71 insertions, 0 deletions
diff --git a/crystal/lib/bungmobott/src/bungmobott.cr b/crystal/lib/bungmobott/src/bungmobott.cr
new file mode 100644
index 0000000..d54eaad
--- /dev/null
+++ b/crystal/lib/bungmobott/src/bungmobott.cr
@@ -0,0 +1,71 @@
+#---
+#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
+
+module BungmoBott
+
+ EXE = "bungmobott"
+
+ class ChatUser
+ include YAML::Serializable
+ include YAML::Serializable::Unmapped
+ property twitch : String?
+ property gamesurge : String?
+ 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 listen : String? = nil
+ property chat_user : ChatUser? = ChatUser.from_yaml("---")
+ property join_channels : JoinChannels? = JoinChannels.from_yaml("---")
+ property twitch_user_id : UInt32? = nil
+ 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?
+ end
+end
+