-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
41 lines (34 loc) · 1.1 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import discord
from discord import app_commands
from discord.ext import commands
from tdkwrapper import tdkresponse
from dotenv import load_dotenv
import os
Bot = commands.Bot(command_prefix="/", intents=discord.Intents.all())
load_dotenv()
BOT_TOKEN = os.getenv("BOT_TOKEN")
@Bot.event
async def on_ready():
"""When the bot gets ready sync the commands."""
print("Bot is ready.")
try:
await Bot.tree.sync()
except Exception as command_sync_error:
print("Komutlar senkronize edilemedi", command_sync_error)
@Bot.tree.command(name="tdk", description="İstesiğiniz kelime'nin anlamını öğrenin.")
@app_commands.describe(kelime="Hangi kelime'nin anlamını öğrenmek istersiniz?")
async def tdk(interaction: discord.Interaction, kelime: str):
await interaction.response.send_message(
embed=discord.Embed(
title="TDK Sorgu",
description=f"> {kelime}",
)
)
await interaction.followup.send(
wait=True,
embed=discord.Embed(
title="Kelime Anlam",
description=tdkresponse(kelime),
)
)
Bot.run(BOT_TOKEN)