SendSysMessage() public method

public SendSysMessage ( string message ) : void
message string
return void
コード例 #1
0
ファイル: DelayManager.cs プロジェクト: shadobaker/RohBot
        public bool AddAndCheck(Connection connection, double cost)
        {
            lock (_delays)
            {
                double delay;
                if (!_delays.TryGetValue(connection.Address, out delay))
                {
                    if (cost > 0)
                    {
                        _delays.Add(connection.Address, Math.Min(cost, DelayLimit));
                    }
                }
                else
                {
                    _delays[connection.Address] = Math.Min(delay + cost, DelayLimit);
                }

                var shouldDelay = (delay + cost) >= DelayThreshold;

                if (shouldDelay)
                {
                    connection.SendSysMessage("Too many requests are coming from your location and your request has been canceled. Please wait and try again in a few minutes.");
                }

                return(shouldDelay);
            }
        }
コード例 #2
0
ファイル: Command.cs プロジェクト: shadobaker/RohBot
 public void Send(string message)
 {
     if (IsWeb)
     {
         Connection.SendSysMessage(message);
     }
     else if (IsRoom)
     {
         Room.Send(message);
     }
     else if (IsPrivateChat)
     {
         PrivateChat.Send(message);
     }
 }
コード例 #3
0
ファイル: DelayManager.cs プロジェクト: Naarkie/RohBot
        public bool AddAndCheck(Connection connection, double cost)
        {
            lock (_delays)
            {
                double delay;
                if (!_delays.TryGetValue(connection.Address, out delay))
                {
                    if (cost > 0)
                        _delays.Add(connection.Address, Math.Min(cost, DelayLimit));
                }
                else
                {
                    _delays[connection.Address] = Math.Min(delay + cost, DelayLimit);
                }

                var shouldDelay = (delay + cost) >= DelayThreshold;

                if (shouldDelay)
                    connection.SendSysMessage("Too many requests are coming from your location and your request has been canceled. Please wait and try again in a few minutes.");

                return shouldDelay;
            }
        }