2025-04-04 21:52:51 +02:00
|
|
|
import os
|
2025-04-05 20:06:56 +00:00
|
|
|
import discord
|
2025-04-06 21:17:10 +02:00
|
|
|
from discord.commands import Option
|
2025-04-04 21:52:51 +02:00
|
|
|
from dotenv import load_dotenv
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
intents = discord.Intents.default()
|
|
|
|
|
intents.message_content = True # NOQA
|
|
|
|
|
|
2025-04-06 21:17:10 +02:00
|
|
|
bot = discord.Bot(intents=intents, debug_guilds=[889424923859230720])
|
2025-04-04 21:52:51 +02:00
|
|
|
|
|
|
|
|
@bot.event
|
|
|
|
|
async def on_ready():
|
|
|
|
|
print(f"{bot.user} ist online")
|
|
|
|
|
|
|
|
|
|
|
2025-04-06 21:17:10 +02:00
|
|
|
@bot.slash_command(description="Grüße einen User")
|
|
|
|
|
async def greet(ctx, user: Option(discord.User, "Der User, den du grüßen möchtest")):
|
|
|
|
|
await ctx.respond(f"Hallo {user.mention}")
|
2025-04-04 21:52:51 +02:00
|
|
|
|
|
|
|
|
|
2025-04-06 21:17:10 +02:00
|
|
|
@bot.slash_command(description="Lass den Bot eine Nachricht senden")
|
|
|
|
|
async def say(
|
|
|
|
|
ctx,
|
|
|
|
|
text: Option(str, "Der Text, den du senden möchtest"),
|
|
|
|
|
channel: Option(discord.TextChannel, "Der Channel, in den du die Nachricht senden möchtest")
|
|
|
|
|
):
|
|
|
|
|
await channel.send(text)
|
|
|
|
|
await ctx.respond("Nachricht gesendet", ephemeral=True)
|
2025-04-04 21:52:51 +02:00
|
|
|
|
|
|
|
|
|
2025-04-06 23:08:14 +02:00
|
|
|
@bot.slash_command(name="userinfo", description="Zeige Infos über einen User")
|
|
|
|
|
async def info(
|
|
|
|
|
ctx,
|
|
|
|
|
alter: Option(int, "Das Alter", min_value=1, max_value=99),
|
|
|
|
|
user: Option(discord.Member, "Gib einen User an", default=None),
|
|
|
|
|
):
|
|
|
|
|
if user is None:
|
|
|
|
|
user = ctx.author
|
|
|
|
|
|
|
|
|
|
embed = discord.Embed(
|
|
|
|
|
title=f"Infos über {user.name}",
|
|
|
|
|
description=f"Hier siehst du alle Details über {user.mention}",
|
|
|
|
|
color=discord.Color.blue()
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
time = discord.utils.format_dt(user.created_at, "R")
|
|
|
|
|
|
|
|
|
|
embed.add_field(name="Account erstellt", value=time, inline=False)
|
|
|
|
|
embed.add_field(name="ID", value=user.id)
|
|
|
|
|
embed.add_field(name="Alter", value=alter)
|
|
|
|
|
|
|
|
|
|
embed.set_thumbnail(url=ctx.author.display_avatar.url)
|
|
|
|
|
embed.set_footer(text="Das ist ein Footer")
|
|
|
|
|
|
|
|
|
|
await ctx.respond(embed=embed)
|
|
|
|
|
|
2025-04-04 21:52:51 +02:00
|
|
|
load_dotenv()
|
2025-04-05 20:21:17 +00:00
|
|
|
bot.run(os.getenv("DISCORD_TOKEN"))
|