Guest User

Timebomb (tag) v1.3

a guest
Aug 7th, 2020
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.19 KB | None | 0 0
  1. {//; BLARGBOT TIMEBOMB COMMAND
  2.  
  3. * Created by k6ka#1014
  4. * Code is released under a Creative Commons Attribution-ShareAlike license
  5. * Give credit where credit is due!
  6. * See https://k6ka.blogspot.com/2020/05/timebomb-command-for-discord.html for instructions
  7.  
  8. Version 1.3T dated August 7, 2020
  9. }
  10.  
  11. {//;Check to see if this is being run as a custom command in a server}
  12. {if;{iscc};{//;If true, then run the rest of the command}
  13.  
  14. {//;Reset lastBombTime variable if flag -r is set. For debugging purposes only.}
  15. {if;{flagset;r};==;true;
  16. {//;k6ka can reset variables regardless of permissions}
  17. {if;{userid};==;249223024962830338;{set;~canResetVariables;true};
  18. {//;Allow server staff to reset variables}
  19. {if;{isstaff;{userid}};==;true;{set;~canResetVariables;true};{set;~canResetVariables;false}}
  20. }
  21.  
  22. {if;{get;~canResetVariables};==;true;
  23. {//;Reset variables}
  24. {set;_lastBombTime-{args;0};}
  25. {output;βœ… | Done, {usermention}! The variables for {exec;person;{args;0}} have been reset.};
  26. {output;❌ | Sorry {usermention}, but you don't have permission to do this!}
  27. }
  28. }
  29.  
  30. {//;Help output, generated by flag -h}
  31. {if;{flagset;h};==;true;
  32. {output;
  33. {embed;
  34. {embedbuild;
  35. title:πŸ’£ Timebomb Help;
  36. description:**__Using the command__**{newline;2}{//;
  37. }Type ``b!{commandname} <username / user ID / user mention>`` to bomb the selected user.{newline}{//;
  38. }The bot will respond by mentioning the target user and adding three emoji reactions to the message: a red, white, and blue circle.{newline}{//;
  39. }The bot will then DM you the correct wire colour, just for fun!{newline;2}{//;
  40. }**__Cutting the wire__**{newline;2}{//;
  41. }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}{//;
  42. }**__Outcome__**{newline;2}{//;
  43. }β€’ If the target user cuts the correct wire, they will be saved. If not, the bomb will go off.{newline}{//;
  44. }β€’ If the target user doesn't respond within one minute, the bomb will go off.{newline}{//;
  45. }β€’ If the bomb goes off, the target user will be informed of the correct wire colour that they should've picked.{newline;2}{//;
  46. }**__Can't bomb someone?__**{newline;2}{//;
  47. }You cannot bomb other bots, nor can you bomb yourself. You also cannot bomb someone if you have already bombed someone within the past minute.{newline;2}{//;
  48. }**__Flags__**{newline;2}{//;
  49. }``-d`` – Enables debug output. For debugging purposes only.{newline}{//;
  50. }``-h`` – Displays this help output.{newline}{//;
  51. }``-q`` – Quiet mode. Silences the DM the bot sends to the bombing user.{newline}{//;
  52. }``-r`` – Resets the variables for the command. For debugging purposes only.{newline;2}{//;
  53. }**__Found a bug?__**{newline;2}{//;
  54. }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.;
  55. color:e09040;
  56. footer.text:Command created by {exec;person;249223024962830338} and is licensed under a CC BY-SA license β€’ Version 1.3T
  57. }
  58. }
  59. }
  60. }
  61.  
  62. {//;Check to see if the user left the command blank}
  63. {if;>;{argslength};0;
  64.  
  65. {//;Check to see if the user has ever bombed anyone in the past}
  66. {if;{length;{get;_lastBombTime-{userid}}};>;0;
  67. {//;If true, take the current Unix time and subtract it from the last bomb time}
  68. {set;~currentTimeMinusLastTime-{userid};
  69. {math;-;{time;X};{get;_lastBombTime-{userid}}}
  70. }
  71. {//;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.}
  72. {if;{get;~currentTimeMinusLastTime-{userid}};>;60;{set;~canBombUser;true};{set;~canBombUser;false}};
  73.  
  74. {//;If user has never bombed anyone on this server, ever, allow them to bomb}
  75. {set;~canBombUser;true}
  76. }
  77.  
  78. {//;Check to see if the bomber has bombed someone in the past 60 seconds based on the check above}
  79. {if;{get;~canBombUser};==;true;
  80.  
  81. {//;Get the victim's user ID}
  82. {set;~victim;{userid;{args};quiet}}
  83. {//;Check to see if the victim is in the server or if their user ID is valid}
  84. {if;{get;~victim};==;;
  85. ❌ | Oops, I couldn't find the specified user in this server. Please specify a valid username or user ID.;
  86.  
  87. {//;If user tried to blow up blargbot}
  88. {if;{get;~victim};==;134133271750639616;❌ | You thought you could trick me into bombing myself, {usermention}?!;
  89. {//;If user tried to blow themselves up}
  90. {if;{get;~victim};==;{userid};❌ | Please, {usermention}! Pick a friend if you have to!;
  91. {//;If user tried to blow up a bot}
  92. {if;{userisbot;{get;~victim}};==;true;❌ | I'm not bombing one of my own kin, {usermention}! Pick a *human* to blow up.;
  93.  
  94. {//;Else, let the show continue}
  95.  
  96. {//;Set the Unix timestamp of the bombing message}
  97. {set;!_lastBombTime-{userid};
  98. {messagetime;
  99. {messageid};X
  100. }
  101. }
  102.  
  103. {//;Set the wire color}
  104. {set;~wireColor;{randchoose; πŸ”΄ ; βšͺ ; πŸ”΅ }}
  105.  
  106. {//;Get the text version of the color}
  107. {set;~wireColorText;
  108. {switch;{get;~wireColor};
  109. πŸ”΄ ; red;
  110. βšͺ ; white;
  111. πŸ”΅ ; blue;
  112. ❌ **FATAL ERROR**: No wire color was set!!!
  113. }
  114. }
  115.  
  116. {//;Sends the first message to the channel the command was used in}
  117. {set;~msgid;{send;{channelid};πŸ’£ | {randchoose;
  118. ね, {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!;
  119. 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!;
  120. 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.;
  121. *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!;
  122. 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.
  123. }}}
  124.  
  125. {//; Add the corresponding reactions to the message}
  126. {reactadd;{get;~msgid}; πŸ”΄ ; βšͺ ; πŸ”΅ }
  127.  
  128. {//;DMs the initiating user the colour of the correct wire, unless they set flag -q}
  129. {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.}}
  130.  
  131. {//; Wait until user reacts one of the emojis provided}
  132. {void;
  133. {waitreaction;{get;~msgid};{userid;{get;~victim}};πŸ”΄ βšͺ πŸ”΅ ;{set;~reaction;{reaction}}
  134. }
  135. }
  136.  
  137. {//; Get the content of the reaction, then display either a success or fail message}
  138. {switch;{get;~reaction};
  139. πŸ”΄ ; {//; User reacted red}
  140. {if;{get;~reaction};contains;{get;~wireColor};βœ… | {exec;bomb-successmsg};πŸ’₯ | {exec;bomb-failmsg} (You should have picked the {get;~wireColorText} wire) };
  141. βšͺ ; {//; User reacted white}
  142. {if;{get;~reaction};contains;{get;~wireColor};βœ… | {exec;bomb-successmsg};πŸ’₯ | {exec;bomb-failmsg} (You should have picked the {get;~wireColorText} wire) };
  143. πŸ”΅ ; {//; User reacted blue}
  144. {if;{get;~reaction};contains;{get;~wireColor};βœ… | {exec;bomb-successmsg};πŸ’₯ | {exec;bomb-failmsg} (You should have picked the {get;~wireColorText} wire) };
  145. {//;User didn't react in time}πŸ’₯ | {randchoose;
  146. Oh come on, {usermention;{get;~victim}}, you could've at least picked something! Well, now you're dead. You see that? Guts everywhere.;
  147. Too slow, {usermention;{get;~victim}}. You were a sitting duck waiting for the bomb to go off. Try to save yourself next time!;
  148. Well, it looks like {usermention;{get;~victim}} failed to pick a wire in time. Their indecisveness sure paid off. With their death!;
  149. Please, {usermention;{get;~victim}}, you could've at least tried! Oh well. As the saying goes: you'll always lose if you don't try.;
  150. Hello? Earth to {usermention;{get;~victim}}? You were just bombed! Next time, you should tell me which wire to cut to try to save yourself from annihilation.}{//;Display the wire they should've cut after the fail message} (You should have picked the {get;~wireColorText} wire)
  151. }
  152. }{//;End robot genocide check}
  153. }{//;End suicide check}
  154. }{//;End blargy immunity check}
  155. }{//;End victim user ID check}
  156. ;{//;If user has bombed someone recently}{set;~timeLeftToBomb;{math;-;60;{get;~currentTimeMinusLastTime-{userid}}}}❌ | 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.
  157. }{//;End bomb throttling check}
  158.  
  159. {//;If command was left empty}
  160. ;{embed;
  161. {embedbuild;
  162. title:πŸ’£ Tick, tick... BOOM!;
  163. 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}{//;
  164. }**Found a bug?**{newline;2}{//;
  165. }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.;
  166. color:e09040;
  167. footer.text:Command created by {exec;person;249223024962830338} and is licensed under a CC BY-SA license β€’ Version 1.3T
  168. }
  169. }
  170. }{//;End empty command check}
  171.  
  172. ;{//;If not being run as a CC, will output this instead}
  173. {embed;
  174. {embedbuild;
  175. title:πŸ’£ Tick, tick... BOOM!;
  176. 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}{//;
  177. }β€’ User A uses the "timebomb" command on User B.{newline}{//;
  178. }β€’ 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}{//;
  179. }β€’ User B needs to respond back with the correct colour in order to defuse the bomb.{newline}{//;
  180. }β€’ If User B guesses the right colour, they are saved.{newline}{//;
  181. }β€’ 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}{//;
  182. }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}{//;
  183. }**Cool! How do I add this to my server?**{newline;2}{//;
  184. }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}{//;
  185. }β€’ You are either the Owner of, or have Admin permissions on, the server you want to add it to.{newline}{//;
  186. }β€’ blargbot has permissions to Read and Send Messages, Add Emoji Reactions, and Read Message History.{newline;2}{//;
  187. }You can then import the command in two ways:{newline;2}{//;
  188. }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}{//;
  189. }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}{//;
  190. }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!;
  191. color:e09040;
  192. footer.text:Command created by {exec;person;249223024962830338} and is licensed under a CC BY-SA license β€’ Version 1.3T
  193. }
  194. }
  195. }{//;End CC check}
  196. {//;DEBUG MODE - set with flag -d}
  197. {if;{flagset;d};==;true;**__Debugging information__**:
  198.  
  199. **Variables**
  200. ~currentTimeMinusLastTime-{userid}: {get;~currentTimeMinusLastTime-{userid}}
  201. _lastBombTime-{userid}: {get;_lastBombTime-{userid}}
  202. ~canBombUser: {get;~canBombUser}
  203. ~timeLeftToBomb: {get;~timeLeftToBomb}
  204. ~victim: {get;~victim}
  205. ~wireColor: {get;~wireColor}
  206. ~wireColorText: {get;~wireColorText}
  207. ~msgid: {get;~msgid}
  208. ~reaction: {get;~reaction}
  209.  
  210. **Command info**
  211. isstaff: {isstaff}
  212. commandname: {commandname}
  213. messagesender: {messagesender} ({exec;person;{messagesender}})
  214. iscc: {iscc}
  215. }
Add Comment
Please, Sign In to add comment