Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

35
LINES

< > BotCompany Repo | #1026415 // Tomii Boi Discord Bot [now works everywhere, dev.]

JavaX source code (Dynamic Module) [tags: use-pretranspiled] - run with: Stefan's OS

Uses 10819K of libraries. Click here for Pure Java version (18127L/97K).

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... _) null {
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  
    try answer webBot_answer(s, #1026409);
23  
  }
24  
  
25  
  S gbot(S query, Map map, O... _) {
26  
    LS l = regexpICFullMatch_groups("(\\d+) results? for[ :](.+)", query);
27  
    int results = 1;
28  
    if (l != null) {
29  
      results = parseInt(first(l));
30  
      query = unquote(trim(last(l)));
31  
    }
32  
    bool safeSearch = !discord_isNSFWChannel_gen(map.get('channel));
33  
    ret discord_google(query, paramsPlus(_, +results, +safeSearch));
34  
  }
35  
}

Author comment

Began life as a copy of #1026316

download  show line numbers  debug dex  old transpilations   

Travelled to 9 computer(s): bhatertpkbcr, mqqgnosmbjvj, onxytkatvevr, pcsjzfqafodr, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1026415
Snippet name: Tomii Boi Discord Bot [now works everywhere, dev.]
Eternal ID of this version: #1026415/20
Text MD5: dac066cd6eaf8f640891ecaac4e39a5a
Transpilation MD5: dced731fd63a0bcc0e55472accfd8603
Author: stefan
Category: javax / discord
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-01-19 01:05:28
Source code size: 935 bytes / 35 lines
Pitched / IR pitched: No / No
Views / Downloads: 270 / 1017
Version history: 19 change(s)
Referenced in: [show references]