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.4T dated September 10, 2020
- }
- {//;Check to see if this is being run as a custom command in a server}
- {if;{iscc};{//;If true, then run the rest of the command}
- {//;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-{guildid}-{args;0};}
- {output;β | Done, {usermention}! The variables for {exec;person;{args;0}} have been reset.};
- {output;β | Sorry {usermention}, but you don't have permission to do this!}
- }
- }
- {//;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) 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.4T
- }
- }
- }
- }
- {//;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-{guildid}-{userid}}};>;0;
- {//;If true, take the current Unix time and subtract it from the last bomb time}
- {set;~currentTimeMinusLastTime;
- {math;-;{time;X};{get;lastBombTime-{guildid}-{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-{guildid}-{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}{exec;bomb-successmsg}};
- fail;
- {//;Modify variables}
- {set;~msgemoji;π₯}
- {//;Edit the message}
- {edit;{get;~msgid};{get;~msgemoji} | {get;~msgtext}{newline;2}{exec;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}{exec;bomb-timeoutmsg} (You should have picked the {get;~wireColorText} wire)};
- β | Uh oh, something went wrong! Please report this error to {exec;person;249223024962830338}!
- }
- }{//;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) 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.4T
- }
- }
- }{//;End empty command check}
- ;{//;If not being run as a CC, will output this instead}
- {embed;
- {embedbuild;
- title:π£ Tick, tick... BOOM!;
- description:Many IRC bots have a "timebomb" fun command that provides endless hours of ensuing fun with other users. It works a little like this:{newline;2}{//;
- }β’ User A uses the "timebomb" command on User B.{newline}{//;
- }β’ The IRC bot will ping User B and present them with a selection of coloured wires to cut, along with how much time is on the fuse.{newline}{//;
- }β’ User B needs to respond back with the correct colour in order to defuse the bomb.{newline}{//;
- }β’ If User B guesses the right colour, they are saved.{newline}{//;
- }β’ If User B guesses the wrong colour, or if they don't respond by the time the timer runs out, the bomb will go off.{newline;2}{//;
- }I couldn't find any equivalent functionality on Discord, so I made my own implementation using blargbot's BBTag language. It works pretty well, and of course, I'm making the code for it open to everyone.{newline;2}{//;
- }**Cool! How do I add this to my server?**{newline;2}{//;
- }Since this command needs the ``send`` tag, which is disabled on the public tags system, you'll need to import this command into your server as a custom command in order for it to work. Before you begin, double-check the following:{newline;2}{//;
- }β’ You are either the Owner of, or have Admin permissions on, the server you want to add it to.{newline}{//;
- }β’ blargbot has permissions to Read and Send Messages, Add Emoji Reactions, and Read Message History.{newline;2}{//;
- }You can then import the command in two ways:{newline;2}{//;
- }1. Import this command to your server by typing ``b!cc import timebomb``. It will be available for use right away, with no additional setup, and you'll get the latest updates to the command automatically.{newline}{//;
- }2. Import the command manually, which will give you more control over the command and allow you to customize it to your liking. Instructions can be found on [my blog](https://k6ka.blogspot.com/2020/05/timebomb-command-for-discord.html).{newline;2}{//;
- }I highly encourage you to give this a go and invite some of your friends over to play around with it. Relive some classic IRC fun right in the modern comforts of Discord!;
- color:e09040;
- footer.text:Command created by {exec;person;249223024962830338} and is licensed under a CC BY-SA license β’ Version 1.4T
- }
- }
- }{//;End CC check}
- {//;DEBUG MODE - set with flag -d}
- {if;{flagset;d};==;true;**__Debugging information__**:
- **Variables**
- ~currentTimeMinusLastTime: {get;~currentTimeMinusLastTime}
- lastBombTime-{guildid}-{userid}: {get;lastBombTime-{guildid}-{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}
- **Command info**
- isstaff: {isstaff}
- commandname: {commandname}
- messagesender: {messagesender} ({exec;person;{messagesender}})
- iscc: {iscc}
- }
Add Comment
Please, Sign In to add comment