Skip to content

Instantly share code, notes, and snippets.

@DiscordLinuxBot
DiscordLinuxBot / websearch.bbtag
Last active January 10, 2021 03:02
websearch.bbtag
{//;Inport functions for requests}
{exec;librequest}
{//;Set embed color to input if -C is used or random otherwise}
{if;{flag;C};==;{null};
{set;!~ecolor;{exec;randcolor}};
{set;!~ecolor;{flag;C}}}
{//;Output message to let users know we're actually doing something while we get data}
{set;!~gssmsg;{output;{embed;{embedbuild;
color:{get;~ecolor};
thumbnail.url:{exec;linuxhacker};
{exec;prefix.test}
{//;Function to output help}
{function;help;{embed;{embedbuild;
title:Help for {exec;commandname;quote};
color:yellow;
description:__**Usage**__: `{exec;commandname;quote} [channel] <message id|link to message> [flag <text>]`
Quotes messages in a nice embed. Can be used to quote text messages or embeded messages. A reply may also be sent with the `-r` flag.
**Available flags**
```
@DiscordLinuxBot
DiscordLinuxBot / bash.bbtag
Last active January 16, 2021 05:52
bash.bbtag
{exec;libbash}
{if;{get;_bash.aliases};==;;{set;_bash.aliases;["!@#$%"]}}
{function;bashhelp;
{embed;{embedbuild;
title:Help for bash;
color:yellow;
description:__**Usage**__: `bash{if;{commandname};startswith;_autoresponse;{space}-c} <arg> <text>`
A simple bash shell-like command that allows for exporting and fetching variables in bash style syntax. Any arguments not listed below will attempt to run an existing alias. If an alias does not exist, the arguments will be executed using the Paiza API.
**Available arguments**
@DiscordLinuxBot
DiscordLinuxBot / libbash.bbtag
Last active January 16, 2021 05:52
libbash.bbtag
{//;Function to set export variables bash style}
{//;{function;export;{switch;{guildid};["204061452707954688","96230004047740928"];{if;{length;{split;{params};=}};<;2;{exec;Echo;Usage: '{lb}func.export{semi}VARIABLE=stuff here{rb}'};{set;@libbash.var.${jget;{split;{params};=};0};{if;{jget;{split;{params};=};1};!=;;{join;{slice;{split;{regexreplace;{params};/"/g;};=};1};=}}}{push;@libbash.variable.list;Var: {jget;{split;{params};=};0} - Value: {join;{slice;{split;{regexreplace;{params};/"/g;};=};1};=} - User: {username}}{reactadd;{messageid};<:SeemsGood:478441196755091461>}};{exec;Echo;bash: {lb}func.export{rb}: Permission denied}}}}
{function;export;{if;{length;{split;{params};=}};<;2;{exec;Echo;Usage: '{lb}func.export{semi}VARIABLE=stuff here{rb}'};{switch;{jget;{split;{params};=};0};["LANG","HOSTNAME","USER","PWD","HOME","SHELL","RUNNER_USER","SHLVL","PATH","_"];{exec;Echo;export {params}{newline}export {params}: Permission denied};{if;{get;@{guildid}.bash.var.array};==;{null};{set;!@{guildid}.bash.var.arra
{exec;prefix.test}
{if;{get;_{commandname}.categories};==;;
{set;_{commandname}.categories;[]}}
{if;{get;_{commandname}.color.help};==;;
{set;!_{commandname}.color.help;{exec;blurple}}}
{function;buildhelp;
{if;{length;{get;_{commandname}.categories}};>;0;{foreach;~category;{jget;{get;_{commandname}.categories};v};{replace;{get;~category};$;@&}
>{space}{uridecode;{join;{sort;{jget;{get;_{commandname}.categories.{get;~category}};v}};,{space}}}{newline}{zws}{newline}}}}
{if;{get;_{commandname}.color.error};==;;
{set;!_{commandname}.color.error;red}}
{if;{get;_{commandname}.color.admin};==;;
{set;!_{commandname}.color.admin;indianred}}
{if;{get;_{commandname}.color.mod};==;;
{set;!_{commandname}.color.mod;orange}}
{if;{get;_{commandname}.color.vip};==;;
{set;!_{commandname}.color.vip;yellow}}
{if;{get;_{commandname}.color.user};==;;
{set;!_{commandname}.color.user;{exec;blurple}}}
@DiscordLinuxBot
DiscordLinuxBot / webhook.bbtag
Last active May 24, 2020 06:07
webhook.bbtag
{replace;{clean;{//;help function}
{function;whelp;
{embed;{j;{"description":"```\n{exec;_webhook;<id>;<token>;[content];[embed];[username];[avatarURL]}```Executes a webhook. The `embed` must be provided in a raw JSON format, properly escaped for BBTag. `{embedbuild}` should be used to create the JSON. Please assign your webhook credentials to private variables! Do not leave them in your code.\n​","title":"BBTag documentation - Webhook","url":"https://blargbot.xyz/tags/#webhook","fields":[{"inline":false,"name":"Example code","value":"```csharp\n{exec;_webhook;1111111111111111;t.OK-en;Hello!}```"},{"inline":false,"name":"Example output","value":"```\n2121212121212121\nIn the webhook channel: Hello!```"},{"inline":false,"name":"​","value":"*Use `sudot docs arguments` for detailed info about the argument syntax!*"}],"color":15728384,"type":"rich"}}}}
{//;detect arguments}
{fallback;}
{if;{logic;||;
{bool;{args;0};==;{null}};
{bool;{args;1};==;{null}};
{bool;{argslength};<;3}};
{fallback}
{regexreplace;{//;This regexreplace is here because blargbot likes to output tons of line breaks when you use functions for some reason.}
{//;Function that uses motyar.info/webscrapemaster to get data from sites in easily parsible format}
{function;motyar;{set;!~motyarkey;{jget;{split;{jget;{split;{func.html;https://ipinfo.io/{randchoose;["1.1.1.1","8.8.8.8"]}/geo};value="};1};"};0}}{request;http://motyar.info/webscrapemaster/api?key={get;~motyarkey}&url={uriencode;{params;0}}&xpath={params;1}}}
{//;Function that gets metadata from html of given website}
{function;metadata;{set;~raw;{func.motyar;{params;0};/meta}}{set;~elements;[]}{set;~values;[]}{for;~i;0;<;{length;{jget;{get;~raw};body}};{if;{jget;{get;~raw};body.{get;~i}.http-equiv};!=;;{push;~elements;{jget;{get;~raw};body.{get;~i}.http-equiv}}{push;~values;{jget;{get;~raw};body.{get;~i}.content}}}{if;{jget;{get;~raw};body.{get;~i}.name};!=;;{push;~elements;{jget;{get;~raw};body.{get;~i}.name}}{push;~values;{jget;{get;~raw};body.{get;~i}.content}}}{if;{jg
@DiscordLinuxBot
DiscordLinuxBot / wikiapi.bbtag
Last active January 16, 2021 05:47
wikiapi.bbtag
{set;!~wcolor;{exec;randcolor}}
{switch;{lower;{flag;_}};
["help","--help",""];
{embed;{embedbuild;
author.name:Wikipedia.org;
author.icon_url:https://www.wikipedia.org/portal/wikipedia.org/assets/img/Wikipedia-logo-v2.png;
author.url:https://wikipedia.org;
title:Help for Wikipedia search;
color:{get;~wcolor};
description:Searches Wikipedia for the provided input and returns a short description of the first result.;}};
{switch;{lower;{args;0}};
["appid"];{set;!~id;{args;1}};
{set;!~gamewiki;{request;https://www.pcgamingwiki.com/w/api.php?action=query&format=json&prop=categories%7Cextlinks%7Cinfo&list=&meta=&generator=search&redirects=1&converttitles=1&utf8=1&formatversion=2&clcategories=Category%3ALinux%7CCategory%3AWindows%7CCategory%3AOS%20X&elprotocol=https&elquery=steamdb.info&elexpandurl=1&inprop=url%7Cdisplaytitle&gsrsearch={uriencode;{args}}&gsrwhat=nearmatch}}
{fallback;}
{set;!~id;{jget;{split;{jget;~gamewiki;body.query.pages.0.extlinks.0.url};/};4}}}
{if;{get;~id};==;{null};{embedbuild;
color:red;
description:'{flag;_}' not found.};
{set;!~steam;{jget;{request;https://steamspy.com/api.php?request=appdetails&appid={get;~id}};body}}
{set;!~pjson;{request;https://www.protondb.com/api/v1/reports/summaries/{get;~id}.json}}