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

39
LINES

< > BotCompany Repo | #1026479 // Toms_Tomii Boi Discord Bot_test

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

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

!7

!include once #1026298 // use JDA 4.0

standardBot1 TomiiBoiDiscordBot {
  S dbBotID = #1026409;
  
  init {
    if (myName == null) setField(myName := "Tomii");
    preprocessAtSelfToMyName = true;
    dropPunctuation = false;
    escapeAtEveryone = true;
  }
  
  sync S processSimplifiedLine(S s, O... _) {
    try answer super.processSimplifiedLine(s, _);
    
    new Matches m;
    if (swic_trim(s, "gbot:", m))
      ret gbot(m.rest(), paramsToMap(_));
    
    O dbBot = eleu_getBot(dbBotID);
    if (dbBot == null) ret null with print("No DB bot found (" + dbBotID + ")");
    
    temp tempSetTL((ThreadLocal) getOpt(dbBot, 'opt_noDefault), true);
    ret (S) call(dbBot, 'answer, s, "en");
  }
  
  S gbot(S query, Map map, O... _) {
    LS l = regexpICFullMatch_groups("(\\d+) results? for[ :](.+)", query);
    int results = 1;
    if (l != null) {
      results = parseInt(first(l));
      query = unquote(trim(last(l)));
    }
    bool safeSearch = !discord_isNSFWChannel_gen(map.get('channel));
    ret discord_google(query, paramsPlus(_, +results, +safeSearch));
  }
}

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: 338 / 459
Referenced in: #1026494 - Tomii Boi Discord Bot [in-OS db version, use with #1028036]