Пример #1
0
 private void Events_ChannelMessageEvent(BotShell bot, ChannelMessageArgs e)
 {
     if (this.AutoAFK)
     {
         if (e.Message.ToLower().StartsWith("afk"))
         {
             lock (this.Afk)
             {
                 if (this.Afk.ContainsKey(e.Sender))
                 {
                     this.Afk.Remove(e.Sender);
                     bot.SendOrganizationMessage(bot.ColorHighlight + e.Sender + " is back");
                 }
                 else
                 {
                     this.Afk.Add(e.Sender, "AFK");
                     bot.SendOrganizationMessage(bot.ColorHighlight + e.Sender + " is afk.");
                 }
             }
             return;
         }
     }
     if (e.Command)
     {
         return;
     }
     this.RemoveAfk(bot, e.Sender);
 }
Пример #2
0
 void Events_BotStateChangedEvent(BotShell bot, BotStateChangedArgs e)
 {
     if (e.State == 0)
     {
         bot.SendOrganizationMessage(bot.ColorHighlight + bot.Character + " has connected!");
     }
 }
Пример #3
0
 private void Events_ChannelJoinEvent(BotShell bot, ChannelJoinEventArgs e)
 {
     //Console.WriteLine("Joining channel: " + e.GroupType.ToString());
     if (e.GroupType == ChannelType.Organization)
     {
         bot.SendOrganizationMessage(bot.ColorHighlight + "System »» Online");
     }
 }
Пример #4
0
 public void SendEverywhere(string output)
 {
     _bot.SendPrivateChannelMessage(output);
     if (_bot.InOrganization)
     {
         _bot.SendOrganizationMessage(output);
     }
     return;
 }
Пример #5
0
 private void sendMessage(BotShell bot, string message)
 {
     if (this._sendpg)
     {
         bot.SendPrivateChannelMessage(bot.ColorHighlight + message);
     }
     if (this._sendgc)
     {
         bot.SendOrganizationMessage(bot.ColorHighlight + message);
     }
 }
Пример #6
0
 private void SendMessage(BotShell bot, string target, string message)
 {
     if (target == "gc")
     {
         bot.SendOrganizationMessage(message);
     }
     if (target == "pg")
     {
         bot.SendPrivateChannelMessage(message);
     }
 }
Пример #7
0
 private void RemoveAfk(BotShell bot, string user)
 {
     lock (this.Afk)
     {
         if (!this.Afk.ContainsKey(user))
         {
             return;
         }
         this.Afk.Remove(user);
         bot.SendPrivateChannelMessage(bot.ColorHighlight + user + " is back");
         bot.SendOrganizationMessage(bot.ColorHighlight + user + " is back");
     }
 }
Пример #8
0
        public override void OnCommand(BotShell bot, CommandArgs e)
        {
            // make !status display various stats of the bot and the current state of all slaves and their friendslists, also include links to relog etc
            switch (e.Command)
            {
            case "shutdown":
                bot.SendOrganizationMessage(bot.ColorHighlight + "System »» Shutting Down");
                bot.SendPrivateMessage(e.SenderID, bot.ColorHighlight + "System »» Shutting Down", AoLib.Net.PacketQueue.Priority.Urgent, true);
                bot.SendPrivateChannelMessage(bot.ColorHighlight + "System »» Shutting Down");
                System.Threading.Thread.Sleep(1000);
                bot.Shutdown();
                break;

            case "restart":
                if (!bot.CoreConnected)
                {
                    bot.SendReply(e, "Restart is not available");
                    return;
                }
                bot.SendOrganizationMessage(bot.ColorHighlight + "System »» Rebooting");
                bot.SendPrivateMessage(e.SenderID, bot.ColorHighlight + "System »» Rebooting", AoLib.Net.PacketQueue.Priority.Urgent, true);
                bot.SendPrivateChannelMessage(bot.ColorHighlight + "System »» Rebooting");
                System.Threading.Thread.Sleep(1000);
                bot.Restart();
                break;

            case "core":
                this.OnCoreCommand(bot, e);
                break;

            case "core shutdown":
            case "core start":
            case "core restart":
                if (e.Args.Length < 1 || !e.Args[0].Contains("@"))
                {
                    bot.SendReply(e, "Usage: " + e.Command + " [bot@dimension]");
                    return;
                }
                if (!bot.Master)
                {
                    bot.SendReply(e, "This bot is not a master bot");
                    return;
                }
                CoreCommand command;
                if (e.Command == "core shutdown")
                {
                    command = CoreCommand.Shutdown;
                }
                else if (e.Command == "core start")
                {
                    command = CoreCommand.Start;
                }
                else
                {
                    command = CoreCommand.Restart;
                }
                MessageResult result = bot.SendCoreMessage(this.InternalName, e.Args[0].ToLower(), command);
                switch (result)
                {
                case MessageResult.Success:
                    bot.SendReply(e, "Your command has been relayed to the core and will be executed shortly");
                    break;

                case MessageResult.InvalidTarget:
                    bot.SendReply(e, "The target you specified appeared to be invalid");
                    break;

                case MessageResult.NotConnected:
                    bot.SendReply(e, "Unable to connect to the core in order to issue this command");
                    break;

                default:
                    bot.SendReply(e, "An unknown error prevented your command from being executed");
                    break;
                }
                break;

            case "core clean":
                bot.Clean();
                bot.SendReply(e, "Memory cleaning routines have been executed");
                break;
            }
        }