pychord/main.py
2025-04-06 21:17:10 +02:00

34 lines
909 B
Python

import os
import discord
from discord.commands import Option
from dotenv import load_dotenv
intents = discord.Intents.default()
intents.message_content = True # NOQA
bot = discord.Bot(intents=intents, debug_guilds=[889424923859230720])
@bot.event
async def on_ready():
print(f"{bot.user} ist online")
@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}")
@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)
load_dotenv()
bot.run(os.getenv("DISCORD_TOKEN"))