Advertisement
Guest User

survey command

a guest
Nov 22nd, 2019
212
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.52 KB | None | 0 0
  1. takenBotSurvey = []
  2. takenServerSurvey = []
  3. curBotSurvey = []
  4. curServerSurvey = []
  5.  
  6.  
  7. @bot.command()
  8. async def survey(ctx):
  9. surveyBot = False
  10. surveyServer = False
  11. surveyBotAnswers = {}
  12. surveyServerAnswers = {}
  13. usr = ctx.message.author
  14.  
  15. def check(m):
  16. return m.author.id == usr.id and m.guild is None
  17.  
  18. if ctx.guild is None:
  19. if ctx.message.author.id in curBotSurvey or ctx.message.author.id in curServerSurvey:
  20. await ctx.send("Not gonna lie, but I think you're already taking a survey.")
  21. return
  22. botAv = " "
  23. serverAv = " "
  24. if ctx.message.author.id in takenBotSurvey:
  25. botAv = ":x:"
  26. else:
  27. botAv = "``1``"
  28. if ctx.message.author.id in takenServerSurvey:
  29. serverAv = ":x:"
  30. else:
  31. serverAv = "``2``"
  32. await asyncio.sleep(1)
  33. await ctx.send(
  34. f"Alright, {ctx.message.author.mention}. Thanks for taking your time to answer the surveys. Here are the current surveys:\n\n {botAv} **BOT SURVEY**\n {serverAv} **SERVER SURVEY**\n\nRespond with either 1 or 2.")
  35. # print(takenServerSurvey + " " + takenBotSurvey)
  36. msg1 = await bot.wait_for('message', check=check)
  37. if (msg1.content == "2") and (usr.id not in takenServerSurvey):
  38. surveyServer = True
  39. curServerSurvey.append(usr.id)
  40. elif (msg1.content == "1") and (usr.id not in takenBotSurvey):
  41. surveyBot = True
  42. curBotSurvey.append(usr.id)
  43. else:
  44. await usr.send("You've either already taken this survey or you didn't enter a correct number. Try again.")
  45. return
  46. if surveyBot:
  47. await usr.send("You're now taking the **bot survey**. Cancel anytime using ``cancel``.")
  48. await usr.send("**QUESTION 1**: What features do you currently use of the bot?")
  49. msg1 = await bot.wait_for('message', check=check)
  50. if msg1.content == "cancel":
  51. await usr.send("Canceling the survey. All answers are getting wiped out...")
  52. curBotSurvey.remove(usr.id)
  53. return
  54. else:
  55. surveyBotAnswers['answer1'] = msg1.content
  56. await asyncio.sleep(1)
  57. await usr.send("**QUESTION 2**: If you don't use the bot, what features would make you use it?")
  58. msg2 = await bot.wait_for('message', check=check)
  59. if msg2.content == "cancel":
  60. await usr.send("Canceling the survey. All answers are getting wiped out...")
  61. curBotSurvey.remove(usr.id)
  62. return
  63. else:
  64. surveyBotAnswers['answer2'] = msg2.content
  65. await asyncio.sleep(1)
  66. await usr.send("**QUESTION 3**: What features are currently not in the bot that are required in every bot?")
  67. msg3 = await bot.wait_for('message', check=check)
  68. if msg3.content == "cancel":
  69. await usr.send("Canceling the survey. All answers are getting wiped out...")
  70. curBotSurvey.remove(usr.id)
  71. return
  72. else:
  73. surveyBotAnswers['answer3'] = msg3.content
  74. await asyncio.sleep(1)
  75. await usr.send("**QUESTION 4**: Is the bot good enough for you to add it to your server yet?")
  76. msg4 = await bot.wait_for('message', check=check)
  77. if msg4.content == "cancel":
  78. await usr.send("Canceling the survey. All answers are getting wiped out...")
  79. curBotSurvey.remove(usr.id)
  80. return
  81. else:
  82. surveyBotAnswers['answer4'] = msg4.content
  83. await asyncio.sleep(1)
  84. await usr.send(
  85. "**QUESTION 5**: If you answered ``no`` on the previous question, what features are still required so you'd add the bot to your server?")
  86. msg5 = await bot.wait_for('message', check=check)
  87. if msg5.content == "cancel":
  88. await usr.send("Canceling the survey. All answers are getting wiped out...")
  89. curBotSurvey.remove(usr.id)
  90. return
  91. else:
  92. surveyBotAnswers['answer5'] = msg5.content
  93. await asyncio.sleep(1)
  94. await usr.send("**QUESTION 6**: Do you think the bot's name should be changed?")
  95. msg6 = await bot.wait_for('message', check=check)
  96. if msg6.content == "cancel":
  97. await usr.send("Canceling the survey. All answers are getting wiped out...")
  98. curBotSurvey.remove(usr.id)
  99. return
  100. else:
  101. surveyBotAnswers['answer6'] = msg6.content
  102. await asyncio.sleep(1)
  103. await usr.send("**QUESTION 7**: If the developer team makes the bot better, would you consider donating?")
  104. msg7 = await bot.wait_for('message', check=check)
  105. if msg7.content == "cancel":
  106. await usr.send("Canceling the survey. All answers are getting wiped out...")
  107. curBotSurvey.remove(usr.id)
  108. return
  109. else:
  110. surveyBotAnswers['answer7'] = msg7.content
  111. await asyncio.sleep(1)
  112. await usr.send("**QUESTION 8**: Anything else to say?")
  113. msg8 = await bot.wait_for('message', check=check)
  114. if msg8.content == "cancel":
  115. await usr.send("Canceling the survey. All answers are getting wiped out...")
  116. curBotSurvey.remove(usr.id)
  117. return
  118. else:
  119. surveyBotAnswers['answer8'] = msg8.content
  120. await asyncio.sleep(1)
  121. await usr.send("Alright, sending your answers to the dev team. Thank you for your support.")
  122. takenBotSurvey.append(usr.id)
  123. curBotSurvey.remove(usr.id)
  124. shiki = await bot.fetch_user(237938976999079948)
  125. await shiki.send(f"NEW BOT SURVEY TAKEN ({usr}, {usr.id}). ANSWERS:")
  126. for answer, value in surveyBotAnswers.items():
  127. await shiki.send(f"{value}\n----------------------")
  128.  
  129. if surveyServer:
  130. await usr.send("You're now taking the **server survey**. Cancel anytime using ``cancel``.")
  131. await usr.send("**QUESTION 1**: What do you think about the server in its current state?")
  132. msg1 = await bot.wait_for('message', check=check)
  133. if msg1.content == "cancel":
  134. await usr.send("Canceling the survey. All answers are getting wiped out...")
  135. curServerSurvey.remove(usr.id)
  136. return
  137. else:
  138. surveyServerAnswers['answer1'] = msg1.content
  139. await asyncio.sleep(1)
  140. await usr.send("**QUESTION 2**: What do you think will speed up the server growth?")
  141. msg2 = await bot.wait_for('message', check=check)
  142. if msg2.content == "cancel":
  143. await usr.send("Canceling the survey. All answers are getting wiped out...")
  144. curServerSurvey.remove(usr.id)
  145. return
  146. else:
  147. surveyServerAnswers['answer2'] = msg2.content
  148. await asyncio.sleep(1)
  149. await usr.send("**QUESTION 3**: What do you think will boost the server activity?")
  150. msg3 = await bot.wait_for('message', check=check)
  151. if msg3.content == "cancel":
  152. await usr.send("Canceling the survey. All answers are getting wiped out...")
  153. curServerSurvey.remove(usr.id)
  154. return
  155. else:
  156. surveyServerAnswers['answer3'] = msg3.content
  157. await asyncio.sleep(1)
  158. await usr.send("**QUESTION 4**: If we gave you nitro, would you boost our server?")
  159. msg4 = await bot.wait_for('message', check=check)
  160. if msg4.content == "cancel":
  161. await usr.send("Canceling the survey. All answers are getting wiped out...")
  162. curServerSurvey.remove(usr.id)
  163. return
  164. else:
  165. surveyServerAnswers['answer4'] = msg4.content
  166. await asyncio.sleep(1)
  167. await usr.send("**QUESTION 5**: Would you be active if the chat is active too?")
  168. msg5 = await bot.wait_for('message', check=check)
  169. if msg5.content == "cancel":
  170. await usr.send("Canceling the survey. All answers are getting wiped out...")
  171. curServerSurvey.remove(usr.id)
  172. return
  173. else:
  174. surveyServerAnswers['answer5'] = msg5.content
  175. await asyncio.sleep(1)
  176. await usr.send(
  177. "**QUESTION 6**: Why do people stay in a server, and what improvements to our server would make people stay in it and possibly be active?")
  178. msg6 = await bot.wait_for('message', check=check)
  179. if msg6.content == "cancel":
  180. await usr.send("Canceling the survey. All answers are getting wiped out...")
  181. curServerSurvey.remove(usr.id)
  182. return
  183. else:
  184. surveyServerAnswers['answer6'] = msg6.content
  185. await asyncio.sleep(1)
  186. await usr.send("**QUESTION 7**: Anything left to say?")
  187. msg7 = await bot.wait_for('message', check=check)
  188. if msg7.content == "cancel":
  189. await usr.send("Canceling the survey. All answers are getting wiped out...")
  190. curServerSurvey.remove(usr.id)
  191. return
  192. else:
  193. surveyServerAnswers['answer7'] = msg7.content
  194. await asyncio.sleep(1)
  195. await usr.send("Alright, sending your answers to the server owners. Thank you for your support.")
  196. takenServerSurvey.append(usr.id)
  197. curServerSurvey.remove(usr.id)
  198. shiki = await bot.fetch_user(237938976999079948)
  199. await shiki.send(f"NEW SERVER SURVEY TAKEN ({usr}, {usr.id}). ANSWERS:")
  200. for answer, value in surveyServerAnswers.items():
  201. await shiki.send(f"{value}\n----------------------")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement