Beispiel #1
0
 private void ShutdownTimer_Tick(object sender, ElapsedEventArgs eArgs)
 {
     try
     {
         numberOfTicks++;
         if (numberOfTicks < numberOfMinutes)
         {
             if (numberOfTicks == 4)
             {
                 TheTCPWrapper.Send(CommandCreator.RAW_TEXT("#GM *** Warning! You have " + (numberOfMinutes - numberOfTicks) + " minute of trade time remaining."));
             }
             else
             {
                 TheTCPWrapper.Send(CommandCreator.RAW_TEXT("#GM *** You have " + (numberOfMinutes - numberOfTicks) + " minutes of trade time remaining."));
             }
         }
         else
         {
             //                TheTCPWrapper.Send(CommandCreator.RAW_TEXT("#GM *** I should be logged off now, I've been on for " + numberOfTicks + " minutes!"));
             //                TheTCPWrapper.Send(CommandCreator.RAW_TEXT("#gm ### SHUTTING DOWN UNTIL NEEDED AGAIN ###"));
             TheMessageParser.FakePM("Console:\\>", "#say #gm ### SHUTTING DOWN UNTIL NEEDED AGAIN ###");
             TheMySqlManager.ImLoggedOut(Settings.botid);
             //                System.Environment.Exit(0);
             return;
         }
     }
     catch (Exception exception)
     {
         TheErrorHandler.writeErrorMessage("Exception raised in the shutdown handler timer..." + exception);
     }
     finally
     { }
 }
Beispiel #2
0
        private void OnGotPM(object sender, BasicCommunication.MessageParser.Got_PM_EventArgs e)
        {
            string Message = e.Message.ToLower().Replace("\'", "\\\'").Replace("\"", "\\\"");

            if (Message[0] != '#')
            {
                Message = "#" + Message;
            }

            string[] CommandArray = Message.Split(' ');

            if (CommandArray[0] == "#quit" || CommandArray[0] == "#exit" || CommandArray[0] == "#shutdown")
            {
                bool disabled = TheMySqlManager.CheckIfCommandIsDisabled("#quit", Settings.botid);

                if (disabled == true)
                {
                    TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, "This command is disabled"));
                    return;
                }

                if (TheMySqlManager.GetUserRank(e.username, Settings.botid) < TheMySqlManager.GetCommandRank("#quit", Settings.botid))
                {
                    TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, "You are not authorized to use this command!"));
                    return;
                }
                //if (TheTradeHandler.AmITrading())
                //{
                //    TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, "I am currently trading, please retry shortly."));
                //    return;
                //}

                //shut the bot down here
                //TheMessageParser.FakePM("Console:\\>", "#say  Returning to my slumber...  Wake me at your own risk!");
                //                TheTCPWrapper.Send(CommandCreator.RAW_TEXT("#gm ### SHUTTING DOWN UNTIL NEEDED AGAIN ###"));
                TheMessageParser.FakePM("Console:\\>", "#say #gm ### SHUTTING DOWN UNTIL NEEDED AGAIN ###");
                TheMySqlManager.ImLoggedOut(Settings.botid);
                return;
            }
        }