-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
97 lines (85 loc) · 2.92 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
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
import os
import discord
from discord.ext import commands
from bot_wakey import keep_alive
intents = discord.Intents.default()
intents.members = True
activity = activity = discord.Game(name="Visual Studio Code")
bot = commands.Bot(
command_prefix="!",
help_command=None,
case_insensitive=True,
activity=activity,
status=discord.Status.idle,
intents=intents
)
# kick
@bot.command(aliases=["at", "kov"])
async def kick(ctx, member: discord.Member, *, reason=None):
if ctx.message.author.id == 184317914441187328:
await member.kick(reason=reason)
await ctx.send(
str(member) + " Kicked from this server.\nReason for being kicked out: " + str(reason))
else:
await ctx.send(
"This command is currently only used by the creator because of the thought of breaking the integrity."
)
@bot.event
async def on_ready():
print("Yorungeye {0.user}".format(bot) + " olarak giris yapildi!")
@bot.event
async def on_command_error(ctx, error):
if isinstance(error, commands.CommandNotFound):
return
if isinstance(error, commands.MemberNotFound):
await ctx.send("Couldn't find the member <:peepo_shrug:895380755868446751>")
return
raise error
####### cog inserting etc.
@bot.command(aliases=["ekle"])
async def insert(ctx, extension=None):
if ctx.message.author.id == 184317914441187328:
if not extension:
await ctx.send("I can't do this without entering the cog name")
return
else:
bot.load_extension(f"cogs.{extension}")
await ctx.send(f"{extension} inserted. 🌪️")
else:
await ctx.send("only the creator can insert <:mad:895380785543131138>")
@bot.command(aliases=["çıkar"])
async def extract(ctx, extension=None):
if ctx.message.author.id == 184317914441187328:
if not extension:
await ctx.send("I can't do this without entering the cog name")
return
else:
bot.unload_extension(f"cogs.{extension}")
await ctx.send(f"{extension} extracted. 🌪️")
else:
await ctx.send("only the creator can extract <:mad:895380785543131138>")
@bot.command(aliases=["yükle"])
async def reload(ctx, extension=None):
if ctx.message.author.id == 184317914441187328:
if not extension:
await ctx.send("I can't do this without entering the cog name")
return
else:
bot.unload_extension(f"cogs.{extension}")
bot.load_extension(f"cogs.{extension}")
await ctx.send(f"{extension} reloaded. 🌪️")
else:
await ctx.send("only the creator can reload <:mad:895380785543131138>")
for filename in os.listdir("./cogs"):
if filename.endswith(".py"):
bot.load_extension(f"cogs.{filename[:-3]}")
keep_alive()
# run
my_secret = os.environ["TOKEN"]
try:
bot.run(my_secret)
except discord.errors.HTTPException:
if discord.errors.HTTPException().code == 429:
print("\n\n\nBLOCKED BY RATE LIMITS\nRESTARTING NOW\n\n\n")
os.system("python restarter.py")
os.system('kill 1')