/// <summary> /// Do not try using steamfriends, steamuser and all that since it'll be uninitialised at this point /// </summary> /// <param name="SteamConnectionHandler"></param> public VBot() { Console.WriteLine("VBot Initialised"); Console.WriteLine("Loading modules and stuff"); ModuleList = new List <BaseModule>(); MapChangeEventListiners = new List <ServerMapChangeListiner>(); HTMLParsers = new List <IHTMLFileFromArrayPasser>(); OnLoginlistiners = new List <OnLoginCompletedListiners>(); ListChangeEventListiners = new List <MapListChangeListiner>(); // loading modules WebServer = new WebServerHostingModule(this, jsconfig); mapModule = new MapModule(this, this, jsconfig); TrackingServerListmodule = new TrackingServerListHolder(this, this, jsconfig); ServerTrackingModule = new ServerTrackingModule(this, this, jsconfig); usersModule = new UsersModule(this, jsconfig); replyModule = new RepliesModule(this, jsconfig); searchModule = new SearchModule(this, jsconfig); adminmodule = new AdminModule(this, this, this, jsconfig); identitymodule = new IdentityModule(this, this, jsconfig); //motdModule = new MotdModule(this, jsconfig); //countdownmodule = new CountDownModule(this, jsconfig); Console.WriteLine("Modules loaded and ModuleList intitialised"); foreach (BaseModule module in ModuleList) { module.OnAllModulesLoaded(); } }
public override string runcommand(MessageEventArgs Msg, string param) { Map UserMap = CleanupAndParseMsgToMap(Msg, param); string Reply = MapModule.mapList.AddMap(UserMap); MapModule.savePersistentData(); return(Reply); }
public override string runcommand(MessageEventArgs msg, string param) { string[] parameters = param.Split(new char[] { ' ' }, 3); int index; if (parameters[0].Length == 0) { return("Invalid parameters for !insert. Syntax: !insert <index> <filename> <url> <notes>"); } try { index = int.Parse(parameters[0]); } catch { return("Invalid parameters for !insert. Syntax: !insert <index> <filename> <url> <notes>"); } Map map = new Map(); map.Submitter = msg.Sender.identifier.ToString(); map.SubmitterName = msg.Sender.DisplayName; try { map.Filename = parameters[1]; } catch (Exception exception) { return(string.Format("Your new file name was rejected because: {0}", exception.Message)); } map.Notes = string.Format("Inserted in position {0} by {1} //", index, msg.Sender.identifier.ToString()); if (MapModule.CheckIfMapIsUploaded(map.Filename)) //Check if the map is uploaded { map.DownloadURL = "Uploaded"; if (parameters.Length > 1) { map.Notes += parameters.Last(); } } else if (parameters.Length > 2) //If its not uploaded check if a URL was there { parameters = param.Split(new char[] { ' ' }, 4); map.DownloadURL = parameters[2]; if (parameters.Length > 3) { map.Notes += parameters.Last(); } } else //If a url isn't there lets return an error { return("Your map isn't uploaded! Please use include the url with the syntax: !add <filename> <url> (notes)"); } string Reply = string.Format("Map '{0}' added.", map.Filename); MapModule.mapList.InsertMap(index, map); MapModule.savePersistentData(); return(Reply); }
public InsertMap(ModuleHandler bot, MapModule mapModule) : base(bot, "!insert", mapModule, "!insert <index> <filename> <url> <notes>") { }
public AllowOnlyUploadedMapsSetter(ModuleHandler bot, MapModule module) : base(bot, "!forceuploaded") { mapmodule = module; }
public Add(ModuleHandler bot, MapModule mapModule) : base(bot, "!add", mapModule, "!add <mapname> <url> <notes>") { }
public MapCommand(ModuleHandler bot, string command, MapModule mapMod, string Syntax) : base(bot, command) { this.MapModule = mapMod; this.syntax = Syntax; this.command = command; }
public GetMaps(ModuleHandler bot, MapModule mapMod) : base(bot, "!maps") { module = mapMod; }
public UpdateName(ModuleHandler bot, MapModule module) : base(bot, "!nameupdate") { mapmodule = module; }