Skip to content

Instantly share code, notes, and snippets.

@DiscordLinuxBot
Created May 24, 2020 05:37
Show Gist options
  • Save DiscordLinuxBot/5d22f5abe14e874dba6cfa08c41cfe1d to your computer and use it in GitHub Desktop.
Save DiscordLinuxBot/5d22f5abe14e874dba6cfa08c41cfe1d to your computer and use it in GitHub Desktop.
help.bbtag
{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}}}}
{function;help;
{embed;{embedbuild;
author.icon_url:{guildicon};
author.name:{guildname} Commands;
title:{zws};
color:{get;_{commandname}.color.help};
footer.text:{usernick};
footer.icon_url:{useravatar};
timestamp:{time};
description:{func.buildhelp};
fields.name:{zws};
fields.value:{if;{logic;||;{isstaff;{userid}};{bool;{userid};==;86201442112671744}};For more information about setting up {commandname}, see `{if;{get;~used.prefix};==;{null};{prefix};{get;~used.prefix}}{commandname} --staff`.{newline}{zws}{newline}}For more information about commands, see `{if;{get;~used.prefix};==;{null};{prefix};{get;~used.prefix}}{commandname} <commandname>`;}}}
{function;staffhelp;
{if;{logic;||;
{isstaff;{userid}};
{bool;{userid};==;86201442112671744}};
{embed;{embedbuild;
author.icon_url:{guildicon};
author.name:{capitalize;{commandname}} Staff Arguments;
title:{zws};
color:{get;_{commandname}.color.admin};
footer.text:{usernick};
footer.icon_url:{useravatar};
timestamp:{time};
description:{repeat;`;3}sethelp <category> -n <name> -e <{commandname}>
- Set the {commandname} output for '<name>'.
- Prefix the {commandname} with 'exec' to have it execute a tag when called, or 'execcc' for a cc.
delhelp <category> -n <name>
- Remove the {commandname} output for '<name>'.
setcats <category names>
- Set the {commandname} cateogry names. List of cateogory names must be separated by spaces.
- Categories are created automatically, so should only need to be used for setting the order of {commandname} output or renaming categories.
{repeat;`;3}
Note: only staff members can view default help outputs that haven't been added through `sethelp`, so be sure to use `sethelp <category> -n <name>` if you want others to see them.;}};
{exec;Err;Only staff can use this argument!}}}
{function;sethelp;
{if;{isstaff;{userid}};
{fallback;}
{set;~category;{join;{slice;{split;{flag;_};{space}};1};{space}}}
{set;~helpname;{flag;n}}
{if;{flag;e};!=;;
{set;~help;{split;{flag;e};{space}}}}
{if;{get;~category};==;;
{func.staffhelp};
{if;{get;~helpname};==;;
{func.staffhelp};
{set;_{commandname}.command.{uriencode;{lower;{get;~helpname}}};{get;~help}}
{if;{get;_{commandname}.categories};includes;{get;~category};
{//;do nothing};
{push;_{commandname}.categories;{get;~category}}}
{if;{length;{get;_{commandname}.categories.{get;~category}}};==;0;
{set;_{commandname}.categories.{get;~category};[]}}
{if;{get;_{commandname}.categories.{get;~category}};includes;{uriencode;{get;~helpname}};
{//;do nothing};
{push;_{commandname}.categories.{get;~category};{uriencode;{get;~helpname}}}}
{reactadd;{channelid};{messageid};<:SeemsGood:478441196755091461>}}};
{exec;Err;Only staff can use this argument!}}}
{function;delhelp;
{if;{isstaff;{userid}};
{set;~category;{join;{slice;{split;{flag;_};{space}};1};{space}}}
{set;~helpname;{flag;n}}
{if;{get;~category};==;;
{func.staffhelp};
{if;{get;~helpname};==;;
{func.staffhelp};
{set;_{commandname}.command.{uriencode;{lower;{get;~helpname}}}}
{set;_{commandname}.categories.{get;~category};
{filter;~elem;{get;_{commandname}.categories.{get;~category}};{bool;{get;~elem};!=;{uriencode;{get;~helpname}}}}}
{if;{length;{get;_{commandname}.categories.{get;~category}}};==;0;
{set;_{commandname}.categories;
{filter;~ele;{get;_{commandname}.categories};{bool;{get;~ele};!=;{get;~category}}}}}
{reactadd;{channelid};{messageid};<:SeemsGood:478441196755091461>}}};
{exec;Err;Only staff can use this argument!}}}
{fallback;}
{switch;{lower;{args;0}};
[""];{func.help};
["--staff"];{func.staffhelp};
["setcats"];
{if;{isstaff;{userid}};
{if;{argslength};==;1;
{func.staffhelp};
{set;!__{commandname}.categories;{slice;{argsarray};1}}};
{exec;Err;Only staff can use this argument!}};
["sethelp"];{func.sethelp};
["delhelp"];{func.delhelp};
{fallback}
{if;{get;_{commandname}.command.{flag;_}};!=;;
{apply;{get;_{commandname}.command.{flag;_};0};{get;_{commandname}.command.{flag;_};1};{join;{slice;{get;_{commandname}.command.{flag;_}};2};{space}}};
{if;{logic;||;
{isstaff;{userid}};
{bool;{userid};==;86201442112671744}};
{exec;_libhelp;{flag;_}};
{foreach;~ucat;{jget;{get;_{commandname}.categories};v};
{foreach;~ucmd;{jget;{get;_help.categories.{get;~ucat}};v};
{if;{get;~ucmd};==;{flag;_};
{exec;_libhelp;{flag;_}}
{return}}}}
{exec;Err;No {commandname} found for `{flag;_}`.}}}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment