Inheritance: IrcUser, IIrcMessageSendHandler, IIrcMessageReceiveHandler, IIrcMessageReceiver
コード例 #1
0
ファイル: Program.cs プロジェクト: destinygg/bot
        private static void HandleEventLoop(IrcClient client)
        {
            _ircLocaluser = client.LocalUser;
              _hostNameToWebSockets.Add("", new WebSocketListenerClient(PrivateConstants.TestAccountWebsocketAuth));
              _hostNameToWebSockets[""].Run(sendToIrcProcessor);

              bool isExit = false;
              while (!isExit) {
            Console.Write("> ");
            var command = Console.ReadLine();
            switch (command) {
              case "exit":
            isExit = true;
            break;
              default:
            if (!string.IsNullOrEmpty(command)) {
              if (command.StartsWith("/") && command.Length > 1) {
                client.SendRawMessage(command.Substring(1));
              } else {
                Console.WriteLine($"Unknown command '{command}'");
              }
            }
            break;
            }
              }
              client.Disconnect();
        }
コード例 #2
0
 private void SendGreeting(IrcLocalUser localUser, IIrcMessageTarget target)
 {
     localUser.SendNotice(target, "This is the {0}, welcome.", ProgramInfo.AssemblyTitle);
     localUser.SendNotice(target, "Message me with '.help' for instructions on how to use me.");
     localUser.SendNotice(target, "Remember to log in via a private message and not via the channel.");
 }
コード例 #3
0
 /// <summary>
 /// </summary>
 /// <param name="localUser">
 /// </param>
 /// <param name="e">
 /// </param>
 protected abstract void OnLocalUserLeftChannel(IrcLocalUser localUser, IrcChannelEventArgs e);
コード例 #4
0
 public static void SendNotice(this IrcLocalUser localUser, IList <IIrcMessageTarget> targets, string format,
                               params object[] args)
 {
     localUser.SendNotice(targets, string.Format(format, args));
 }
コード例 #5
0
 protected virtual void OnLocalUserLeftChannel(IrcLocalUser localUser, IrcChannelEventArgs e)
 {
 }
コード例 #6
0
ファイル: IrcClient.cs プロジェクト: txdv/ircdotnet
 internal void SetLocalUserModes(IrcLocalUser user, string modes)
 {
     SendMessageUserMode(user.NickName, modes);
 }
コード例 #7
0
ファイル: IrcClient.cs プロジェクト: txdv/ircdotnet
 protected virtual void ResetState()
 {
     // Reset fully state of client.
     this.servers = new Collection<IrcServer>();
     this.isRegistered = false;
     this.localUser = null;
     this.serverSupportedFeatures = new Dictionary<string, string>();
     this.serverSupportedFeaturesReadOnly = new ReadOnlyDictionary<string, string>(this.serverSupportedFeatures);
     this.channelUserModes = new Collection<char>() {
         'o', 'v' };
     this.channelUserModesReadOnly = new ReadOnlyCollection<char>(this.channelUserModes);
     this.channelUserModesPrefixes = new Dictionary<char, char>() {
         { '@', 'o' }, { '+', 'v' } };
     this.motdBuilder = new StringBuilder();
     this.networkInformation = new IrcNetworkInfo();
     this.channels = new Collection<IrcChannel>();
     this.channelsReadOnly = new IrcChannelCollection(this, this.channels);
     this.users = new Collection<IrcUser>();
     this.usersReadOnly = new IrcUserCollection(this, this.users);
     this.listedChannels = new List<IrcChannelInfo>();
     this.listedServerLinks = new List<IrcServerInfo>();
     this.listedStatsEntries = new List<IrcServerStatisticalEntry>();
 }
コード例 #8
0
 protected override void OnLocalUserMessageReceived(IrcLocalUser localUser, IrcMessageEventArgs e)
 {
     //
 }
コード例 #9
0
ファイル: BotDeathmic.cs プロジェクト: Kolpa/DeathmicChatbot
        protected override void OnLocalUserJoinedChannel(IrcLocalUser localUser, IrcChannelEventArgs e)
        {
            thisclient.FloodPreventer = new IrcStandardFloodPreventer(2,4000);
            thisclient.WhoReplyReceived += UserListUpdate;
            if (xmlprovider.runningVotes().Count() > 0)
            {
                VoteTimer = new System.Timers.Timer(5000);
                VoteTimer.Elapsed += OnVoteTimerEvent;
                VoteTimer.Enabled = true;
            }
            //OnClientRegistered may happen before joined channel thus...
            _streamProviderManager = new StreamProviderManager();
            _streamProviderManager.StreamStarted += OnStreamStarted;
            _streamProviderManager.StreamStopped += OnStreamStopped;
            _streamProviderManager.StreamGlobalNotification += OnStreamGlobalNotification;
            _streamProviderManager.AddStreamProvider(new TwitchProvider());
            _streamProviderManager.AddStreamProvider(new HitboxProvider());
            //localUser.Client.WhoReplyReceived += WhoReplyReceived;

            if (reconnectimer != null)
            {
                reconnectimer.Dispose();
            }

            if (!debug)
            {
                reconnectimer = new System.Timers.Timer(150000);
            }
            else
            {
                reconnectimer = new System.Timers.Timer(240000);
            }
            reconnectimer.Elapsed += OnReconnectTimer;
            reconnectimer.Enabled = true;
        }
コード例 #10
0
ファイル: AzureBot.cs プロジェクト: bremnes/IrcBot
 protected override void OnLocalUserNoticeReceived(IrcLocalUser localUser, IrcMessageEventArgs e)
 {
     Trace.TraceInformation("OnLocalUserNoticeReceived: " + e.Text);
 }
コード例 #11
0
ファイル: AzureBot.cs プロジェクト: bremnes/IrcBot
 protected override void OnLocalUserMessageReceived(IrcLocalUser localUser, IrcMessageEventArgs e)
 {
     if (e.Source.Name != localUser.NickName)
         Trace.TraceInformation("OnLocalUserMessageReceived: " + e.Text);
 }
コード例 #12
0
ファイル: AzureBot.cs プロジェクト: bremnes/IrcBot
 protected override void OnLocalUserLeftChannel(IrcLocalUser localUser, IrcChannelEventArgs e)
 {
     Trace.TraceInformation("OnLocalUserLeftChannel");
 }
コード例 #13
0
ファイル: IrcClient.cs プロジェクト: carriercomm/TwitchIrc
        private void HandleClientConnected(IrcRegistrationInfo regInfo)
        {
            Logger.WriteLine("Connected to server at '{0}'.", TraceEventType.Verbose,((IPEndPoint)this.socket.RemoteEndPoint).Address);
            
            if (regInfo.Password != null)
                // Authenticate with server using password.
                SendMessagePassword(regInfo.Password);

            // Check if client is registering as service or normal user.
            if (regInfo is IrcServiceRegistrationInfo)
            {
                // Register client as service.
                var serviceRegInfo = (IrcServiceRegistrationInfo)regInfo;
                SendMessageService(serviceRegInfo.NickName, serviceRegInfo.Distribution,
                    serviceRegInfo.Description);

                this.localUser = new IrcLocalUser(serviceRegInfo.NickName, serviceRegInfo.Distribution,
                    serviceRegInfo.Description);
            }
            else
            {
                // Register client as normal user.
                var userRegInfo = (IrcUserRegistrationInfo)regInfo;
                SendMessageNick(userRegInfo.NickName);
                SendMessageUser(userRegInfo.UserName, GetNumericUserMode(userRegInfo.UserModes),
                    userRegInfo.RealName);

                this.localUser = new IrcLocalUser(userRegInfo.NickName, userRegInfo.UserName, userRegInfo.RealName,
                    userRegInfo.UserModes);
            }
            this.localUser.Client = this;

            // Add local user to list of known users.
            lock (((ICollection)this.usersReadOnly).SyncRoot)
                this.users.Add(this.localUser);

            OnConnected(new EventArgs());
        }
コード例 #14
0
ファイル: bot.cs プロジェクト: quiznilo/Zerobot
 protected override void OnLocalUserMessageReceived(IrcLocalUser localUser, IrcMessageEventArgs e)
 {
     //Console.WriteLine("{0}", e.Source.ToString());
 }
コード例 #15
0
ファイル: bot.cs プロジェクト: quiznilo/Zerobot
 protected override void OnLocalUserJoinedChannel(IrcLocalUser localUser, IrcChannelEventArgs e)
 {
 }
コード例 #16
0
 protected override void OnLocalUserLeftChannel(IrcLocalUser localUser, IrcChannelEventArgs e)
 {
     //
 }
コード例 #17
0
ファイル: IrcBot.cs プロジェクト: gkinsman/StatsBot
 protected abstract void OnLocalUserQuit(IrcLocalUser localUser, IrcCommentEventArgs e);
コード例 #18
0
ファイル: BotDeathmic.cs プロジェクト: Kolpa/DeathmicChatbot
 protected override void OnLocalUserMessageReceived(IrcLocalUser localUser, IrcMessageEventArgs e)
 {
     ReconnectInbound = false;
 }
