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

16
LINES

< > BotCompany Repo | #1024010 // discord_google - google and format for Discord (<> stops Discord from "previewing" links)

JavaX fragment (include) [tags: use-pretranspiled]

Transpiled version (8196L) is out of date.

1  
sS discord_google(S query, O... _) {
2  
  optPar int results = 3;
3  
  optPar bool safeSearch;
4  
  optPar bool withDescription;
5  
  optPar S noResultsMsg;
6  
  if (noResultsMsg == null)
7  
    noResultsMsg = "GBot is currently broken, fixing ASAP (2020/2/21)"; //"Sorry - no results found. SafeSearch is " + (safeSearch ? "on" : "off") + ".";
8  
  
9  
  L<T3S> l = safeSearch ? quickGoogle2_safeSearch(query) : quickGoogle2(query);
10  
  ret or2(lines(map(takeFirst(results, l),
11  
    linkTextDesc ->
12  
      unicode_smallBlackSquare() + " **" + linkTextDesc.b + "**\n"
13  
        + (!withDescription ? "" : linkTextDesc.c + "\n")
14  
        + "<" + linkTextDesc.a + ">")),
15  
      noResultsMsg);
16  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 8 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, whxojlpjdney, xrpafgyirdlv

No comments. add comment

Snippet ID: #1024010
Snippet name: discord_google - google and format for Discord (<> stops Discord from "previewing" links)
Eternal ID of this version: #1024010/16
Text MD5: 459eb9afaf5240060ad786fb3fe11205
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-02-20 23:50:14
Source code size: 675 bytes / 16 lines
Pitched / IR pitched: No / No
Views / Downloads: 233 / 396
Version history: 15 change(s)
Referenced in: [show references]