Tutorials_for_BDFD

Giveaway

Dec 17th, 2022
225
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.70 KB | None | 0 0
  1. Variable
  2.  
  3. gw = 0¤0¤0¤0¤?
  4. gw2 =
  5.  
  6. Code 1
  7. Trigger : !gwstart
  8. Script : BDSCRIPT 2
  9.  
  10. $nomention
  11. $suppressErrors
  12. $onlyIf[$getUserVar[gw]==0¤0¤0¤0¤?;you're already hosting a giveaway]
  13. $var[t;$message[1]]
  14. $var[w;$replaceText[$message[2];w;]]
  15. $var[p;$replaceText[$replaceText[$message;$var[t];];$var[w];]]
  16. $if[$var[t]==]
  17. $description[Provide a giveaway duration]
  18. $color[#ff0000]
  19. $elseif[$isNumber[$replaceText[$replaceText[$replaceText[$var[t];s;];m;];h;]]==false]
  20. $description[Giveaway duration is invalid, provide a number]
  21. $elseif[$or[$checkContains[$var[t];s;m]==false;$checkContains[$var[t];h]==true]==true]
  22. $description[Provide a valid timer sign
  23. available: s (seconds), m (minutes)]
  24. $elseif[$and[$checkContains[$var[t];s]==true;$replaceText[$var[t];s;]>2400]==true]
  25. $description[Giveaway cannot be longer than 40 minutes]
  26. $color[#ff0000]
  27. $elseif[$replaceText[$var[t];s;]==1]
  28. $description[Giveaway duration must be more than 1 second]
  29. $color[#ff0000]
  30. $elseif[$and[$checkContains[$var[t];m]==true;$replaceText[$var[t];m;]>40]==true]
  31. $description[Giveaway cannot be longer than 40 minutes]
  32. $color[#ff0000]
  33. $elseif[$var[w]==]
  34. $description[Provide the amount of winners]
  35. $elseif[$isNumber[$var[w]]==false]
  36. $description[Provide a valid amount of winners]
  37. $color[#ff0000]
  38. $elseif[$var[w]>15]
  39. $description[Max winners are 15]
  40. $color[#ff0000]
  41. $elseif[$var[p]==]
  42. $description[provide a prize]
  43. $color[#ff0000]
  44. $elseif[$charCount[$var[p]]>256]
  45. $description[Max prize characters is 256]
  46. $color[#ff0000]
  47. $else
  48. $var[id;$sendEmbedMessage[$channelID;;$replaceText[$var[p];|;¤];;**Giveaway Duration:** $replaceText[$replaceText[$var[t];s; seconds];m; minutes]
  49. **Amount of Winners:** $var[w]
  50. **Total Entries:** 0
  51. **Hosted By:** <@$authorID>;$random[1;16777216];;;Click 🎉 Join Giveaway to join the giveaway;;;;;yes]]
  52. $setUserVar[gw;$var[id]¤$authorID¤$var[t]¤$var[w]¤$var[p]]
  53. $addButton[no;gjoin-$authorID;Join Giveaway;$randomText[primary;success];;🎉;$var[id]]
  54. $addButton[no;gleave-$authorID;Leave;danger;;;$var[id]]
  55. $var[t;there were not enough participants to determine a winner on this giveaway]
  56. $endif
  57. $async[1]
  58. $textSplit[$getUserVar[gw];¤]
  59. $var[uwu;$splitText[1]]
  60. $var[wt1;$splitText[4]]
  61. $replyIn[$splitText[3]]
  62. $textSplit[$getUserVar[gw2]; ]
  63. $var[wt2;$getTextSplitLength]
  64. $if[$var[wt2]<=1]
  65. $sendEmbedMessage[$channelID;;Jump to giveaway;https://discord.com/channels/$guildID/$channelID/$var[uwu];**$var[t]**;$random[1;16777216]]
  66. $textSplit[$getUserVar[gw];¤]
  67. $editMessage[$channelID;$splitText[1];;Giveaway Finished;**Winner$replaceText[$replaceText[$checkCondition[$splitText[4]==1];true;];false;s]:** nobody;$random[1;16777216];]
  68. $removeButtons[$splitText[1]]
  69. $setUserVar[gw;0¤0¤0¤0¤?]
  70. $setUserVar[gw2;]
  71. $else
  72. $if[$var[wt1]>$var[wt2]]
  73. $var[u;$var[wt2]]
  74. $else
  75. $var[u;$var[wt1]]
  76. $endif
  77. $var[a;$cropText[$repeatMessage[3;$repeatMessage[5;a]];$var[u];]]
  78. $textSplit[$getUserVar[gw2]; ]
  79. $var[win;$trimSpace[$eval[$replaceText[$var[a];a;<@%{DOL}%optOff[%{DOL}%splitText[%{DOL}%random[1\;%{DOL}%sum[%{DOL}%var[u\]\;1\]\]\]\]>, ;-1]]]]
  80. $var[win;$cropText[$var[win];$sub[$charCount[$var[win]];1];]]
  81. $textSplit[$getUserVar[gw];¤]
  82. $editMessage[$channelID;$splitText[1];;Giveaway Finished;**Winner$replaceText[$replaceText[$checkCondition[$splitText[4]==1];true;];false;s]:** $var[win];$random[1;16777216];Congratulations to the winner$replaceText[$replaceText[$checkCondition[$splitText[4]==1];true;];false;s]!]
  83. $sendEmbedMessage[$channelID;$var[win];Jump to giveaway;https://discord.com/channels/$guildID/$channelID/$var[uwu];Congratulations **$var[win]** for winning the giveaway for**$splitText[5]**;$random[1;16777216]]
  84. $editButton[gjoin-$authorID;Join Giveaway;secondary;yes;🎉;$splitText[1]]
  85. $editButton[gleave-$authorID;Leave;danger;yes;;$splitText[1]]
  86. $endif
  87. $setUserVar[gw;0¤0¤0¤0¤?]
  88. $setUserVar[gw2;]
  89. $endasync
  90.  
  91.  
  92. Code 2
  93. Trigger : $oninteraction
  94. Script : BDScript 2
  95.  
  96. $nomention
  97. $if[$checkContains[$customID;gjoin]]
  98. $suppressErrors
  99. $textSplit[$customID;-]
  100. $var[id;$splitText[2]]
  101. $if[$checkContains[$getUserVar[gw2;$var[id]];$authorID]]
  102. $ephemeral
  103. $title[You're already participating]
  104. $removeButtons
  105. $color[#ff0000]
  106. $else
  107. $ephemeral
  108. $removeButtons
  109. $title[You are now participating on this giveaway]
  110. $color[#38E873]
  111. $setUserVar[gw2;$trimSpace[$getUserVar[gw2;$var[id]] $authorID];$var[id]]
  112. $textSplit[$getUserVar[gw2;$var[id]]; ]
  113. $var[t;$getTextSplitLength]
  114. $textSplit[$getUserVar[gw;$var[id]];¤]
  115. $editMessage[$channelID;$splitText[1];;$replaceText[$splitText[5];|;¤];**Giveaway Duration:** $replaceText[$replaceText[$splitText[3];s; seconds];m; minutes]
  116. **Amount of Winners:** $splitText[4]
  117. **Total Entries:** $numberSeparator[$var[t]]
  118. **Hosted by:** <@$var[id]>;$random[1;16777216];Click 🎉 Join Giveaway to join the giveaway]
  119. $endif
  120. $endif
  121. $if[$checkContains[$customID;gleave]]
  122. $suppressErrors
  123. $textSplit[$customID;-]
  124. $var[id;$splitText[2]]
  125. $if[$checkContains[$getUserVar[gw2;$var[id]];$authorID]==false]
  126. $title[You aren't participating]
  127. $removeButtons
  128. $color[#ff0000]
  129. $else
  130. $ephemeral
  131. $removeButtons
  132. $textSplit[$getUserVar[gw2;$var[id]]; ]
  133. $removeSplitTextElement[$getTextSplitIndex[$authorID]]
  134. $title[You left the giveaway, you're no longer participating]
  135. $color[#38E873]
  136. $setUserVar[gw2;$joinSplitText[ ];$var[id]]
  137. $textSplit[$getUserVar[gw2;$var[id]]; ]
  138. $var[t;$sub[$getTextSplitLength;1]]
  139. $textSplit[$getUserVar[gw;$var[id]];¤]
  140. $editMessage[$channelID;$splitText[1];;$splitText[5];**Giveaway Duration:** $replaceText[$replaceText[$splitText[3];s; seconds];m; minutes]
  141. **Amount of Winners:** $splitText[4]
  142. **Total Entries:** $numberSeparator[$var[t]]
  143. **Hosted by:** <@$var[id]>;$random[1;16777216];Click 🎉 Join Giveaway to join the giveaway]
  144. $endif
  145. $endif
Advertisement
Add Comment
Please, Sign In to add comment