Exemple #1
0
 public List<ChatReply> RunPrivateCommand(string[] args, SteamKit2.SteamFriends.FriendMsgCallback callback)
 {
     List<ChatReply> chatreply = new List<ChatReply>();
     if (Program.suClaimed == false)
     {
         if (args.Length == 2)
         {
             if (args[1] == Program.suClaimCode)
             {
                 Program.users[callback.Sender].perms = 9001;
                 Program.suClaimed = true;
                 Console.WriteLine("Superuser permissions claimed by {0}. If you want to revert this, remove the file users.pch in your %APPDATA%/PCMR-Bot folder", callback.Sender);
             }
         }
         else
         {
             chatreply.Add(new ChatReply(callback.Sender, "Invalid arguments. Usage: claimsu <code>"));
         }
     }
     else
     {
         chatreply.Add(new ChatReply(callback.Sender, "Superuser already claimed"));
     }
     return chatreply;
 }
Exemple #2
0
 public List<ChatReply> RunGroupCommand(string[] args, SteamKit2.SteamFriends.ChatMsgCallback callback)
 {
     List<ChatReply> chatreply = new List<ChatReply>();
     chatreply.Add(new ChatReply(ChatReply.ECommandType.Save));
     chatreply.Add(new ChatReply(callback.ChatterID, "The dictionary of users has been sucessfully saved."));
     return chatreply;
 }
Exemple #3
0
 public List<ChatReply> RunGroupCommand(string[] args, SteamKit2.SteamFriends.ChatMsgCallback callback)
 {
     List<ChatReply> chatreply = new List<ChatReply>();
         if (args.Length == 0)
         {
             chatreply.Add(new ChatReply(callback.ChatterID, "You must give a name."));
         }
         else {
             kickMsg.Append(args[1] + "3276b04755a7e48f50b9bf9db9a79932");
             if (args.Length >= 2)
             {
                 for (int i = 2; i <= args.Length-1; i++)
                 {
                    kickMsg.Append(args[i]);
                     if (i != args.Length -1)
                    {
                        kickMsg.Append("3276b04755a7e48f50b9bf9db9a79932");
                    }
                 }
             }
             finalkickMsg = kickMsg.ToString();
             finalkickMsg = finalkickMsg.Replace("3276b04755a7e48f50b9bf9db9a79932", " ");
         }
     chatreply.Add(new ChatReply(finalkickMsg, ChatReply.ECommandType.Nick));
     chatreply.Add(new ChatReply(callback.ChatterID, "Nickname changed to: " + finalkickMsg));
     finalkickMsg = string.Empty;
     kickMsg.Length = 0;
     return chatreply;
 }
Exemple #4
0
        public List<ChatReply> RunGroupCommand(string[] args, SteamKit2.SteamFriends.ChatMsgCallback callback)
        {
            List<ChatReply> chatreply = new List<ChatReply>();
            if (args.Length < 2)
            {
                chatreply.Add(new ChatReply(callback.ChatterID, "This command requires 2 arguments"));
                return chatreply;
            }
            foreach (IGroupCommand c in GroupCommands.commands)
            {
                if (args[2] == c.GetType().Name)
                {
                    try
                    {
                        Program.groups[callback.ChatRoomID].commands.Add(args[1], c);
                        chatreply.Add(new ChatReply(callback.ChatterID, string.Format("Command {0} will now trigger when {1}{2} is said", c, Program.groups[callback.ChatRoomID].gcp.prefix, args[1])));
                    }
                    catch (System.ArgumentException)
                    {
                        chatreply.Add(new ChatReply(callback.ChatterID, string.Format("{0} is already bound to {1}", args[1], Program.groups[callback.ChatRoomID].commands[args[1]].GetType())));
                    }
                }
            }
            if (chatreply.Count==0){
                chatreply.Add(new ChatReply(callback.ChatterID, string.Format("Couldn't bind {0} to {1} (Does {0} exist? Use {2}GetBindableCommands", args[2], args [1], Program.groups[callback.ChatRoomID].gcp.prefix)));
            }

            //Program.groups[callback.ChatRoomID].commands.Add(args[1], cmd);
            return chatreply;
        }
