Пример #1
0
        //Hide join messages
        private void OnChannelJoin(ChannelJoinArgs argument)
        {
            argument.EatData = EatData.EatText;

            var userKey = argument.Channel.Server.Network + argument.Channel.Name + argument.User.Host;

            if (_userDatabase.ContainsKey(userKey))
            {
                //If the user was already in the data and has talked recently, announce they joined the channel
                var userData = _userDatabase[userKey];
                if (userData.TalkedRecently())
                {
                    argument.EatData = EatData.EatNone;
                }
                userData.Rejoined();
            }
            else
            {
                //If the user is new to us add it to the data
                var userData = new UserData {
                    Joined = DateTime.Now
                };

                _userDatabase.Add(userKey, userData);
            }
        }
Пример #2
0
        private void OnChannelJoin(ChannelJoinArgs argument)
        {
            if (!_joinTimes.ContainsKey(argument.User.Ident))
            {
                _joinTimes.Add(argument.User.Ident, DateTime.Now);
            }
            else
            {
                _joinTimes[argument.User.Ident] = DateTime.Now;
            }

            argument.EatData = EatData.EatText;
        }
Пример #3
0
        private async Task _onchatconnectevent_(RequestResponseModel msg)
        {
            //Step 3: Recieving this response means login and connect is successful
            lock (mutex)
            {
                isReady = true;
            }
            string          channelname = (string)msg.Payload["channel"];
            ChannelJoinArgs c           = new ChannelJoinArgs(channelname);
            Task            t           = Task.Run(() => OnChannelJoin?.Invoke(this, c));

            Debug.WriteLine($"[EVENT]Entered channel: {channelname}");
            await t;
        }
Пример #4
0
        private void OnChannelJoin(ChannelJoinArgs argument)
        {
            //Check if this event was fired on twitch, if not this plugin should
            //never touch it so fires an early return.
            if (!IsTwitchServer(argument.Channel.Server))
            {
                return;
            }

            var    server      = argument.Channel.Server;
            var    channelName = argument.Channel.Name;
            var    userName    = argument.Channel.Name.TrimStart('#');
            string topicData;

            //Check if this event fired on the client joining the channel or
            //someone else joining, we only need to set the topic of a channel
            //when we join a channel.
            if (argument.User.Nick != argument.Channel.Server.Nick)
            {
                return;
            }

            //TwitchApiTools connects to the web, disk or web IO is unreliable
            //so handle it in a try / catch block
            try
            {
                topicData = TwitchApiTools.GetSimpleChannelInformationByName(userName);
            }
            catch (Exception)
            {
                topicData = $"Twitch@AdiIRC: Could not find channel topic data for {userName}.";
            }

            //Finally set the topic title through a raw IRC message.
            var topicMessage = $":[email protected] TOPIC {channelName} :{topicData}";

            server.SendFakeRaw(topicMessage);
        }
Пример #5
0
 private void OnChannelJoin(ChannelJoinArgs argument)
 {
     argument.EatData = EatData.EatText;
 }