コード例 #19
0
ファイル: IrcClient.cs プロジェクト: txdv/ircdotnet
        protected virtual void HandleClientConnected(IrcRegistrationInfo regInfo)
        {
            if (regInfo.Password != null)
                // Authenticate with server using password.
                SendMessagePassword(regInfo.Password);

            // Check if client is registering as service or normal user.
            if (regInfo is IrcServiceRegistrationInfo)
            {
                // Register client as service.
                var serviceRegInfo = (IrcServiceRegistrationInfo)regInfo;
                SendMessageService(serviceRegInfo.NickName, serviceRegInfo.Distribution,
                    serviceRegInfo.Description);

                this.localUser = new IrcLocalUser(serviceRegInfo.NickName, serviceRegInfo.Distribution,
                    serviceRegInfo.Description);
            }
            else
            {
                // Register client as normal user.
                var userRegInfo = (IrcUserRegistrationInfo)regInfo;
                SendMessageNick(userRegInfo.NickName);
                SendMessageUser(userRegInfo.UserName, GetNumericUserMode(userRegInfo.UserModes),
                    userRegInfo.RealName);

                this.localUser = new IrcLocalUser(userRegInfo.NickName, userRegInfo.UserName, userRegInfo.RealName,
                    userRegInfo.UserModes);
            }
            this.localUser.Client = this;

            // Add local user to list of known users.
            lock (((ICollection)this.usersReadOnly).SyncRoot)
                this.users.Add(this.localUser);

            OnConnected(new EventArgs());
        }
コード例 #20
0
ファイル: IrcBot.cs プロジェクト: IrcDotNet/IrcDotNet
 protected virtual void OnLocalUserLeftChannel(IrcLocalUser localUser, IrcChannelEventArgs e)
 {
 }
コード例 #21
0
ファイル: IrcClient.cs プロジェクト: txdv/ircdotnet
 internal void GetLocalUserModes(IrcLocalUser user)
 {
     SendMessageUserMode(user.NickName);
 }
コード例 #22
0
ファイル: IrcBot.cs プロジェクト: IrcDotNet/IrcDotNet
 protected virtual void OnLocalUserNoticeReceived(IrcLocalUser localUser, IrcMessageEventArgs e)
 {
 }
コード例 #23
0
ファイル: IrcBot.cs プロジェクト: koushikajay/Alfred
 private void SubscribeToRegisteredClientEvents(IrcLocalUser user)
 {
     user.JoinedChannel += OnJoinedChannel;
     user.MessageReceived += OnMessageReceived;
 }
コード例 #24
0
ファイル: StatsBot.cs プロジェクト: gkinsman/StatsBot
 protected override void OnLocalUserJoinedChannel(IrcLocalUser localUser, IrcChannelEventArgs e)
 {
     ChannelsToRejoin.Add(e.Channel.Name);
 }
コード例 #25
0
 protected virtual void OnLocalUserMessageReceived(IrcLocalUser localUser, IrcMessageEventArgs e)
 {
 }
コード例 #26
0
ファイル: StatsBot.cs プロジェクト: gkinsman/StatsBot
 protected override void OnLocalUserLeftChannel(IrcLocalUser localUser, IrcChannelEventArgs e)
 {
     if(AutoRejoin) {
         localUser.Client.Channels.Join(e.Channel.Name);
     }
 }
コード例 #27
0
 public static void SendMessage(this IrcLocalUser localUser, IIrcMessageTarget target, string format,
                                params object[] args)
 {
     SendMessage(localUser, new[] { target }, format, args);
 }
コード例 #28
0
ファイル: StatsBot.cs プロジェクト: gkinsman/StatsBot
 protected override void OnLocalUserQuit(IrcLocalUser localUser, IrcCommentEventArgs e)
 {
     Console.WriteLine("Quit: {0}",e.Comment);
 }
コード例 #29
0
 /// <summary>
 /// </summary>
 /// <param name="localUser">
 /// </param>
 /// <param name="e">
 /// </param>
 protected abstract void OnLocalUserNoticeReceived(IrcLocalUser localUser, IrcMessageEventArgs e);
コード例 #30
0
 private void SendGreeting(IrcLocalUser localUser, IIrcMessageTarget target)
 {
     localUser.SendNotice(target, "This is the {0}, welcome.", ProgramInfo.AssemblyTitle);
     localUser.SendNotice(target, "Message me with '.help' for instructions on how to use me.");
     localUser.SendNotice(target, "Remember to log in via a private message and not via the channel.");
 }
コード例 #31
0
 protected override void OnLocalUserJoinedChannel(IrcLocalUser localUser, IrcChannelEventArgs e)
 {
     SendGreeting(localUser, e.Channel);
 }
コード例 #32
0
 protected override void OnLocalUserJoinedChannel(IrcLocalUser localUser, IrcChannelEventArgs e)
 {
     SendGreeting(localUser, e.Channel);
 }
コード例 #33
0
 protected override void OnLocalUserMessageReceived(IrcLocalUser localUser, IrcMessageEventArgs e)
 {
     //
 }
コード例 #34
0
 protected override void OnLocalUserLeftChannel(IrcLocalUser localUser, IrcChannelEventArgs e)
 {
     //
 }