Exemple #5
0
 void Events_OnChatMsgCallback(SteamKit2.SteamFriends.ChatMsgCallback msg)
 {
     try
     {
         if (msg.Message.StartsWith("sb bmath") && msg.Message.Split(' ').Length > 3)
         {
             string[] args = msg.Message.Split(' ');
             string[] mathArgs = new string[args.Length - 2];
             Array.Copy(args, 2, mathArgs, 0, args.Length - 2);
             string math = string.Join("", mathArgs);
             math = math.Replace("as", "=").Replace("in", "="); //turns 1USD as EUR into 1USD=EUR, or 1GB in KB into 1GB=KB
             JObject json = JObject.Parse(new WebClient().DownloadString("http://www.google.com/ig/calculator?hl=en&q=" + System.Uri.EscapeDataString(math)));
             if (!string.IsNullOrWhiteSpace((string)json["error"]) && (string)json["error"] != "0")
                 discord.core.Discord.SendChatMessage(msg.ChatRoomID, "Cannot compute!");
             discord.core.Discord.SendChatMessage(msg.ChatRoomID, json["lhs"] + " = " + json["rhs"]);
         }
     }
     catch (Exception e)
     {
         Console.WriteLine(e.Message);
         Console.WriteLine(e.Source);
         Console.WriteLine(e.StackTrace);
         // Woops.
     }
 }
 void Events_OnChatMsgCallbaack(SteamKit2.SteamFriends.ChatMsgCallback msg)
 {
     try
     {
         string[] words = msg.Message.Split(' ');
         foreach (string word in words)
         {
             if (word.Length == 32)
             {
                 if (word.ToCharArray().Any(c => !"0123456789abcdefABCDEF".Contains(c)))
                 {
                     string lookup = core.Discord.DoClassicQuery("SELECT `Word` FROM  `HashMap` WHERE  `Hash` =  '"+ core.Discord.MySQLEscape(word) +"' LIMIT 0 , 30");
                     if (lookup != ",")
                     {
                         core.Discord.SendChatMessage(msg.ChatRoomID,string.Format("Hash {0} is MD5(\"{1}\")",word,lookup.Substring(0,lookup.Length-1)));
                     }
                 }
             }
         }
     }
     catch
     {
         // Woops.
     }
 }
Exemple #7
0
 void Events_OnChatMsgCallback(SteamKit2.SteamFriends.ChatMsgCallback msg)
 {
     try
     {
         if (msg.Message.StartsWith("sb bmath") && msg.Message.Split(' ').Length > 3)
         {
             string[] args = msg.Message.Split(' ');
             string[] mathArgs = new string[args.Length - 2];
             Array.Copy(args, 2, mathArgs, 0, args.Length - 2);
             string math = string.Join("", mathArgs);
             math = math.Replace("as", "=").Replace("in", "=").Replace("to", "="); //turns 1USD as EUR into 1USD=EUR, 1GB in KB to 1GB=KB, etc
             JObject json = JObject.Parse(
                 System.Text.RegularExpressions.Regex.Unescape( //Gets rid of the \x26 which kills the JSON parser
                     new WebClient().DownloadString("http://www.google.com/ig/calculator?hl=en&q=" + System.Uri.EscapeDataString(math))
                     )
             );
             if (!string.IsNullOrWhiteSpace((string)json["error"]) && (string)json["error"] != "0")
                 discord.core.Discord.SendChatMessage(msg.ChatRoomID, "Cannot compute!");
             else
                 discord.core.Discord.SendChatMessage(msg.ChatRoomID, json["lhs"] + " = " + System.Net.WebUtility.HtmlDecode(json["rhs"])); //Unescapes the html entities, without a reference to System.Web
         }
     }
     catch (Exception e)
     {
         Console.WriteLine(e.Message);
         Console.WriteLine(e.Source);
         Console.WriteLine(e.StackTrace);
         // Woops.
     }
 }
