Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @client.event
- async def on_ready():
- print(f"{client.user.name} is ready")
- @client.event
- async def on_message(message):
- if "discord.gg" in message.content.lower():
- await message.delete()
- await message.channel.send("No advertising!")
- swear_list = ["nigger", "nigga", "nigro"]
- for x in swear_list:
- if x in message.content.lower():
- await message.delete()
- await message.channel.send("Racism isn't allowed!")
- await client.process_commands(message)
- @client.event
- async def on_message_edit(message, newm):
- if "discord.gg" in newm.content.lower():
- await newm.delete()
- await newm.channel.send("No advertising!")
- swear_list = ["nigger", "nigga", "nigro"]
- for x in swear_list:
- if x in newm.content.lower():
- await newm.delete()
- await newm.channel.send("Racism isn't allowed!")
- @client.event
- async def on_member_join(member):
- channel = discord.utils.get(member.guild.channels, name="welcome")
- embed = discord.Embed(
- timestamp=datetime.datetime.utcnow(),
- colour=discord.Colour.blue()
- )
- embed.add_field(name="Member Joined!", value=f"Welcome {member.mention} to {member.guild.name}")
- embed.set_thumbnail(url=member.avatar_url)
- await channel.send(embed=embed)
- @client.command()
- async def new(ctx, *, subject=None):
- if not subject:
- subject = "Not provided"
- category = discord.utils.get(ctx.guild.categories, name="tickets")
- role = discord.utils.get(ctx.guild.roles, name="Sales Team")
- c.execute("INSERT INTO ticket (id, serverid) VALUES (:id, :serverid)",
- dict(id=0, serverid=ctx.guild.id))
- c.execute("UPDATE ticket SET id = id + 1 WHERE serverid = :serverid",
- dict(serverid=ctx.guild.id))
- tid, = c.execute("SELECT id FROM ticket WHERE serverid = :serverid",
- dict(serverid=ctx.guild.id)).fetchone()
- conn.commit()
- channel = await ctx.guild.create_text_channel(name=f"ticket-{tid}", category=category)
- await channel.set_permissions(target=ctx.author, send_messages=True, read_messages=True)
- await channel.set_permissions(target=ctx.guild.default_role, send_messages=False, read_messages=False)
- await channel.set_permissions(target=role, send_messages=True, read_messages=True)
- embed = discord.Embed(
- timestamp=datetime.datetime.utcnow(),
- colour=discord.Colour.blue()
- )
- embed.add_field(name="Ticket created!", value=f"You can find your ticket at: {channel.mention}")
- em = discord.Embed(
- timestamp=datetime.datetime.utcnow(),
- colour=discord.Colour.blue()
- )
- em.add_field(name="Thanks for creating a ticket", value=f"A member of the sales team will be with you shortly \n Subject: {subject}")
- await ctx.send(embed=embed)
- await channel.send(embed=em)
- @client.command()
- @commands.has_any_role("Sales Team")
- async def join(ctx, *, ticket: int = None):
- channel = discord.utils.get(ctx.guild.text_channels, name=f"ticket-{ticket}")
- if ticket is None:
- return await ctx.send("Please specify a ticket to join")
- else:
- if not channel:
- await ctx.send("No channel wit the ID")
- else:
- await ctx.send("You have been added to the ticket")
- await channel.set_permissions(target=ctx.author, send_messages=True, read_messages=True)
- @join.error
- async def check_error(ctx, error):
- if isinstance(error, commands.CheckFailure):
- await ctx.send("your not allowed to join tickets")
- @client.command()
- @commands.has_any_role("Sales Team", "Owner", "CEO", "Admin")
- async def close(ctx):
- if "ticket" in ctx.channel.name:
- await ctx.channel.delete()
- @close.error
- async def check_error(ctx, error):
- if isinstance(error, commands.CheckFailure):
- await ctx.send("your not allowed to close tickets")
- @client.command()
- @commands.has_permissions(kick_members=True)
- async def kick(ctx, member: discord.Member=None, *, reason = None):
- if member is None:
- return await ctx.send("Please specify a member")
- if not reason:
- reason = "Not provided"
- await member.kick(reason=reason)
- msg = await ctx.send(f"Successfully kicked {member.mention}")
- await asyncio.sleep(4)
- await msg.delete()
- embed = discord.Embed(
- timestamp=datetime.datetime.utcnow(),
- colour=discord.Colour.red()
- )
- embed.add_field(name="Member kicked",
- value=f"Kicked member: {member.mention} \n"
- f"Kicked by: {ctx.author.mention} \n"
- f"Reason: {reason}")
- embed.set_thumbnail(url=member.avatar_url)
- channel = discord.utils.get(ctx.guild.text_channels, name="mod-log")
- await channel.send(embed=embed)
- @kick.error
- async def kick_error(ctx, error):
- if isinstance(error, commands.CheckFailure):
- await ctx.send("Your not allowed to kick people")
- @client.command()
- @commands.has_permissions(ban_members=True)
- async def ban(ctx, member: discord.Member=None, *, reason = None):
- if member is None:
- return await ctx.send("Please specify a member")
- if not reason:
- reason = "Not provided"
- await member.ban(reason=reason)
- msg = await ctx.send(f"Successfully banned {member.mention}")
- await asyncio.sleep(4)
- await msg.delete()
- embed = discord.Embed(
- timestamp=datetime.datetime.utcnow(),
- colour=discord.Colour.red()
- )
- embed.add_field(name="Member banned",
- value=f"banned member: {member.mention} \n"
- f"banned by: {ctx.author.mention} \n"
- f"Reason: {reason}")
- embed.set_thumbnail(url=member.avatar_url)
- channel = discord.utils.get(ctx.guild.text_channels, name="mod-log")
- await channel.send(embed=embed)
- @ban.error
- async def ban_error(ctx, error):
- if isinstance(error, commands.CheckFailure):
- await ctx.send("Your not allowed to ban people")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement