!7 concept GModule { S moduleID, moduleLibID; S userID; // e. g. discord user id S userName; S shorthand; } cmodule GModulesManager > DynCRUD { // API S startModuleForUser(S moduleLibID, S userID, S userName, S shorthand) { Pair p = uniqConcept2(+userID, +shorthand); if (!p.b) ret "Module already running"; cset(p.a, +userName, +moduleLibID); print("Starting module: " + moduleLibID); cset(p.a, moduleID := dm_makeNewModule(moduleLibID)); ret print("Module " + moduleLibID + " started for " + userName + " as " + quote(shorthand)); } S deleteModuleForUser(S userID, S shorthand) { GModule mod = conceptWhere GModule(+userID, +shorthand); if (mod == null) ret "Module not found"; deleteConcept(mod); ret "Module deleted"; } void removeModule(O mod) { deleteConcept(conceptWhere GModule(moduleID := dm_moduleID(mod))); } LS modulesForUser(S userID) { ret collect moduleID(conceptsWhere GModule(+userID)); } }