Exemple #8
0
 public List<ChatReply> RunGroupCommand(string[] args, SteamKit2.SteamFriends.ChatMsgCallback callback)
 {
     List<ChatReply> chatreply = new List<ChatReply>();
     SteamID[] matches = Program.groups[callback.ChatRoomID].MatchNick(args[1]);
     if (matches.Length == 1)
     {
         if (args.Length == 1)
         {
             finalkickMsg = "misbehaviour in the chatroom"; }
         else {
             //kickMsg.Append(args[2] + "3276b04755a7e48f50b9bf9db9a79932");
             if (args.Length >= 3)
             {
                 for (int i = 3; i <= args.Length-1; i++)
                 {
                    kickMsg.Append(args[i]);
                     if (i != args.Length -1)
                    {
                        kickMsg.Append("3276b04755a7e48f50b9bf9db9a79932");
                    }
                 }
             }
             finalkickMsg = kickMsg.ToString();
             finalkickMsg = finalkickMsg.Replace("3276b04755a7e48f50b9bf9db9a79932", " ");
         }
         chatreply.Add(new ChatReply(matches[0], "You have been kicked for '" + finalkickMsg + "'."));
         chatreply.Add(new ChatReply(callback.ChatRoomID, ChatReply.ECommandType.Kick, matches[0]));
     }
     else { chatreply.Add(new ChatReply(callback.ChatRoomID, "Could not find user, try being more specific?")); }
     finalkickMsg = string.Empty;
     kickMsg.Length = 0;
     return chatreply;
 }
Exemple #9
0
 public List<ChatReply> RunGroupCommand(string[] args, SteamKit2.SteamFriends.ChatMsgCallback callback)
 {
     List<ChatReply> chatreply = new List<ChatReply>();
     if (args.Length == 1)
     {
         if (GroupChatProperties.suClaimed == true)
         {
             chatreply.Add(new ChatReply(callback.ChatterID, "SuperUser has already been claimed."));
         }
         else
         {
             chatreply.Add(new ChatReply(callback.ChatterID, "Check the console for your code."));
             Console.WriteLine("Your ClaimSU code is: " + code);
         }
     }
     else
     {
         if (Int32.Parse(args[1]) == code)
         {
             GroupChatProperties.suClaimed = true;
             Program.groups[callback.ChatRoomID].users[callback.ChatterID].perms = 9001;
             chatreply.Add(new ChatReply(callback.ChatterID, "You are the new superuser."));
         }
         else { chatreply.Add(new ChatReply(callback.ChatterID, "Your code is incorrect.")); }
     }
     return chatreply;
 }
Exemple #10
0
        public List<ChatReply> RunPrivateCommand(string[] args, SteamKit2.SteamFriends.FriendMsgCallback callback)
        {
            List<ChatReply> chatreply = new List<ChatReply>();
            if (args.Length < 2)
            {
                chatreply.Add(new ChatReply(callback.Sender, "This command requires 2 arguments"));
                return chatreply;
            }

            foreach (IPrivateCommand c in PrivateCommandsList.commands)
            {
                if (args[2] == c.GetType().Name)
                {
                    Program.pch.commands.Add(args[1], c);
                    chatreply.Add(new ChatReply(callback.Sender, string.Format("Command {0} will now trigger when {1} is said", c, args[1])));
                }
            }
            if (chatreply.Count == 0)
            {
                chatreply.Add(new ChatReply(callback.Sender, string.Format("Couldn't bind {0} to {1} (Does {0} exist? Use GetBindableCommands", args[2], args[1])));
            }

            //Program.groups[callback.ChatRoomID].commands.Add(args[1], cmd);
            return chatreply;
        }
Exemple #11
0
        public List<ChatReply> RunGroupCommand(string[] args, SteamKit2.SteamFriends.ChatMsgCallback callback)
        {
            ChatterBotFactory factory = new ChatterBotFactory();

            ChatterBot bot1 = factory.Create(ChatterBotType.PANDORABOTS, "b0dafd24ee35a477");
            ChatterBotSession bot1session = bot1.CreateSession();
            if (args.Length == 1)
            {
                finalOutcome = args[1];
            }
            else
            {
                outcome.Append(args[1] + "3276b04755a7e48f50b9bf9db9a79932");
                if (args.Length >= 2)
                {
                    for (int i = 2; i <= args.Length - 1; i++)
                    {
                        outcome.Append(args[i]);
                        if (i != args.Length - 1)
                        {
                            outcome.Append("3276b04755a7e48f50b9bf9db9a79932");
                        }
                    }
                }
                finalOutcome = outcome.ToString();
                finalOutcome = finalOutcome.Replace("3276b04755a7e48f50b9bf9db9a79932", " ");
            }
            try
            {
                botsay = bot1session.Think(finalOutcome);
                if (finalOutcome.Contains("console"))
                {
                    botsay = "Consoles suck. Master race forever!";
                }
                if (finalOutcome.Contains("watch") && finalOutcome.Contains("dogs"))
                {
                    botsay = "Watch Dogs is a retarded abortion from Ubisoft inorder to make players 'choose' their shitty uPlay system which doesn't work half the time and is a complete waste and hog of system resources to do something another program (Steam) already does.";
                }
                if (finalOutcome.Contains("hl3") || finalOutcome.Contains("Half Life 3") || finalOutcome.Contains("Half-Life 3") )
                {
                    botsay = "Half Life 3 will always be there... In your heart... Oh! And in GabeN's beard!";
                }
            }
            catch (Exception e)
            {
                botsay = "Ugh, I can't think today. Talk to me later.";
            }

            botsay = botsay.Replace("Pandorabots.com", "https://github.com/JustHev/PCMR-Bot"); //teehee :p
                botsay = botsay.Replace("Pandora", Program.steamFriends.GetPersonaName().ToString());
                botsay = botsay.Replace("Chomsky", Program.steamFriends.GetPersonaName().ToString());

            List<ChatReply> chatreply = new List<ChatReply>();
            chatreply.Add(new ChatReply(callback.ChatRoomID, botsay));
            botsay = "";
            finalOutcome = "";
            outcome.Clear();
            return chatreply;
        }
Exemple #12
0
 public List<ChatReply> RunPrivateCommand(string[] args, SteamKit2.SteamFriends.FriendMsgCallback callback)
 {
     List<ChatReply> chatreply = new List<ChatReply>();
     // Your code here:
     // Example:
     // chatreply.Add(new ChatReply(callback.Sender, "Pong"));
     return chatreply;
 }
Exemple #13
0
 public List<ChatReply> RunGroupCommand(string[] args, SteamKit2.SteamFriends.ChatMsgCallback callback)
 {
     List<ChatReply> chatreply = new List<ChatReply>();
     // Your code here:
     // Example:
     // chatreply.Add(new ChatReply(callback.ChatterID, "Pong"));
     return chatreply;
 }
 public List<ChatReply> RunGroupCommand(string[] args, SteamKit2.SteamFriends.ChatMsgCallback callback)
 {
     List<ChatReply> chatreply = new List<ChatReply>();
     Dictionary<string, IGroupCommand> commands = new Dictionary<string,IGroupCommand>();
     commands.Add("bind", new GCBindCommand());
     Program.groups[callback.ChatRoomID].commands = commands;
     chatreply.Add(new ChatReply(callback.ChatterID, string.Format("All commands are now unbound, please use {0}bind to bind new ones", Program.groups[callback.ChatRoomID].gcp.prefix)));
     return chatreply;
 }
