abstract sclass DynDiscordHopper > DynPrintLogAndEnabled { !include #1023434 // Discord bool discordEnabled() { ret enabled; } bool printToModule() { true; } start { 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); S answer = answer(s, map); if (nempty(answer)) dm_call(module, 'reply, map, answer); }); } void reply(Map map, S s) { dm_call(module, 'reply, map, answer); } S answer(S s, Map map) { if (eq(s, "!bot count")) ret 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); } reply(map, answer); } null; } }