public Form1() { InitializeComponent(); var chatCore = ChatCoreInstance.Create(); chatCore.OnLogReceived += (level, category, message) => Debug.WriteLine($"{level} | {category} | {message}"); _streamingService = chatCore.RunAllServices(); _twitchService = _streamingService.GetTwitchService(); _streamingService.OnLogin += StreamingService_OnLogin; _streamingService.OnTextMessageReceived += StreamServiceProvider_OnMessageReceived; _streamingService.OnJoinChannel += StreamServiceProvider_OnChannelJoined; _streamingService.OnLeaveChannel += StreamServiceProvider_OnLeaveChannel; _streamingService.OnRoomStateUpdated += StreamServiceProvider_OnChannelStateUpdated; //Console.WriteLine($"StreamService is of type {streamServiceProvider.ServiceType.Name}"); }
private void Awake() { this._chatCoreInstance = ChatCoreInstance.Create(); #if DEBUG this._chatCoreInstance.OnLogReceived += this._sc_OnLogReceived; #endif this._chatServiceMultiplexer = this._chatCoreInstance.RunAllServices(); this._chatServiceMultiplexer.OnJoinChannel += this.QueueOrSendOnJoinChannel; this._chatServiceMultiplexer.OnTextMessageReceived += this.QueueOrSendOnTextMessageReceived; this._chatServiceMultiplexer.OnChatCleared += this.QueueOrSendOnClearChat; this._chatServiceMultiplexer.OnMessageCleared += this.QueueOrSendOnClearMessage; this._chatServiceMultiplexer.OnChannelResourceDataCached += this.QueueOrSendOnChannelResourceDataCached; ChatImageProvider.TouchInstance(); _ = this.HandleOverflowMessageQueue(); BSEvents.lateMenuSceneLoadedFresh += this.BSEvents_menuSceneLoadedFresh; }
public static void Load() { ChatCoreInstance = ChatCore.ChatCoreInstance.Create(); streamingService = ChatCoreInstance.RunAllServices(); // Setup chat message callbacks streamingService.OnTextMessageReceived += (ChatCore.Interfaces.IChatService service, ChatCore.Interfaces.IChatMessage message) => { if (message.Message.Contains("!gm")) { commandChannel = message.Channel; } else { return; } TwitchMessage twitchMessage = message is TwitchMessage ? message as TwitchMessage : null; if (GameModifiersController.charges < 0) { GameModifiersController.charges = 0; } Plugin.twitchCommands.CheckChargeMessage(message); Plugin.twitchCommands.CheckConfigMessage(message); Plugin.twitchCommands.CheckStatusCommands(message); Plugin.twitchCommands.CheckInfoCommands(message); if (Config.allowEveryone || (Config.allowSubs && (twitchMessage?.Sender as TwitchUser).IsSubscriber) || (twitchMessage?.Sender).IsModerator) { if (GMPUI.chatIntegration && Plugin.isValidScene && !Plugin.cooldowns.GetCooldown("Global") && Plugin.twitchPluginInstalled) { GameModifiersController.commandsLeftForMessage = Config.commandsPerMessage; Plugin.twitchCommands.CheckMapSwapCommands(message); Plugin.twitchCommands.CheckRotationCommands(message); Plugin.twitchCommands.CheckSpeedCommands(message); Plugin.twitchCommands.CheckPauseMessage(message); Plugin.twitchCommands.CheckGameplayCommands(message); Plugin.twitchCommands.CheckHealthCommands(message); Plugin.twitchCommands.CheckSizeCommands(message); Plugin.twitchCommands.CheckGlobalCoolDown(); } } GameModifiersController.trySuper = false; GameModifiersController.sizeActivated = false; GameModifiersController.healthActivated = false; }; }
public void Init() { if (initialized) { return; } // create chat core instance _sc = ChatCoreInstance.Create(); // run twitch services _twitchService = _sc.RunTwitchServices(); _twitchService.OnTextMessageReceived += _services_OnTextMessageReceived; initialized = true; }
public static void StartChatService() { twitchChannel = Plugin.config.GetString("Twitch", "Channel", "TWITCH_NAME"); if (twitchChannel == "TWITCH_NAME") { Plugin.config.SetString("Twitch", "Channel", "TWITCH_NAME"); return; } unitySyncContext = SynchronizationContext.Current; var streamCore = ChatCoreInstance.Create(); streamingService = streamCore.RunAllServices(); twitchService = streamingService.GetTwitchService(); streamingService.OnLogin += StreamingService_OnLogin; streamingService.OnTextMessageReceived += StreamServiceProvider_OnMessageReceived; streamingService.OnJoinChannel += StreamServiceProvider_OnChannelJoined; streamingService.OnLeaveChannel += StreamServiceProvider_OnLeaveChannel; streamingService.OnRoomStateUpdated += StreamServiceProvider_OnChannelStateUpdated; //Console.WriteLine($"StreamService is of type {streamServiceProvider.ServiceType.Name}"); }
public ChatCoreHandler() { if (initialized) { return; } // create chat core instance // run twitch services try { var sc = ChatCoreInstance.Create(); _twitchService = ((ChatCoreInstance)sc).RunTwitchServices(); ((TwitchService)_twitchService).OnTextMessageReceived += _services_OnTextMessageReceived; } catch (Exception e) { Plugin.Log($"Exception was caught when trying to send bot message. {e.ToString()}"); } initialized = true; }
public CustomSinkProvider(ChatCoreInstance chatCoreInstance) { _chatCoreInstance = chatCoreInstance; }
public CustomSinkProvider(ChatCoreInstance sc) { _sc = sc; }