Exemple #15
0
 public static string GetSteamIDInfo(SteamBot.Bot bot, SteamKit2.SteamID steamId)
 {
     string output = "";
     output += "| steamname: " + bot.SteamFriends.GetFriendPersonaName(steamId);
     output += "\r\n| steamID32: " + steamId.ToString();
     output += "\r\n| steamID64: http://steamcommunity.com/profiles/" + steamId.ConvertToUInt64();
     output += "\r\n|  steamrep: http://steamrep.com/profiles/" + steamId.ConvertToUInt64();
     return output;
 }
Exemple #16
0
 public List<ChatReply> RunPrivateCommand(string[] args, SteamKit2.SteamFriends.FriendMsgCallback callback)
 {
     List<ChatReply> chatreply = new List<ChatReply>();
     if (args[1].Length == 1)
     {
         GroupChatProperties.prefix = args[1];
     }
     chatreply.Add(new ChatReply(callback.Sender, "Prefix has been set."));
     return chatreply;
 }
Exemple #17
0
 public static System.Drawing.Color GetColorFromPersonaState(SteamBot.Bot bot, SteamKit2.SteamID steamId)
 {
     var state = bot.SteamFriends.GetFriendPersonaState(steamId);
     if (state != SteamKit2.EPersonaState.Offline)
     {
         var isPlayingGame = !string.IsNullOrEmpty(bot.SteamFriends.GetFriendGamePlayedName(steamId));
         if (isPlayingGame)
             return (System.Drawing.Color)System.Drawing.ColorTranslator.FromHtml("#81b900");
         else
             return (System.Drawing.Color)System.Drawing.ColorTranslator.FromHtml("#5db2ff");
     }
     return System.Drawing.ColorTranslator.FromHtml("#8a8a8a");
 }
 internal List<ChatReply> handleMessage(SteamKit2.SteamFriends.FriendMsgCallback obj)
 {
     List<ChatReply> reply = new List<ChatReply>();
     GlobalUser chatter;
     try
     {
         chatter = Program.users[obj.Sender];
     }
     catch
     {
         Program.users.Add(obj.Sender, new GlobalUser(obj.Sender));
         chatter = Program.users[obj.Sender];
     }
     if (true)
     {
         string[] args = obj.Message.Split(' ');
         args[0] = args[0].ToLower();
         IPrivateCommand command;
         try
         {
             command = commands[args[0]];
         }
         catch
         {
             command = new CommandAsk();
             reply = command.RunPrivateCommand(args, obj);
             //reply.Add(new ChatReply(chatter.user, string.Format("The command {0} does not exist", args[0])));
             return reply;
         }
         if (command.RequiredPermsForPrivate <= chatter.perms)
         {
             reply = command.RunPrivateCommand(args, obj);
         }
         else
         {
             reply.Add(new ChatReply(chatter.id, string.Format("You do not have permission to execute the command {0}", args[0])));
         }
     }
     /*else
     {
         string[] args = obj.Message.Split(' ');
         args[0] = args[0].ToLower();
         IPrivateCommand command;
         command = new CommandAsk();
         reply = command.RunPrivateCommand(Program.users, args, obj);
     }*/
     return reply;
 }
Exemple #19
0
 public List<ChatReply> RunGroupCommand(string[] args, SteamKit2.SteamFriends.ChatMsgCallback callback)
 {
     List<ChatReply> chatreply = new List<ChatReply>();
     SteamID id = callback.ChatterID;
     //            long id = Convert.ToInt64(args[1]);
     try
     {
         string n = Program.users[id].GetNick();
         chatreply.Add(new ChatReply(callback.ChatRoomID, n));
     }
     catch (Exception e)
     {
         chatreply.Add(new ChatReply(callback.ChatRoomID, e.Message));
     }
     return chatreply;
 }
