Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @commands.command()
- @has_permissions(kick_members=True)
- async def warn(self, ctx, member: discord.Member, *, message):
- NoMemberEmbed = discord.Embed(
- description=f'Invalid member',
- colour=discord.Colour.orange()
- )
- WarnEmbed = discord.Embed(
- title='Command ran: Warn',
- description=f'{member.mention} was warned by a moderator ({ctx.author.mention})\nWarn message was: {message}',
- colour=discord.Colour.red()
- )
- WarnEmbedDm = discord.Embed(
- title="You were warned in Tilted's server",
- description=f'Warn message was: {message}',
- colour=discord.Colour.red()
- )
- WarnEmbedDm.set_footer(text="Take this seriously if you don't want to get kicked/banned from the server")
- if not member in ctx.guild.members:
- await ctx.send(embed=NoMemberEmbed)
- else:
- await ctx.send(embed=WarnEmbed)
- await member.send(embed=WarnEmbedDm)
- bot.database = await
- aiosqlite3.connect("tilted.db")
- c= conn.cursor()
- c.execute("""CREATE TABLE warn (
- User_id integer,
- reason text,
- warns integer
- )""")
- @warn.error
- async def warn_error(self, ctx, error):
- if isinstance(error, commands.MissingPermissions):
- WarnErrorEmbed = discord.Embed(
- description='You do not have the permissions to warn a member within this server.',
- colour=discord.Colour.red()
- )
- await ctx.send(embed=WarnErrorEmbed, delete_after=2)
- await asyncio.sleep(2)
- await ctx.message.delete()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement