Guest User

Timebomb (CC) v1.4

a guest
Sep 10th, 2020
36
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.62 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.4 dated September 10, 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-{guildid}-{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 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.4
  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-{guildid}-{userid}}};>;0;
  64. {//;If true, take the current Unix time and subtract it from the last bomb time}
  65. {set;~currentTimeMinusLastTime;
  66. {math;-;{time;X};{get;lastBombTime-{guildid}-{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};>;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, {usermention}. Please specify a valid username or user ID. You can also mention the user directly.;
  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-{guildid}-{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. {//;Generate output message text}
  114. {void;{set;~msgemoji;💣} | {set;~msgtext;{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. {//;Sends the first message to the channel the command was used in}
  123. {set;~msgid;{send;{channelid};{get;~msgemoji} | {get;~msgtext}}}
  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}}true;60
  134. }
  135. }
  136.  
  137. {//;Process the reaction. If they picked the right colour, return success. If not, return fail. If they timed out, return timeout.}
  138. {void;
  139. {set;~result;
  140. {switch;{get;~reaction};
  141. 🔴 ; {//;User reacted red}{if;{get;~reaction};contains;{get;~wireColor};success;fail};
  142. ⚪ ; {//;User reacted white}{if;{get;~reaction};contains;{get;~wireColor};success;fail};
  143. 🔵 ; {//;User reacted blue}{if;{get;~reaction};contains;{get;~wireColor};success;fail};
  144. {//;User timed out}timeout
  145. }
  146. }
  147. }
  148.  
  149. {//;Display either a success, fail, or timeout message}
  150. {switch;{get;~result};
  151. success;
  152. {//;Modify variables}
  153. {set;~msgemoji;✅}
  154. {//;Edit the message}
  155. {edit;{get;~msgid};{get;~msgemoji} | {get;~msgtext}{newline;2}{execcc;bomb-successmsg}};
  156. fail;
  157. {//;Modify variables}
  158. {set;~msgemoji;💥}
  159. {//;Edit the message}
  160. {edit;{get;~msgid};{get;~msgemoji} | {get;~msgtext}{newline;2}{execcc;bomb-failmsg} (You should have picked the {get;~wireColorText} wire)};
  161. timeout;
  162. {//;Modify variables}
  163. {set;~msgemoji;💥}
  164. {//;Edit the message}
  165. {edit;{get;~msgid};{get;~msgemoji} | {get;~msgtext}{newline;2}{execcc;bomb-timeoutmsg} (You should have picked the {get;~wireColorText} wire)};
  166. ❌ | Uh oh, something went wrong! Please report this error to {exec;person;249223024962830338}!
  167. }
  168.  
  169. }{//;End robot genocide check}
  170. }{//;End suicide check}
  171. }{//;End blargy immunity check}
  172. }{//;End victim user ID check}
  173. ;{//;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.
  174. }{//;End bomb throttling check}
  175.  
  176. {//;If command was left empty}
  177. ;{embed;
  178. {embedbuild;
  179. title:💣 Tick, tick... BOOM!;
  180. 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}{//;
  181. }**Found a bug?**{newline;2}{//;
  182. }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.;
  183. color:e09040;
  184. footer.text:Command created by {exec;person;249223024962830338} and is licensed under a CC BY-SA license • Version 1.4
  185. }
  186. }
  187. }{//;End empty command check}
  188.  
  189. {//;DEBUG MODE - set with flag -d}
  190. {if;{flagset;d};==;true;**__Debugging information__**:
  191.  
  192. **Variables**
  193. ~currentTimeMinusLastTime: {get;~currentTimeMinusLastTime}
  194. lastBombTime-{guildid}-{userid}: {get;lastBombTime-{guildid}-{userid}}
  195. ~canBombUser: {get;~canBombUser}
  196. ~timeLeftToBomb: {get;~timeLeftToBomb}
  197. ~victim: {get;~victim}
  198. ~wireColor: {get;~wireColor}
  199. ~wireColorText: {get;~wireColorText}
  200. ~msgid: {get;~msgid}
  201. ~reaction: {get;~reaction}
  202. ~msgemoji: {get;~msgemoji}
  203. ~result: {get;~result}
  204.  
  205. **Command info**
  206. isstaff: {isstaff}
  207. commandname: {commandname}
  208. messagesender: {messagesender} ({exec;person;{messagesender}})
  209. iscc: {iscc}
  210. }
  211.  
Add Comment
Please, Sign In to add comment