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.

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

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: 240 / 402
Version history: 15 change(s)
Referenced in: [show references]