!7 do not include function dm_current_generic. do not include function dm_current_mandatory_generic. module DiscordHopper > DynPrintLogAndEnabled { !include #1023434 // Discord bool discordEnabled() { ret enabled; } bool printToModule() { true; } start-thread { startDiscord(); dm_vmBus_onMessage_q incomingDiscordMessage(voidfunc(Map map) { if (!enabled) ret; O module = map.get('module); if (!dm_isMe(module)) ret; S s = getString content(map); if (eq(s, "!bot count")) ret with dm_call(module, 'reply, map, lstr(dm_activeDiscordTokens())); LS tokens = extractPossibleDiscordTokens(s); for unnull (S token : tokens) { S answer = "That's a Discord token!"; if (contains(concatLists((LLS) vmBus_queryAll activeDiscordTokens()), token)) answer += " And I'm there already."; else { answer += " Jumping there!!"; dm_showNewModuleWithParams(dm_moduleLibID(), discordToken := token); } dm_call(module, 'reply, map, answer); } }); } // API S migrateToType(S moduleLibID) { S moduleID = assertNotNull(dm_showNewModuleWithParams(moduleLibID, +discordToken)); print("Migrated to new module " + moduleID + ", disabling me"); setEnabled(false); dm_reload(); // actually disable Discord ret moduleID; } }