Exemple #20
0
 public List<ChatReply> RunGroupCommand(string[] args, SteamKit2.SteamFriends.ChatMsgCallback callback)
 {
     List<ChatReply> chatreply = new List<ChatReply>();
     try
     {
         SteamID[] matches = Program.groups[callback.ChatRoomID].MatchNick(args[1]);
         if (matches.Length==1)
         {
         chatreply.Add(new ChatReply(matches[0], "WOLOLOOO HEUHA HUU WOLOLOOO (http://www.reddit.com/r/pcmasterrace/wiki/guide )"));
         }
     }
     catch
     {
         chatreply.Add(new ChatReply(callback.ChatRoomID, "WOLOLOOO HEUHA HUU WOLOLOOO (http://www.reddit.com/r/pcmasterrace/wiki/guide )"));
     }
     return chatreply;
 }
Exemple #21
0
 public List<ChatReply> RunGroupCommand(string[] args, SteamKit2.SteamFriends.ChatMsgCallback callback)
 {
     List<ChatReply> chatreply = new List<ChatReply>();
     //rules, help, kick, ban, convert, setperms, about, bind, unbind
     Dictionary<string, IGroupCommand> standardBinds=new Dictionary<string,IGroupCommand>();
     standardBinds.Add("rules", new CommandRules());
     standardBinds.Add("help", new CommandHelp());
     standardBinds.Add("kick", new CommandMKick());
     standardBinds.Add("ban", new CommandABan());
     standardBinds.Add("convert", new CommandConvert());
     standardBinds.Add("setperms", new CommandASetPerms());
     standardBinds.Add("about", new CommandAbout());
     standardBinds.Add("bind", new GCBindCommand());
     standardBinds.Add("unbind", new GCUnbindCommand());
     Program.groups[callback.ChatRoomID].commands=standardBinds;
     chatreply.Add(new ChatReply(callback.ChatterID, string.Format("The default commands have been bound. Please refer to them using {0}help", Program.groups[callback.ChatRoomID].gcp.prefix)));
     return chatreply;
 }
Exemple #22
0
        public List<ChatReply> RunGroupCommand(string[] args, SteamKit2.SteamFriends.ChatMsgCallback callback)
        {
            List<ChatReply> chatreply = new List<ChatReply>();
            if (args.Length >= 2)
            {

                SteamID[] matches = Program.groups[callback.ChatRoomID].MatchNick(args[1]);
                foreach (SteamID id in matches)
                {
                    chatreply.Add(new ChatReply(callback.ChatRoomID, string.Format("Match Found: {0} (ID: {1})", Program.users[id].nick, id)));
                }
            }
            else
            {
                chatreply.Add(new ChatReply(callback.ChatterID, string.Format("Invalid arguments: {0} [nickname]", args[0])));
            }
            return chatreply;
        }
Exemple #23
0
		public void GetPacketMsgReturnsPacketMsgForCryptoHandshake()
		{
			var messages = new[]
			{
				EMsg.ChannelEncryptRequest,
				EMsg.ChannelEncryptResponse,
				EMsg.ChannelEncryptResult
			};

			foreach(var emsg in messages)
			{
				var msgHdr = new MsgHdr { Msg = emsg };

				var data = Serialize(msgHdr);

				var packetMsg = CMClient.GetPacketMsg(data);
				Assert.IsAssignableFrom<PacketMsg>(packetMsg);
			}
		}
Exemple #24
0
        public List<ChatReply> RunGroupCommand(string[] args, SteamKit2.SteamFriends.ChatMsgCallback callback)
        {
            List<ChatReply> chatreply=new List<ChatReply>();
            if (args.Length < 1)
            {
                chatreply.Add(new ChatReply(callback.ChatterID, "This command requires an argument"));
                return chatreply;
            }
            try
            {
                Program.groups[callback.ChatRoomID].commands.Remove(args[1]);
                chatreply.Add(new ChatReply(callback.ChatterID, string.Format("Unbound the trigger {0} successfully", args[1])));

            }
            catch (KeyNotFoundException)
            {
                chatreply.Add(new ChatReply(callback.ChatterID, string.Format("Couldn't find the trigger {0}, is it even bound?", args[1])));
            }
            return chatreply;
        }
