Advertisement
Guest User

Untitled

a guest
Oct 18th, 2019
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.11 KB | None | 0 0
  1. @welcome.command(pass_context=True)
  2. @commands.has_permissions(manage_guild=True)
  3. async def setup(self, ctx):
  4. con = await asyncpg.connect("")
  5. guild = str(ctx.message.guild)
  6. def verify(m):
  7. return m.author == ctx.author and m.channel == ctx.channel
  8. shit = await con.fetchrow("SELECT * FROM golden WHERE guild_id = $1", guild)
  9. if shit is not None:
  10. return await("ur already done with the setup, use the other commands that u can view by using e!welcome to edit the other stuff")
  11. await ctx.send("where should i send the message?")
  12. answer = await self.bot.wait_for("message", timeout=30, check=verify)
  13. channel = discord.utils.get(ctx.guild.channels, name=answer.content)
  14. if not channel:
  15. return await ctx.send("thats not a valid channel")
  16. await ctx.send("ok! ima send it on that channel")
  17. await ctx.send("what role should i give to the new members? type none for no role, or type 'cancel' to cancel the setup")
  18. answer1 = self.bot.wait_for("message", timeout=30, check=verify)
  19. role = discord.utils.get(ctx.guild.roles, name=answer1.content)
  20. if answer1.content == "none":
  21. role = discord.utils.get(ctx.guild.roles, name="@everyone")
  22. await ctx.send("ok then i wont give any role to new members")
  23. if role is None:
  24. await ctx.send("thats not a valid role")
  25. await ctx.send("successfuly done!\nwhat message should i send when a new member joins? type 'cancel' to cancel the setup\n{member} is for the member's name only\n{mention} will ping the new member when he/she joins\n{tag} will send the member's name with the tag, {guild} for the guild's name\n{count} for the amount of members there are in the server after the new member joins")
  26. answer2 = self.bot.wait_for("message", timeout=30, check=verify)
  27. await ctx.send(f"successfuly done with the setup")
  28. await con.execute("INSERT INTO golden (guild_id, msg, channel_id, role_id) VALUES ($1, $2, $3, $4)", guild, answer2.content, str(channel.id), str(role.id))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement