-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathahmet-main.py
68 lines (60 loc) · 2.4 KB
/
ahmet-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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import nextcord
from nextcord import AllowedMentions, Interaction, SlashOption, ChannelType, ApplicationCheckFailure
from nextcord.ext import commands, tasks, application_checks
import os
from dotenv import load_dotenv
from cooldowns import CallableOnCooldown
import logging
logger = logging.getLogger('nextcord')
logger.setLevel(logging.DEBUG)
handler = logging.FileHandler(filename='nextcord.log', encoding='utf-8', mode='w')
handler.setFormatter(logging.Formatter('%(asctime)s:%(levelname)s:%(name)s: %(message)s'))
logger.addHandler(handler)
load_dotenv()
TOKEN = os.getenv("TOKEN")
intents = nextcord.Intents.default()
intents.members = True
client = commands.Bot(owner_ids=[482232269038288916], intents=intents)
@client.event
async def on_ready():
print("Bot hazır")
print("-----------------")
await client.change_presence(activity=nextcord.Game(name='osu!türkiye Bobble League Turnuvası yakında!'))
@client.event
async def on_application_command_error(inter: nextcord.Interaction, error):
error = getattr(error, "original", error)
if isinstance(error, CallableOnCooldown):
em = nextcord.Embed(color=0xff0000, title="**Fazla hızlısın!** :x:", description=f"{error.retry_after} saniye sonra tekrar dene.")
await inter.send(embed=em, ephemeral=True)
elif isinstance(error, ApplicationCheckFailure):
em = nextcord.Embed(color=0xff0000, title="**Error!** :x:", description=f"No permissions.")
await inter.send(embed=em, ephemeral=True)
else:
raise error
for fn in os.listdir("./cogs"):
if fn.endswith(".py"):
client.load_extension(f"cogs.{fn[:-3]}")
else:
pass
@client.slash_command(
name="cog"
)
@application_checks.is_owner()
async def cog(interaction: nextcord.Interaction):
pass
@cog.subcommand()
@application_checks.is_owner()
async def load(interaction: nextcord.Interaction, extension: str):
client.load_extension(f"cogs.{extension}")
await interaction.send("cog yüklendi!")
@cog.subcommand()
@application_checks.is_owner()
async def unload(interaction: nextcord.Interaction, extension: str):
client.unload_extension(f"cogs.{extension}")
await interaction.send("cog durduruldu!")
@cog.subcommand()
@application_checks.is_owner()
async def reload(interaction: nextcord.Interaction, extension: str):
client.reload_extension(f"cogs.{extension}")
await interaction.send("cog yeniden yüklendi!")
client.run(TOKEN)