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   

Travelled to 3 computer(s): mqqgnosmbjvj, tvejysmllsmz, whxojlpjdney

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

Formerly at http://tinybrain.de/1024010 & http://1024010.tinybrain.de