Example #1
0
        private void Initialize()
        {
            string                  payload = $"@badge-info=subscriber/1;badges=moderator/1,subscriber/0;client-nonce=60576a3018294221da54321a7397db58;color=;display-name=francoe1;emotes=;first-msg=0;flags=;id=9e4e255d-3c8d-4cdb-88ca-62ab7a3c37a9;mod=1;room-id=130747120;subscriber=1;tmi-sent-ts=1635094303777;turbo=0;user-id=147383910;user-type=mod :[email protected] PRIVMSG #rhomita :{COMMAND_NAME} {COMMAND_PARAMS}";
            TwitchInputLine         command = new TwitchInputLine(payload, COMMAND_PREFIX);
            TwitchChatMessageParser message = new TwitchChatMessageParser(command);

            _command = new TwitchChatCommand(message.User, message.Sent, message.Bits, message.Id);
            _handler = new TwitchCommandHandler(COMMAND_PREFIX);
        }
Example #2
0
        private void Start()
        {
            _twitchCommanHandler = new TwitchCommandHandler(TwitchChatClient.instance.CommandPrefix);

            TwitchChatClient.instance.Init(() =>
            {
                TwitchChatClient.instance.onChatMessageReceived += OnChatMessageReceived;
                TwitchChatClient.instance.onChatCommandReceived += (e) => _twitchCommanHandler.ProcessCommand(e);
                TwitchChatClient.instance.onChatRewardReceived  += OnChatRewardReceived;

                MatchManager.instance.onMatchEnd   += OnMatchEnd;
                MatchManager.instance.onMatchBegin += OnMatchBegin;
            }, Debug.LogError);

            _twitchCommanHandler.Register <HLAPI.TwitchCommandEmpty>("start", OnStart);
            _twitchCommanHandler.Register <TwitchCommandEmpty>("move", OnMove);
        }