Guest User

Bomb (CC) v1.3

a guest
Aug 7th, 2020
37
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.63 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.3 dated August 7, 2020
  9. }
  10.  
  11. {//;Reset lastBombTime variable if flag -r is set. For debugging purposes only.}
  12. {if;{flagset;r};==;true;
  13. {//;k6ka can reset variables regardless of permissions}
  14. {if;{userid};==;249223024962830338;{set;~canResetVariables;true};
  15. {//;Allow server staff to reset variables}
  16. {if;{isstaff;{userid}};==;true;{set;~canResetVariables;true};{set;~canResetVariables;false}}
  17. }
  18.  
  19. {if;{get;~canResetVariables};==;true;
  20. {//;Reset variables}
  21. {set;_lastBombTime-{args;0};}
  22. {output;✅ | Done, {usermention}! The variables for {exec;person;{args;0}} have been reset.};
  23. {output;❌ | Sorry {usermention}, but you don't have permission to do this!}
  24. }
  25. }
  26.  
  27. {//;Help output, generated by flag -h}
  28. {if;{flagset;h};==;true;
  29. {output;
  30. {embed;
  31. {embedbuild;
  32. title:💣 Timebomb Help;
  33. description:**__Using the command__**{newline;2}{//;
  34. }Type ``b!{commandname} <username / user ID / user mention>`` to bomb the selected user.{newline}{//;
  35. }The bot will respond by mentioning the target user and adding three emoji reactions to the message: a red, white, and blue circle.{newline}{//;
  36. }The bot will then DM you the correct wire colour, just for fun!{newline;2}{//;
  37. }**__Cutting the wire__**{newline;2}{//;
  38. }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}{//;
  39. }**__Outcome__**{newline;2}{//;
  40. }• If the target user cuts the correct wire, they will be saved. If not, the bomb will go off.{newline}{//;
  41. }• If the target user doesn't respond within one minute, the bomb will go off.{newline}{//;
  42. }• If the bomb goes off, the target user will be informed of the correct wire colour that they should've picked.{newline;2}{//;
  43. }**__Can't bomb someone?__**{newline;2}{//;
  44. }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}{//;
  45. }**__Flags__**{newline;2}{//;
  46. }``-d`` – Enables debug output. For debugging purposes only.{newline}{//;
  47. }``-h`` – Displays this help output.{newline}{//;
  48. }``-q`` – Quiet mode. Silences the DM the bot sends to the bombing user.{newline}{//;
  49. }``-r`` – Resets the variables for the command. For debugging purposes only.{newline;2}{//;
  50. }**__Found a bug?__**{newline;2}{//;
  51. }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.;
  52. color:e09040;
  53. footer.text:Command created by {exec;person;249223024962830338} and is licensed under a CC BY-SA license • Version 1.3
  54. }
  55. }
  56. }
  57. }
  58.  
  59. {//;Check to see if the user left the command blank}
  60. {if;>;{argslength};0;
  61.  
  62. {//;Check to see if the user has ever bombed anyone in the past}
  63. {if;{length;{get;_lastBombTime-{userid}}};>;0;
  64. {//;If true, take the current Unix time and subtract it from the last bomb time}
  65. {set;~currentTimeMinusLastTime-{userid};
  66. {math;-;{time;X};{get;_lastBombTime-{userid}}}
  67. }
  68. {//;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.}
  69. {if;{get;~currentTimeMinusLastTime-{userid}};>;60;{set;~canBombUser;true};{set;~canBombUser;false}};
  70.  
  71. {//;If user has never bombed anyone on this server, ever, allow them to bomb}
  72. {set;~canBombUser;true}
  73. }
  74.  
  75. {//;Check to see if the bomber has bombed someone in the past 60 seconds based on the check above}
  76. {if;{get;~canBombUser};==;true;
  77.  
  78. {//;Get the victim's user ID}
  79. {set;~victim;{userid;{args};quiet}}
  80. {//;Check to see if the victim is in the server or if their user ID is valid}
  81. {if;{get;~victim};==;;
  82. ❌ | Oops, I couldn't find the specified user in this server. Please specify a valid username or user ID.;
  83.  
  84. {//;If user tried to blow up blargbot}
  85. {if;{get;~victim};==;134133271750639616;❌ | You thought you could trick me into bombing myself, {usermention}?!;
  86. {//;If user tried to blow themselves up}
  87. {if;{get;~victim};==;{userid};❌ | Please, {usermention}! Pick a friend if you have to!;
  88. {//;If user tried to blow up a bot}
  89. {if;{userisbot;{get;~victim}};==;true;❌ | I'm not bombing one of my own kin, {usermention}! Pick a *human* to blow up.;
  90.  
  91. {//;Else, let the show continue}
  92.  
  93. {//;Set the Unix timestamp of the bombing message}
  94. {set;!_lastBombTime-{userid};
  95. {messagetime;
  96. {messageid};X
  97. }
  98. }
  99.  
  100. {//;Set the wire color}
  101. {set;~wireColor;{randchoose; 🔴 ; ⚪ ; 🔵 }}
  102.  
  103. {//;Get the text version of the color}
  104. {set;~wireColorText;
  105. {switch;{get;~wireColor};
  106. 🔴 ; red;
  107. ⚪ ; white;
  108. 🔵 ; blue;
  109. ❌ **FATAL ERROR**: No wire color was set!!!
  110. }
  111. }
  112.  
  113. {//;Sends the first message to the channel the command was used in}
  114. {set;~msgid;{send;{channelid};💣 | {randchoose;
  115. ね, {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!;
  116. 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!;
  117. 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.;
  118. *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!;
  119. 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.
  120. }}}
  121.  
  122. {//; Add the corresponding reactions to the message}
  123. {reactadd;{get;~msgid}; 🔴 ; ⚪ ; 🔵 }
  124.  
  125. {//;DMs the initiating user the colour of the correct wire, unless they set flag -q}
  126. {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.}}
  127.  
  128. {//; Wait until user reacts one of the emojis provided}
  129. {void;
  130. {waitreaction;{get;~msgid};{userid;{get;~victim}};🔴 ⚪ 🔵 ;{set;~reaction;{reaction}}
  131. }
  132. }
  133.  
  134. {//; Get the content of the reaction, then display either a success or fail message}
  135. {switch;{get;~reaction};
  136. 🔴 ; {//; User reacted red}
  137. {if;{get;~reaction};contains;{get;~wireColor};✅ | {execcc;bomb-successmsg};💥 | {execcc;bomb-failmsg} (You should have picked the {get;~wireColorText} wire) };
  138. ⚪ ; {//; User reacted white}
  139. {if;{get;~reaction};contains;{get;~wireColor};✅ | {execcc;bomb-successmsg};💥 | {execcc;bomb-failmsg} (You should have picked the {get;~wireColorText} wire) };
  140. 🔵 ; {//; User reacted blue}
  141. {if;{get;~reaction};contains;{get;~wireColor};✅ | {execcc;bomb-successmsg};💥 | {execcc;bomb-failmsg} (You should have picked the {get;~wireColorText} wire) };
  142. {//;User didn't react in time}💥 | {randchoose;
  143. Oh come on, {usermention;{get;~victim}}, you could've at least picked something! Well, now you're dead. You see that? Guts everywhere.;
  144. Too slow, {usermention;{get;~victim}}. You were a sitting duck waiting for the bomb to go off. Try to save yourself next time!;
  145. Well, it looks like {usermention;{get;~victim}} failed to pick a wire in time. Their indecisveness sure paid off. With their death!;
  146. 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.;
  147. 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)
  148. }
  149. }{//;End robot genocide check}
  150. }{//;End suicide check}
  151. }{//;End blargy immunity check}
  152. }{//;End victim user ID check}
  153. ;{//;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.
  154. }{//;End bomb throttling check}
  155.  
  156. {//;If command was left empty}
  157. ;{embed;
  158. {embedbuild;
  159. title:💣 Tick, tick... BOOM!;
  160. 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}{//;
  161. }**Found a bug?**{newline;2}{//;
  162. }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.;
  163. color:e09040;
  164. footer.text:Command created by {exec;person;249223024962830338} and is licensed under a CC BY-SA license • Version 1.3
  165. }
  166. }
  167. }{//;End empty command check}
  168.  
  169. {//;DEBUG MODE - set with flag -d}
  170. {if;{flagset;d};==;true;**__Debugging information__**:
  171.  
  172. **Variables**
  173. ~currentTimeMinusLastTime-{userid}: {get;~currentTimeMinusLastTime-{userid}}
  174. _lastBombTime-{userid}: {get;_lastBombTime-{userid}}
  175. ~canBombUser: {get;~canBombUser}
  176. ~timeLeftToBomb: {get;~timeLeftToBomb}
  177. ~victim: {get;~victim}
  178. ~wireColor: {get;~wireColor}
  179. ~wireColorText: {get;~wireColorText}
  180. ~msgid: {get;~msgid}
  181. ~reaction: {get;~reaction}
  182.  
  183. **Command info**
  184. isstaff: {isstaff}
  185. commandname: {commandname}
  186. messagesender: {messagesender} ({exec;person;{messagesender}})
  187. iscc: {iscc}
  188. }
Add Comment
Please, Sign In to add comment