Uses 10819K of libraries. Click here for Pure Java version (17912L/96K).
1 | !7 |
2 | |
3 | !include once #1026298 // use JDA 4.0 |
4 | |
5 | standardBot1 TomiiBoiDiscordBot { |
6 | S dbBotID = #1026409; |
7 | |
8 | init { |
9 | if (myName == null) setField(myName := "Tomii"); |
10 | preprocessAtSelfToMyName = true; |
11 | dropPunctuation = false; |
12 | escapeAtEveryone = true; |
13 | } |
14 | |
15 | sync S processSimplifiedLine(S s, O... _) { |
16 | try answer super.processSimplifiedLine(s, _); |
17 | |
18 | new Matches m; |
19 | if (swic_trim(s, "gbot:", m)) |
20 | ret gbot(m.rest(), paramsToMap(_)); |
21 | |
22 | O dbBot = eleu_getBot(dbBotID); |
23 | if (dbBot == null) ret null with print("No DB bot found (" + dbBotID + ")"); |
24 | |
25 | temp tempSetTL((ThreadLocal) getOpt(dbBot, 'opt_noDefault), true); |
26 | ret (S) call(dbBot, 'answer, s, "en"); |
27 | } |
28 | |
29 | S gbot(S query, Map map, O... _) { |
30 | LS l = regexpICFullMatch_groups("(\\d+) results? for[ :](.+)", query); |
31 | int results = 1; |
32 | if (l != null) { |
33 | results = parseInt(first(l)); |
34 | query = unquote(trim(last(l))); |
35 | } |
36 | bool safeSearch = !discord_isNSFWChannel_gen(map.get('channel)); |
37 | ret discord_google(query, paramsPlus(_, +results, +safeSearch)); |
38 | } |
39 | } |
download show line numbers debug dex old transpilations
Travelled to 8 computer(s): bhatertpkbcr, mqqgnosmbjvj, pcsjzfqafodr, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
Snippet ID: | #1026479 |
Snippet name: | Toms_Tomii Boi Discord Bot_test |
Eternal ID of this version: | #1026479/1 |
Text MD5: | 54c7d931023d0a635faef1202d05a565 |
Transpilation MD5: | 031840c3bb069a22572d709b66c9556a |
Author: | gurrenm3 |
Category: | |
Type: | JavaX source code (Dynamic Module) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2020-01-06 01:42:04 |
Source code size: | 1127 bytes / 39 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 339 / 461 |
Referenced in: | [show references] |