Пример #1
0
        internal static TwitchChatEvent Parse(ITwitchFactory factory, string chatEventCommand)
        {
            string command;

            // TODO, support Mod events -- e.g. :jtv MODE #hardlysober +o arbedii

            if(chatEventCommand.StartsWith("PING")) {
                command = "PING";
            } else {
                command = chatEventCommand.GetBetween(" ", " ");
            }

            if(command.Equals("PRIVMSG")) {
                TwitchChannel channel = ParseChannel(factory, chatEventCommand);
                TwitchUser user = ParseUser(factory, chatEventCommand);
                string message = chatEventCommand.GetAfter("#" + channel.user.userName + " :");

                return new TwitchChatMessage(channel, user, message);
            } else if(command.Equals("WHISPER")) {
                TwitchUser user = ParseUser(factory, chatEventCommand);
                string message = chatEventCommand.GetAfter(" :");

                return new TwitchChatWhisper(user, message);
            } else if(command.Equals("PING")) {
                return new TwitchChatPing();
            } else {
                return new TwitchChatUnknownEvent(chatEventCommand);
            }
        }
        public TwitchIrcConnection(ITwitchFactory factory, TwitchBot bot, bool whisperServer)
        {
            this.factory       = factory;
            this.bot           = bot;
            this.whisperServer = whisperServer;

            Reconnect();
        }
        public TwitchIrcConnection(ITwitchFactory factory, TwitchBot bot, bool whisperServer)
        {
            this.factory = factory;
            this.bot = bot;
            this.whisperServer = whisperServer;

            Reconnect();
        }
Пример #4
0
        public TwitchChatRoom(ITwitchFactory factory, TwitchIrcConnection chatConnection,
			 TwitchIrcConnection whisperConnection, TwitchConnection twitchConnection)
        {
            this.factory = factory;
            this.chatIrcConnection = chatConnection;
            this.whisperIrcConnection = whisperConnection;
            this.twitchConnection = twitchConnection;
            this.pointManager = new ChannelPointManager(factory, twitchConnection.channel);

            chatConnection.Join(this);

            TypeHelpers.InstantiateEachSubclass<IAutoJoinTwitchRooms, TwitchChatRoom>(this);
        }
Пример #5
0
        public TwitchChatRoom(ITwitchFactory factory, TwitchIrcConnection chatConnection,
                              TwitchIrcConnection whisperConnection, TwitchConnection twitchConnection)
        {
            this.factory              = factory;
            this.chatIrcConnection    = chatConnection;
            this.whisperIrcConnection = whisperConnection;
            this.twitchConnection     = twitchConnection;
            this.pointManager         = new ChannelPointManager(factory, twitchConnection.channel);

            chatConnection.Join(this);

            TypeHelpers.InstantiateEachSubclass <IAutoJoinTwitchRooms, TwitchChatRoom>(this);
        }
Пример #6
0
        internal static TwitchChatEvent Parse(ITwitchFactory factory, string chatEventCommand)
        {
            string command;

            // TODO, support Mod events -- e.g. :jtv MODE #hardlysober +o arbedii

            if (chatEventCommand.StartsWith("PING"))
            {
                command = "PING";
            }
            else
            {
                command = chatEventCommand.GetBetween(" ", " ");
            }

            if (command.Equals("PRIVMSG"))
            {
                TwitchChannel channel = ParseChannel(factory, chatEventCommand);
                TwitchUser    user    = ParseUser(factory, chatEventCommand);
                string        message = chatEventCommand.GetAfter("#" + channel.user.userName + " :");

                return(new TwitchChatMessage(channel, user, message));
            }
            else if (command.Equals("WHISPER"))
            {
                TwitchUser user    = ParseUser(factory, chatEventCommand);
                string     message = chatEventCommand.GetAfter(" :");

                return(new TwitchChatWhisper(user, message));
            }
            else if (command.Equals("PING"))
            {
                return(new TwitchChatPing());
            }
            else
            {
                return(new TwitchChatUnknownEvent(chatEventCommand));
            }
        }
Пример #7
0
 public TwitchApi(ITwitchFactory factory)
 {
     this.factory = factory;
     twitchJson = new TwitchJson(factory);
 }
Пример #8
0
 public TwitchApi(ITwitchFactory factory)
 {
     this.factory = factory;
     twitchJson   = new TwitchJson(factory);
 }
 public ChannelPointManager(ITwitchFactory factory, TwitchChannel channel)
 {
     this.factory = factory;
     this.channel = channel;
     units        = LoadUnits(channel);
 }
Пример #10
0
 private static TwitchChannel ParseChannel(ITwitchFactory factory, string chatEventCommand)
 {
     return(factory.GetChannel(factory.GetUserFromName(chatEventCommand.GetBetween(" #", " "))));
 }
Пример #11
0
 private static TwitchUser ParseUser(ITwitchFactory factory, string chatEventCommand)
 {
     return(factory.GetUserFromName(chatEventCommand.GetBetween(":", "!")));
 }
Пример #12
0
 public TwitchUserPointManager(ITwitchFactory factory, TwitchChannel channel, TwitchUser user)
 {
     sqlPoints = factory.GetUserPoints(user, channel);
 }
 public ChannelPointManager(ITwitchFactory factory, TwitchChannel channel)
 {
     this.factory = factory;
     this.channel = channel;
     units = LoadUnits(channel);
 }
Пример #14
0
 public TwitchChatBot(ITwitchFactory factory)
 {
     this.factory = factory;
 }
Пример #15
0
 public TwitchJson(ITwitchFactory factory)
 {
     this.factory = factory;
 }
Пример #16
0
 private static TwitchChannel ParseChannel(ITwitchFactory factory, string chatEventCommand)
 {
     return factory.GetChannel(factory.GetUserFromName(chatEventCommand.GetBetween(" #", " ")));
 }
Пример #17
0
 private static TwitchUser ParseUser(ITwitchFactory factory, string chatEventCommand)
 {
     return factory.GetUserFromName(chatEventCommand.GetBetween(":", "!"));
 }
Пример #18
0
 public Twitch(ITwitchFactory factory)
 {
     this.factory = factory;
     twitchApi    = new TwitchApi(factory);
 }
 public TwitchUserPointManager(ITwitchFactory factory, TwitchChannel channel, TwitchUser user)
 {
     sqlPoints = factory.GetUserPoints(user, channel);
 }
Пример #20
0
 public TwitchJson(ITwitchFactory factory)
 {
     this.factory = factory;
 }