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).

!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... _) null {
    try answer super.processSimplifiedLine(s, _);
    
    new Matches m;
    if (swic_trim(s, "gbot:", m))
      ret gbot(m.rest(), paramsToMap(_));
    
    try answer webBot_answer(s, #1026409);
  }
  
  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));
  }
}

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: 269 / 1016
Version history: 19 change(s)
Referenced in: [show references]