0% found this document useful (0 votes)
93 views2 pages

Message

The document contains code for a discord bot that defines several commands. It includes commands for help, staffhelp, support, and ticket. The help and staffhelp commands send embed messages with information about available commands. The support command sends a direct message to the author. The ticket command creates an interactive button to open a ticket channel when clicked.

Uploaded by

AW-E-SOME
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
93 views2 pages

Message

The document contains code for a discord bot that defines several commands. It includes commands for help, staffhelp, support, and ticket. The help and staffhelp commands send embed messages with information about available commands. The support command sends a direct message to the author. The ticket command creates an interactive button to open a ticket channel when clicked.

Uploaded by

AW-E-SOME
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

@client.

command(pass_context=True)
async def help(ctx):

embed = discord.Embed(
colour = discord.Colour.blue()
)

embed.set_author(name='Standard Commands')
embed.add_field(name='!ping', value='Zeigt den Ping des Bots an.',
inline=False)

await ctx.send(embed=embed)

@client.command(pass_context=True)
async def staffhelp(ctx):

embed = discord.Embed(
colour = discord.Colour.red()
)

embed.set_author(name='Standard Commands')
embed.add_field(name='!ping', value='Zeigt den Ping des Bots an.',
inline=False)
embed.add_field(name='!kick', value='Kickt einen User', inline=False)
embed.add_field(name='!ban', value='Bannt einen User', inline=False)
embed.add_field(name='!unban', value='Entbannt einen User', inline=False)
embed.add_field(name='!clear', value='Cleart den Text Channel', inline=False)
embed.add_field(name='!ticket', value='Erstellt ein Ticket Feld', inline=False)

await ctx.send(embed=embed)

@client.command()
async def support(ctx):
await ctx.author.send("Dieser Command ist bald verfügbar.")

#------------------------- Ticket System ---------------------------------------

class CreateButton(View):
def __init__(self):
super().__init__(timeout=None)

@discord.ui.button(label="Erstelle ein Ticket",


style=discord.ButtonStyle.blurple, emoji="🎫", custom_id="ticketopen")
async def ticket(self, button: discord.ui.Button, interaction:
discord.Interaction):
await interaction.response.defer(ephemeral=True)
category = discord.utils.get(interaction.guild.categories,
id=1122195173514936340)
for ch in category.text_channels:
if ch.topic == f"{interaction.user.id} NICHT DAS THEMA VON DEM CHANNEL
ÄNDERN":
await interaction.followup.send("Du hast schon ein offenes Ticket
in {0}".format(ch.mention),
ephemeral=True)
return

r1 = interaction.guild.get_role(1122196686362648697)
overwrites = {
interaction.guild.default_role:
discord.PermissionOverwrite(read_messages=False),
r1: discord.PermissionOverwrite(read_messages=True, send_messages=True,
manage_messages=True),
interaction.user: discord.PermissionOverwrite(read_messages=True,
send_messages=True),
interaction.guild.me: discord.PermissionOverwrite(read_messages=True,
send_messages=True)
}
channel = await category.create_text_channel(
name=str(interaction.user),
topic=f"{interaction.user.id} NICHT DAS THEMA VON DEM CHANNEL ÄNDERN!",
overwrites=overwrites
)
await interaction.followup.send(
embed=discord.Embed(
description="Dein Ticket wurde hier erstellt:
{0}".format(channel.mention),
color=discord.Color.blurple()
)
)

@client.command(name="ticket")
@commands.has_permissions(administrator=True)
async def ticket(ctx):
button_view = CreateButton()
await ctx.send("Drücke den Button, um ein Ticket zu öffnen.", view=button_view)

You might also like