Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {//; BLARGBOT TIMEBOMB COMMAND
- * Created by k6ka#1014
- * Code is released under a Creative Commons Attribution-ShareAlike license
- * Give credit where credit is due!
- * See https://k6ka.blogspot.com/2020/05/timebomb-command-for-discord.html for instructions
- Version 1.5 dated September 26, 2020
- }
- {//;Reset lastBombTime variable if flag -r is set. For debugging purposes only.}
- {if;{flagset;r};==;true;
- {//;k6ka can reset variables regardless of permissions}
- {if;{userid};==;249223024962830338;{set;~canResetVariables;true};
- {//;Allow server staff to reset variables}
- {if;{isstaff;{userid}};==;true;{set;~canResetVariables;true};{set;~canResetVariables;false}}
- }
- {if;{get;~canResetVariables};==;true;
- {//;Reset variables}
- {set;lastBombTime-{flag;r};}
- {output;â | Done, {usermention}! The cooldown timer for {exec;person;{flag;r}} has been reset.};
- {output;â | Sorry {usermention}, but you don't have permission to do this!}
- }
- {return}{//;Stop the rest of the command from running}
- }
- {//;Reset scores variables if flag -t is set. For debugging purposes only.}
- {if;{flagset;t};==;true;
- {//;k6ka can reset variables regardless of permissions}
- {if;{userid};==;249223024962830338;{set;~canResetVariables;true};
- {//;Allow server staff to reset scores}
- {if;{isstaff;{userid}};==;true;{set;~canResetVariables;true};{set;~canResetVariables;false}}
- }
- {if;{get;~canResetVariables};==;true;
- {//;Reset scores}
- {set;scores-success-{flag;t};}
- {set;scores-fail-{flag;t};}
- {set;scores-timeout-{flag;t};}
- {set;scores-bombs-{flag;t};}
- {set;scores-streak-{flag;t};}
- {output;â | Done, {usermention}! The scores for {exec;person;{flag;t}} have been reset.};
- {output;â | Sorry {usermention}, but you don't have permission to do this!}
- }
- {return}{//;Stop the rest of the command from running}
- }
- {//;Scores output, generated by flag -s}
- {if;{flagset;s};==;true;
- {//;Check user input.}
- {set;~scoresUser;{userid;{flag;s};quiet}}
- {//;If user specified isn't found, default to current user.}
- {if;{get;~scoresUser};==;;{set;~scoresUser;{userid}};{//;Don't change ~scoresUser; keep it the same}}
- {output;
- {embed;
- {embedbuild;
- title:đ Timebomb Scores for {exec;person;{get;~scoresUser}};
- description:{//;
- }â Number of successful defusals: {if;{get;scores-success-{get;~scoresUser}};==;{//;Empty};0;{get;scores-success-{get;~scoresUser}}}{newline}{//;
- }đĨ Number of unsuccessful defusals: {if;{get;scores-fail-{get;~scoresUser}};==;{//;Empty};0;{get;scores-fail-{get;~scoresUser}}}{newline}{//;
- }â˛ī¸ Number of timeouts: {if;{get;scores-timeout-{get;~scoresUser}};==;{//;Empty};0;{get;scores-timeout-{get;~scoresUser}}}{newline}{//;
- }đŖ Number of bombs thrown: {if;{get;scores-bombs-{get;~scoresUser}};==;{//;Empty};0;{get;scores-bombs-{get;~scoresUser}}}{newline}{//;
- }đŠī¸ Current winning streak: {if;{get;scores-streak-{get;~scoresUser}};==;{//;Empty};0;{get;scores-streak-{get;~scoresUser}}};
- color:{if;{exec;usercolor;{get;~scoresUser}};==;;F7F8F9;{exec;usercolor;{get;~scoresUser}}};
- footer.text:Initiated by {exec;person;{userid}}
- }
- }
- }
- {return}{//;Stop the rest of the command from running}
- }
- {//;Help output, generated by flag -h}
- {if;{flagset;h};==;true;
- {output;
- {embed;
- {embedbuild;
- title:đŖ Timebomb Help;
- description:**__Using the command__**{newline;2}{//;
- }Type ``b!{commandname} <username / user ID / user mention>`` to bomb the selected user.{newline}{//;
- }The bot will respond by mentioning the target user and adding three emoji reactions to the message: a red, white, and blue circle.{newline}{//;
- }The bot will then DM you the correct wire colour, just for fun!{newline;2}{//;
- }**__Cutting the wire__**{newline;2}{//;
- }Click on one of the coloured emoji reactions the bot presents to you to cut the wire. Only the bombed user can cut the wire{semi} other users cannot cut it for them.{newline;2}{//;
- }**__Outcome__**{newline;2}{//;
- }âĸ If the target user cuts the correct wire, they will be saved. If not, the bomb will go off.{newline}{//;
- }âĸ If the target user doesn't respond within one minute, the bomb will go off.{newline}{//;
- }âĸ If the bomb goes off, the target user will be informed of the correct wire colour that they should've picked.{newline;2}{//;
- }**__Can't bomb someone?__**{newline;2}{//;
- }You cannot bomb other bots, nor can you bomb yourself. You also cannot bomb if you have already bombed someone within the past minute.{newline;2}{//;
- }**__Flags__**{newline;2}{//;
- }``-d`` â Enables debug output. For debugging purposes only.{newline}{//;
- }``-h`` â Displays this help output.{newline}{//;
- }``-q`` â Quiet mode. Silences the DM the bot sends to the bombing user.{newline}{//;
- }``-r`` â Resets the variables for the command. For debugging purposes only.{newline;2}{//;
- }**__Found a bug?__**{newline;2}{//;
- }Join the [blargbot support server](https://discord.gg/015GVxZxI8rtlJgXF "https://discord.gg/015GVxZxI8rtlJgXF") and find me, {exec;person;249223024962830338}, there. I'll do my best to help you out.;
- color:e09040;
- footer.text:Command created by {exec;person;249223024962830338} and is licensed under a CC BY-SA license âĸ Version 1.5
- }
- }
- }
- {return}{//;Stop the rest of the command from running}
- }
- {//;Check to see if the user left the command blank}
- {if;>;{argslength};0;
- {//;Check to see if the user has ever bombed anyone in the past}
- {if;{length;{get;lastBombTime-{userid}}};>;0;
- {//;If true, take the current Unix time and subtract it from the last bomb time}
- {set;~currentTimeMinusLastTime;
- {math;-;{time;X};{get;lastBombTime-{userid}}}
- }
- {//;If last bomb time was <= 60 seconds ago, do not allow user to bomb. If last bomb time was > 60 seconds ago, allow user to bomb.}
- {if;{get;~currentTimeMinusLastTime};>;60;{set;~canBombUser;true};{set;~canBombUser;false}};
- {//;If user has never bombed anyone on this server, ever, allow them to bomb}
- {set;~canBombUser;true}
- }
- {//;Check to see if the bomber has bombed someone in the past 60 seconds based on the check above}
- {if;{get;~canBombUser};==;true;
- {//;Get the victim's user ID}
- {set;~victim;{userid;{args};quiet}}
- {//;Check to see if the victim is in the server or if their user ID is valid}
- {if;{get;~victim};==;;
- â | Oops! I couldn't find the specified user in this server, {usermention}. Please specify a valid username or user ID. You can also mention the user directly.;
- {//;If user tried to blow up blargbot}
- {if;{get;~victim};==;134133271750639616;â | You thought you could trick me into bombing myself, {usermention}?!;
- {//;If user tried to blow themselves up}
- {if;{get;~victim};==;{userid};â | Please, {usermention}! Pick a friend if you have to!;
- {//;If user tried to blow up a bot}
- {if;{userisbot;{get;~victim}};==;true;â | I'm not bombing one of my own kin, {usermention}! Pick a *human* to blow up.;
- {//;Else, let the show continue}
- {//;Set the Unix timestamp of the bombing message}
- {set;!lastBombTime-{userid};
- {messagetime;
- {messageid};X
- }
- }
- {//;Set the wire color}
- {set;~wireColor;{randchoose; đ´ ; âĒ ; đĩ }}
- {//;Get the text version of the color}
- {set;~wireColorText;
- {switch;{get;~wireColor};
- đ´ ; red;
- âĒ ; white;
- đĩ ; blue;
- â **FATAL ERROR**: No wire color was set!!!
- }
- }
- {//;Generate output message text}
- {void;{set;~msgemoji;đŖ} | {set;~msgtext;{randchoose;
- ã, {usermention;{get;~victim}}, there's a stowaway in your pants! It's a bomb on a one minute timer. There are three wires: red, white, and blue. Click on the colour emoji below to cut that wire and try to defuse the bomb!;
- Hey {usermention;{get;~victim}}, someone shoved a bomb down your pants! There's one minute to go on the fuse, and there are three wires: red, white, and blue. Quick, click on the colour emoji below to tell me which wire to cut!;
- Watch out, {usermention;{get;~victim}}! There's a bomb strapped to your undies! The timer is set for one minute, and there are three wires: red, white, and blue. Click on the colour emoji below to cut that wire.;
- *Achtung!* There's a bomb down your pants, {usermention;{get;~victim}}! There's a one minute fuse on it, and there appears to be three wires: red, white, and blue. Given where it is, you should let me cut one of the wires for you{semi} click on the colour emoji below to tell me which one to cut!;
- Hey {usermention;{get;~victim}}, I saw someone put a bomb down your pants. One minute fuse, three wires: red, white, and blue. Time is running out! Click on the colour emoji below to cut that wire.
- }}}
- {//;Sends the first message to the channel the command was used in}
- {set;~msgid;{send;{channelid};{get;~msgemoji} | {get;~msgtext}}}
- {//; Add the corresponding reactions to the message}
- {reactadd;{get;~msgid}; đ´ ; âĒ ; đĩ }
- {//;DMs the initiating user the colour of the correct wire, unless they set flag -q}
- {if;{flagset;q};==;true;{//;Don't send DMs - user has set quiet mode};{dm;{userid};đ¤Ģ | Hey, don't tell {usernick;{get;~victim}}, but it's the {get;~wireColorText} wire.}}
- {//; Wait until user reacts one of the emojis provided}
- {void;
- {waitreaction;{get;~msgid};{userid;{get;~victim}};đ´ âĒ đĩ ;{set;~reaction;{reaction}}true;60
- }
- }
- {//;Process the reaction. If they picked the right colour, return success. If not, return fail. If they timed out, return timeout.}
- {void;
- {set;~result;
- {switch;{get;~reaction};
- đ´ ; {//;User reacted red}{if;{get;~reaction};contains;{get;~wireColor};success;fail};
- âĒ ; {//;User reacted white}{if;{get;~reaction};contains;{get;~wireColor};success;fail};
- đĩ ; {//;User reacted blue}{if;{get;~reaction};contains;{get;~wireColor};success;fail};
- {//;User timed out}timeout
- }
- }
- }
- {//;Display either a success, fail, or timeout message}
- {switch;{get;~result};
- success;
- {//;Modify variables}
- {set;~msgemoji;â }
- {//;Edit the message}
- {edit;{get;~msgid};{get;~msgemoji} | {get;~msgtext}{newline;2}{execcc;bomb-successmsg}};
- fail;
- {//;Modify variables}
- {set;~msgemoji;đĨ}
- {//;Edit the message}
- {edit;{get;~msgid};{get;~msgemoji} | {get;~msgtext}{newline;2}{execcc;bomb-failmsg} (You should have picked the {get;~wireColorText} wire)};
- timeout;
- {//;Modify variables}
- {set;~msgemoji;đĨ}
- {//;Edit the message}
- {edit;{get;~msgid};{get;~msgemoji} | {get;~msgtext}{newline;2}{execcc;bomb-timeoutmsg} (You should have picked the {get;~wireColorText} wire)};
- â | Uh oh, something went wrong! Please report this error to {exec;person;249223024962830338}!
- }
- {//;Set scores}
- {void;
- {//;If the variables are empty (null), fallback to 1 to count first score. This fallback shouldn't apply to things outside of this void tag.}
- {fallback;1}
- {//;Set victim's scores}
- {switch;{get;~result};
- success;{//;If success, add to their success score}
- {set;scores-success-{get;~victim};{math;+;{get;scores-success-{get;~victim}};1}}
- {//;Add to streak score}
- {set;scores-streak-{get;~victim};{math;+;{get;scores-streak-{get;~victim}};1}};
- fail;{//;If fail, add to their fail score}
- {set;scores-fail-{get;~victim};{math;+;{get;scores-fail-{get;~victim}};1}}
- {//;Reset streak score}
- {set;scores-streak-{get;~victim};};
- timeout;{//;If timeout, add to their timeout score}
- {set;scores-timeout-{get;~victim};{math;+;{get;scores-timeout-{get;~victim}};1}}
- {//;Reset streak score}
- {set;scores-streak-{get;~victim};}
- }
- {//;For bomber, set bomb count}
- {set;scores-bombs-{userid};{math;+;{get;scores-bombs-{userid}};1}}
- }
- }{//;End robot genocide check}
- }{//;End suicide check}
- }{//;End blargy immunity check}
- }{//;End victim user ID check}
- ;{//;If user has bombed someone recently}{set;~timeLeftToBomb;{math;-;60;{get;~currentTimeMinusLastTime}}}â | Hey {usermention}, it looks like you've already bombed someone in the past minute. Please wait {if;{get;~timeLeftToBomb};>;1;another {get;~timeLeftToBomb} seconds;just a few more seconds} before trying again.
- }{//;End bomb throttling check}
- {//;If command was left empty}
- ;{embed;
- {embedbuild;
- title:đŖ Tick, tick... BOOM!;
- description:Type ``b!{commandname} <username>`` to throw a bomb at someone! They have one minute to cut the correct wire or they will be blown to smithereens! Mentions will work, as will user IDs.{newline;2}{//;
- }**Found a bug?**{newline;2}{//;
- }Join the [blargbot support server](https://discord.gg/015GVxZxI8rtlJgXF "https://discord.gg/015GVxZxI8rtlJgXF") and find me, {exec;person;249223024962830338}, there. I'll do my best to help you out.;
- color:e09040;
- footer.text:Command created by {exec;person;249223024962830338} and is licensed under a CC BY-SA license âĸ Version 1.5
- }
- }
- }{//;End empty command check}
- {//;DEBUG MODE - set with flag -d}
- {if;{flagset;d};==;true;**__Debugging information__**:
- **Variables**
- ~currentTimeMinusLastTime: {get;~currentTimeMinusLastTime}
- lastBombTime-{userid}: {get;lastBombTime-{userid}}
- ~canBombUser: {get;~canBombUser}
- ~timeLeftToBomb: {get;~timeLeftToBomb}
- ~victim: {get;~victim}
- ~wireColor: {get;~wireColor}
- ~wireColorText: {get;~wireColorText}
- ~msgid: {get;~msgid}
- ~reaction: {get;~reaction}
- ~msgemoji: {get;~msgemoji}
- ~result: {get;~result}
- scores-success-{get;~victim}: {get;scores-success-{get;~victim}}
- scores-fail-{get;~victim}: {get;scores-fail-{get;~victim}}
- scores-timeout-{get;~victim}: {get;scores-timeout-{get;~victim}}
- scores-bombs-{get;~victim}: {get;scores-bombs-{get;~victim}}
- scores-streak-{get;~victim}: {get;scores-streak-{get;~victim}}
- **Command info**
- isstaff: {isstaff}
- commandname: {commandname}
- messagesender: {messagesender} ({exec;person;{messagesender}})
- iscc: {iscc}
- }
Add Comment
Please, Sign In to add comment