2023-12-15 22:44:25 +01:00
|
|
|
# (c) 2023-present Eroax
|
|
|
|
# (c) 2023-present Yagich
|
|
|
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
|
|
class_name Connections
|
|
|
|
|
|
|
|
static var obs_websocket
|
2024-01-26 11:31:52 +01:00
|
|
|
static var twitch
|
|
|
|
|
|
|
|
static func _twitch_eventsub_event_received(event_data : Dictionary):
|
|
|
|
|
|
|
|
DeckHolder.send_event(&"twitch_eventsub", event_data)
|
|
|
|
|
2023-12-15 22:44:25 +01:00
|
|
|
|
|
|
|
static func _twitch_chat_received(msg_dict : Dictionary):
|
|
|
|
|
|
|
|
DeckHolder.send_event(&"twitch_chat", msg_dict)
|
|
|
|
|
2024-01-15 06:35:16 +01:00
|
|
|
|
|
|
|
## Temporary Function for loading generic Connection credentials from user:// as a [CredSaver] Resource
|
|
|
|
static func load_credentials(service : String):
|
|
|
|
|
|
|
|
if !FileAccess.file_exists("user://" + service + "_creds.res"):
|
|
|
|
|
|
|
|
DeckHolder.logger.log_system("No Credentials exist for " + service + " Service", Logger.LogType.WARN)
|
|
|
|
return null
|
|
|
|
|
|
|
|
|
|
|
|
var creds = ResourceLoader.load("user://" + service + "_creds.res")
|
|
|
|
|
|
|
|
if !creds is CredSaver:
|
|
|
|
|
|
|
|
DeckHolder.logger.log_system("Error loading Credentials for " + service + " Service", Logger.LogType.ERROR)
|
|
|
|
return null
|
|
|
|
|
|
|
|
|
|
|
|
return creds
|
|
|
|
|
|
|
|
|
|
|
|
## Temporary function for saving generic Connection credentials to user:// as a CredSaver
|
|
|
|
static func save_credentials(data : Dictionary, service: String):
|
|
|
|
|
|
|
|
var creds := CredSaver.new()
|
|
|
|
|
|
|
|
creds.data = data
|
|
|
|
|
|
|
|
var err = ResourceSaver.save(creds, "user://" + service + "_creds.res")
|
|
|
|
|
|
|
|
if err != OK:
|
|
|
|
|
|
|
|
DeckHolder.logger.log_system("Error saving Credentials for " + service + " Service", Logger.LogType.ERROR)
|
|
|
|
|
|
|
|
|