!7 cmodule GreeterBot > DynTalkBot { S msg = "Welcome ! Rules and regulations apply. And stuff."; long channelToGreetIn; start { useAGIBlueForDropPunctuation = false; preprocessAtSelfToMyName = false; } void onUserJoin(long userID, O... _) { S msg2 = replace(msg, "", discordAt(userID)); if (channelToGreetIn == 0) setField(channelToGreetIn := preferredChannelID); if (channelToGreetIn == 0) fail("Have no greeting channel"); } S processSimplifiedLine(S s, O... _) { try answer super.processSimplifiedLine(s, _); // adding authorized users etc. new Matches m; S sOld = s; s = dropPrefixOrNull(myPrefix(), s); if (s == null) { print("no got prefix: " + quote(myPrefix()) + " / " + quote(sOld)); null; } if (eqic(s, "prefer this channel")) { try answer checkAuth(_); long channelID = longPar channelID(_); if (channelID == 0) ret "No channel"; setField(channelToGreetIn := channelID); ret "OK, will greet here from now on."; } if (eqic(s, "simulate greeting")) { onUserJoin(longPar userID(_), _); ret "Greeting simulated"; } if (eqic(s, "get message")) ret msg; if (swic_trim(s, "set message:", m)) { try answer checkAuth(_); setField(msg := m.rest(); ret "Message changed to: " + msg; } if (eqic(s, "help")) ret trim([[ I am a simple greeter bot. Commands: simulate greeting get message set message: Hello ! Bla bla... prefer this channel masters/add master/delete master ]]); null; } }