Exemple #25
0
        public BackpackExpander(Bot bot, SteamKit2.SteamID id)
            : base(bot, id)
        {
            this.steamID = this.Bot.SteamClient.SteamID;

            lock (BackpackExpander.lockingVar)
            {
                if (BackpackExpander.groupManager == null)
                    BackpackExpander.groupManager = new GroupManager(this.Bot.apiKey);

                // Add the bot to its group
                // TODO: use a different data structure to enable a sorted list
                BackpackExpander.groupManager.AddMember(this.steamID, this.groupID);
            }

            // Wait for own group to be complete, so we really add all group members to friends
            //while (!BackpackExpander.groupManager.GroupComplete(this.groupID)) ;

            // Add all group members to friendslist (also accepts pending invites of group members)
            AddGroupFriends();
        }
Exemple #26
0
 public List<ChatReply> RunPrivateCommand(string[] args, SteamKit2.SteamFriends.FriendMsgCallback callback)
 {
     if (day == "07/06")
     {
         birthdayBoncey = "(It's my birthday!)";
     }
     if (day == "31/07")
     {
         birthdayJustHev = "(It's my birthday!)";
     }
     List<ChatReply> chatreply = new List<ChatReply>();
     chatreply.Add(new ChatReply(callback.Sender, "This bot was made by Boncey and JustHev!" + Environment.NewLine +
         "You can get the source code here: https://github.com/JustHev/PCMR-Bot" + Environment.NewLine +
         "It is licenced under MIT too! So fork it and if you make something cool, do a pull request! (please dont remove our credits though)" + Environment.NewLine +
         "You can read the licence here: https://github.com/JustHev/PCMR-Bot/blob/master/LICENCE.md" + Environment.NewLine + Environment.NewLine +
         "If you like our bot, donate games or Steam items to us at: " + Environment.NewLine +
         "Boncey: http://steamcommunity.com/id/Boncey " + birthdayBoncey + Environment.NewLine +
         "JustHev: http://steamcommunity.com/id/JustHev " +  birthdayJustHev + Environment.NewLine + Environment.NewLine +
         "Play safe and have fun! -Boncey & JustHev."));
     return chatreply;
 }
Exemple #27
0
        public List<ChatReply> RunGroupCommand(string[] args, SteamKit2.SteamFriends.ChatMsgCallback callback)
        {
            PerformanceCounter ramCounter;
            ramCounter = new PerformanceCounter("Memory", "Available MBytes");
            totalRam = (ramCounter.NextValue() * 1024.0f) / 2;
            string ramString = totalRam.ToString();

                List<ChatReply> chatreply = new List<ChatReply>();
                try { amountOfSpam = UInt64.Parse(args[1]); }
                catch (Exception e) { chatreply.Add(new ChatReply(callback.ChatRoomID, "Your max spam is: " + totalRam)); }
                try
                {
                    for (ulong i = 1; i < amountOfSpam; i++)
                    {
                        chatreply.Add(new ChatReply(callback.ChatRoomID, "Yummy spam! Yummy spam! Yummy spam! #iluvspam #tastyspamforall"));
                    }
                }
                catch (Exception e) { chatreply.Add(new ChatReply(callback.ChatRoomID, "I am out of memory. Stopping spam...")); }
            //else { chatreply.Add(new ChatReply(callback.ChatRoomID, "Your max spam is: " + totalRam)); }
            return chatreply;
        }
