public static void PrivateCommands(string chatMessage, SteamFriends.FriendMsgCallback callback) { privateActor = callback; if(callback.Sender != 76561197993698595) { return; } ChatCommander chatCommander = new ChatCommander(); MethodInfo mi; GroupCollection paramList = null; Dictionary<string, string> rouletteCommands = new Dictionary<string, string>{ {@"^!addAlias (.+) ([0-9]+)$","AddNewAlias"}, {@"^!aliasList$","ListAliases"} }; foreach(KeyValuePair<string, string> entry in rouletteCommands) { Regex rgx = new Regex(entry.Key); Match m = rgx.Match(chatMessage); if(m.Success) { paramList = m.Groups; mi = chatCommander.GetType().GetMethod(entry.Value); mi.Invoke(chatCommander, new object[] { paramList }); return; } } }
public static void PublicCommands(string chatMessage) { ChatCommander chatCommander = new ChatCommander(); MethodInfo mi; GroupCollection paramList = null; Dictionary<string, string> rouletteCommands = new Dictionary<string, string>{ {@"^!aliasList$","ListAliases"} }; foreach(KeyValuePair<string, string> entry in rouletteCommands) { Regex rgx = new Regex(entry.Key); Match m = rgx.Match(chatMessage); if(m.Success) { paramList = m.Groups; mi = chatCommander.GetType().GetMethod(entry.Value); mi.Invoke(chatCommander, new object[] { paramList }); return; } } }