Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @welcome.command(pass_context=True)
- @commands.has_permissions(manage_guild=True)
- async def setup(self, ctx):
- con = await asyncpg.connect("")
- guild = str(ctx.message.guild)
- def verify(m):
- return m.author == ctx.author and m.channel == ctx.channel
- shit = await con.fetchrow("SELECT * FROM golden WHERE guild_id = $1", guild)
- if shit is not None:
- 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")
- await ctx.send("where should i send the message?")
- answer = await self.bot.wait_for("message", timeout=30, check=verify)
- channel = discord.utils.get(ctx.guild.channels, name=answer.content)
- if not channel:
- return await ctx.send("thats not a valid channel")
- await ctx.send("ok! ima send it on that channel")
- await ctx.send("what role should i give to the new members? type none for no role, or type 'cancel' to cancel the setup")
- answer1 = self.bot.wait_for("message", timeout=30, check=verify)
- role = discord.utils.get(ctx.guild.roles, name=answer1.content)
- if answer1.content == "none":
- role = discord.utils.get(ctx.guild.roles, name="@everyone")
- await ctx.send("ok then i wont give any role to new members")
- if role is None:
- await ctx.send("thats not a valid role")
- 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")
- answer2 = self.bot.wait_for("message", timeout=30, check=verify)
- await ctx.send(f"successfuly done with the setup")
- 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