Exemple #28
0
        public List<ChatReply> RunGroupCommand(string[] args, SteamKit2.SteamFriends.ChatMsgCallback callback)
        {
            List<ChatReply> chatreply = new List<ChatReply>();
            try
            {
                string groupName = Program.users[callback.ChatRoomID].nick;
                chatreply.Add(new ChatReply(callback.ChatterID, groupName + " Rules:" + Environment.NewLine +
                "1. Do not spam." + Environment.NewLine +
                "2. Do not harass other users." + Environment.NewLine
                ));
            }
            catch (Exception e)
            {
                Console.WriteLine(string.Format("ERR: Couldn't get groupName: Exception {0} occurred", e.Message));
                chatreply.Add(new ChatReply(callback.ChatterID, "Rules:" + Environment.NewLine +
                "1. Do not spam." + Environment.NewLine +
                "2. Do not harass other users." + Environment.NewLine
                   ));
            }

               return chatreply;
        }
Exemple #29
0
 public List<ChatReply> RunGroupCommand(string[] args, SteamKit2.SteamFriends.ChatMsgCallback callback)
 {
     List<ChatReply> chatreply = new List<ChatReply>();
     /*chatreply.Add(new ChatReply(callback.ChatterID, Program.steamFriends.GetPersonaName() + " Commands:" + Environment.NewLine +
     GroupChatHandler.gcp.prefix + "ping" + Environment.NewLine +
     GroupChatHandler.gcp.prefix + "rules" + Environment.NewLine +
     GroupChatHandler.gcp.prefix + "help" + Environment.NewLine));
     if (users[callback.ChatterID].perms == 9001)
     {
         chatreply.Add(new ChatReply(callback.ChatterID, Environment.NewLine +
         GroupChatHandler.gcp.prefix + "disconnect"));
     }*/
     String helpmsg=String.Format("Commands available to you in this chatroom: "); //TODO: add groupname instead of this chatroom
     foreach (string s in Program.groups[callback.ChatRoomID].commands.Keys)
     {
         if (Program.groups[callback.ChatRoomID].commands[s].RequiredPermsForGroup <= Program.users[callback.ChatterID].perms || Program.groups[callback.ChatRoomID].commands[s].RequiredPermsForGroup <= Program.users[callback.ChatterID].perms)
         {
             helpmsg = helpmsg + string.Format("{0}{1} ", Program.groups[callback.ChatRoomID].gcp.prefix, s);
         }
     }
     chatreply.Add(new ChatReply(callback.ChatRoomID, helpmsg));
     return chatreply;
 }
Exemple #30
0
 public List<ChatReply> RunGroupCommand(string[] args, SteamKit2.SteamFriends.ChatMsgCallback callback)
 {
     List<ChatReply> chatreply = new List<ChatReply>();
     try
     {
         SteamID[] matches = Program.groups[callback.ChatRoomID].MatchNick(args[1]);
         if (matches.Length==1)
         {
             if (args[2] != null && args[2].Contains("1") || args[2].Contains("2") || args[2].Contains("3") || args[2].Contains("4") || args[2].Contains("5") || args[2].Contains("6") || args[2].Contains("7") || args[2].Contains("8") || args[2].Contains("9") || args[2].Contains("0"))
             {
                 chatreply.Add(new ChatReply(matches[0], "Your coins have been set to: " + args[2]));
                 chatreply.Add(new ChatReply(callback.ChatterID, "Success! " + Program.users[matches[0]].nick + "'s coins have been set to " + args[2]));
                 Program.groups[callback.ChatRoomID].users[matches[0]].coins = Int32.Parse(args[2]);
             }
             else { chatreply.Add(new ChatReply(callback.ChatRoomID, "Invalid number. Did you use intergers?")); }
         }
         else { chatreply.Add(new ChatReply(callback.ChatRoomID, "Could not find user, try being more specific?"));  }
     }
     catch
     {
         chatreply.Add(new ChatReply(callback.ChatRoomID, "Could not find user, try being more specific?"));
     }
     return chatreply;
 }