예제 #1
0
 public BotCommands()
 {
     foreach (Type f in Assembly.GetEntryAssembly().GetTypes())
     {
         if (typeof(BotCommand).IsAssignableFrom(f) && f != typeof(BotCommand))
         {
             // Create instance of type.
             BotCommand g = Activator.CreateInstance(f) as BotCommand;
             help.Add(g.HelpMenu);
             handlers.Add(g.Name, f);
         }
     }
     foreach (Type f in Assembly.GetExecutingAssembly().GetTypes())
     {
         if (typeof(BotCommand).IsAssignableFrom(f) && f != typeof(BotCommand))
         {
             // Create instance of type.
             BotCommand g = Activator.CreateInstance(f) as BotCommand;
             help.Add(g.HelpMenu);
             handlers.Add(g.Name, f);
         }
     }
     foreach (Type f in Assembly.GetEntryAssembly().GetTypes())
     {
         if (typeof(BotCommandSent).IsAssignableFrom(f) && f != typeof(BotCommandSent))
         {
             // Create instance of type.
             BotCommandSent g = Activator.CreateInstance(f) as BotCommandSent;
             help.Add(g.HelpMenu);
             sendhandlers.Add(g.Name, f);
         }
     }
     foreach (Type f in Assembly.GetExecutingAssembly().GetTypes())
     {
         if (typeof(BotCommandSent).IsAssignableFrom(f) && f != typeof(BotCommandSent))
         {
             // Create instance of type.
             BotCommandSent g = Activator.CreateInstance(f) as BotCommandSent;
             help.Add(g.HelpMenu);
             sendhandlers.Add(g.Name, f);
         }
     }
 }
예제 #2
0
        void skype_MessageStatus(ChatMessage pMessage, TChatMessageStatus Status)
        {
            MessageEvent messageevent = new MessageEvent(pMessage, Status);

            //Now, we shoot our shit here.
            if (Status == TChatMessageStatus.cmsSending)
            {
                try
                {
                    if (!MessageReceived.Invoke(this, messageevent))
                    {
                        Logger.Log(string.Format(Utils.XOR("ତୄଛ଻ହଲଔ଎ତ଍ଥହ଒ଢ଄େଠଳଽ଻ହଲୃ଎ତ଍ଥ଻଒ଢ଄େତଳଽ଻ହଲ୆ୂତ଍ଥମ଺ଜ଄େମଣଽ଻ହ଱ଐ଎ତ଍ଥଏ଒ଢ଄େ଒ଯଛ଻ହିଓୂତ଍ଦ଎଒ଢ଄େଖୄଛ଻ହରଃୂତ଍ଥୂ଒ଢ଄େହଙଛ଻ହ଱ଐ଎ତ଍ଥୁ଒ଢ଄େ଒ଯଛ଻ହ଴ଃୂତ଍ଦ୆଒ଢ଄େ଒ଯଛ଻ହିଇୂତ଍ଥ଍଒ଢ଄େ", 619580279), pMessage.Sender.Handle, pMessage.Body.ToString().Replace("\n", "")));
                        return;
                    }
                }
                catch { }
                Logger.LogMessage(string.Format(Utils.XOR("昪昕昔昏昶昭昌昌昛昼昮昽昙映昹晉是是晉昏昶昭昶昌昛昼昮昿昙映昹晉昫昕晉昏昶昭昪昈昛昼昮昢昚映昹晉昚昿昔昏昶昭昢昈昛昼昮昲昚映昹晉昪昿昔昏昶是昈昈昛昼昮昢昚映昹晉昮昕晉昏昶昮昔昌昛昼昮昋昙映昹晉昷是昔昏昶昫晁昈昛昼昭晉昙映昹晉昛昕昔昏昶映昲昈昛昼昭晍昙映昹晉昵是昔昏昶是昈昈昛昼昭晅", 1355376248), (pMessage.Chat.Topic == "" ? pMessage.Sender.FullName : pMessage.Chat.Topic), pMessage.Sender.Handle, pMessage.Body.ToString().Replace("\n", "")));
                //invoke all stuffs
                if (pMessage.Body == "" || pMessage.Body[0].ToString() != bot.CommandDelimiter || pMessage.Body.ToString() == bot.CommandDelimiter)
                {
                    //pMessage.Chat.SendMessage(InvalidMessage.Invoke(this, messageevent));
                    return;
                }
                //Check the incoming command against the existing command list.
                List <string> args = Utils.ParseParameters(pMessage.Body.ToString());
                if (args[0] == string.Format(Utils.XOR("嬡嬨嬜嬘嬾嬧嬾孅嬩嬤嬦嬧嬕嬧嬵孁嬧嬨嬜嬘嬾嬥孅孅嬩嬤嬦嬲嬽嬝嬵孁嬤嬸嬜嬘嬾嬡孍孍", 1244617584), bot.CommandDelimiter))
                {
                    //Execute defined help message.
                    try
                    {
                        pMessage.Chat.SendMessage(HelpMessage.Invoke(this, messageevent));
                    }
                    catch { }
                    for (int i = 0; i < commands.help.Count; i++)
                    {
                        pMessage.Chat.SendMessage(bot.CommandDelimiter + commands.help[i]);
                    }
                    return;
                }
                if (commands.sendhandlers.ContainsKey(string.Format("{0}", args[0].Substring(1))))
                {
                    Logger.Log(string.Format(Utils.XOR("", 132183750), pMessage.Sender.Handle, pMessage.Body.ToString().Replace("\n", "")));
                    //Create a new instance of the message handler.
                    new Thread(new ThreadStart(delegate()
                    {
                        BotCommandSent v = Activator.CreateInstance(commands.sendhandlers[args[0].Substring(1)]) as BotCommandSent;
                        if (v.NumberOfArgs + 1 != args.Count)
                        {
                            pMessage.Chat.SendMessage(bot.CommandDelimiter + "Usage: " + v.Usage); return;
                        }
                        string output = v.Handle(pMessage, args.ToArray());
                        if (output != null && output != "")
                        {
                            pMessage.Chat.SendMessage(output);
                        }
                    })).Start();
                    return;
                }
                else
                {
                    try
                    {
                        //Didn't do jack shit. Send help message invoke?
                        //pMessage.Chat.SendMessage(InvalidMessage.Invoke(this, messageevent));
                    }
                    catch { }
                }
            }
            if (Status == TChatMessageStatus.cmsReceived) //Make sure the message is receiving
            {
                try
                {
                    if (!MessageReceived.Invoke(this, messageevent))
                    {
                        Logger.Log(string.Format(Utils.XOR("ତୄଛ଻ହଲଔ଎ତ଍ଥହ଒ଢ଄େଠଳଽ଻ହଲୃ଎ତ଍ଥ଻଒ଢ଄େତଳଽ଻ହଲ୆ୂତ଍ଥମ଺ଜ଄େମଣଽ଻ହ଱ଐ଎ତ଍ଥଏ଒ଢ଄େ଒ଯଛ଻ହିଓୂତ଍ଦ଎଒ଢ଄େଖୄଛ଻ହରଃୂତ଍ଥୂ଒ଢ଄େହଙଛ଻ହ଱ଐ଎ତ଍ଥୁ଒ଢ଄େ଒ଯଛ଻ହ଴ଃୂତ଍ଦ୆଒ଢ଄େ଒ଯଛ଻ହିଇୂତ଍ଥ଍଒ଢ଄େ", 619580279), pMessage.Sender.Handle, pMessage.Body.ToString().Replace("\n", "")));
                        return;
                    }
                }
                catch { }
                Logger.LogMessage(string.Format(Utils.XOR("昪昕昔昏昶昭昌昌昛昼昮昽昙映昹晉是是晉昏昶昭昶昌昛昼昮昿昙映昹晉昫昕晉昏昶昭昪昈昛昼昮昢昚映昹晉昚昿昔昏昶昭昢昈昛昼昮昲昚映昹晉昪昿昔昏昶是昈昈昛昼昮昢昚映昹晉昮昕晉昏昶昮昔昌昛昼昮昋昙映昹晉昷是昔昏昶昫晁昈昛昼昭晉昙映昹晉昛昕昔昏昶映昲昈昛昼昭晍昙映昹晉昵是昔昏昶是昈昈昛昼昭晅", 1355376248), (pMessage.Chat.Topic == "" ? pMessage.Sender.FullName : pMessage.Chat.Topic), pMessage.Sender.Handle, pMessage.Body.ToString().Replace("\n", "")));
                //If the user is blocked then just f**k him up and ignore ALL shit.
                if (pMessage.Sender.IsBlocked)
                {
                    return;
                }
                //If the message sender is set to ignore, then just ignore the F**K outta him.
                if (Ignore.Contains(pMessage.Sender.Handle))
                {
                    try
                    {
                        pMessage.Chat.SendMessage(IgnoredMessage.Invoke(this, messageevent));
                    }
                    catch { }
                    return;
                }
                if (pMessage.Body[0].ToString() != bot.CommandDelimiter || pMessage.Body.ToString() == bot.CommandDelimiter)
                {
                    //pMessage.Chat.SendMessage(InvalidMessage.Invoke(this, messageevent));
                    return;
                }
                //Check the incoming command against the existing command list.
                List <string> args = Utils.ParseParameters(pMessage.Body.ToString());
                if (args[0] == string.Format(Utils.XOR("嬡嬨嬜嬘嬾嬧嬾孅嬩嬤嬦嬧嬕嬧嬵孁嬧嬨嬜嬘嬾嬥孅孅嬩嬤嬦嬲嬽嬝嬵孁嬤嬸嬜嬘嬾嬡孍孍", 1244617584), bot.CommandDelimiter))
                {
                    //Execute defined help message.
                    try
                    {
                        pMessage.Chat.SendMessage(HelpMessage.Invoke(this, messageevent));
                    }
                    catch { }
                    for (int i = 0; i < commands.help.Count; i++)
                    {
                        pMessage.Chat.SendMessage(bot.CommandDelimiter + commands.help[i]);
                    }
                    return;
                }
                if (commands.handlers.ContainsKey(string.Format("{0}", args[0].Substring(1))))
                {
                    Logger.Log(string.Format(Utils.XOR("", 132183750), pMessage.Sender.Handle, pMessage.Body.ToString().Replace("\n", "")));
                    //Create a new instance of the message handler.
                    new Thread(new ThreadStart(delegate()
                    {
                        BotCommand v = Activator.CreateInstance(commands.handlers[args[0].Substring(1)]) as BotCommand;
                        if (v.NumberOfArgs + 1 != args.Count)
                        {
                            pMessage.Chat.SendMessage(bot.CommandDelimiter + v.Usage); return;
                        }
                        string output = v.Handle(pMessage, args.ToArray());
                        if (output != null && output != "")
                        {
                            pMessage.Chat.SendMessage(output);
                        }
                    })).Start();
                    return;
                }
                else
                {
                    try
                    {
                        //Didn't do jack shit. Send help message invoke?
                        pMessage.Chat.SendMessage(InvalidMessage.Invoke(this, messageevent));
                    }
                    catch { }
                }
            }
        }