forked from kittymilkkers/Discord-Nuke-Bot
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
112 lines (96 loc) · 2.55 KB
/
main.py
File metadata and controls
112 lines (96 loc) · 2.55 KB
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# coding: utf-8
import os
try:
import json
except:
os.system('pip install json')
import json
try:
import aiohttp
except:
os.system('pip install aiohttp')
import aiohttp
try:
import asyncio
except:
os.system('pip install asyncio')
import asyncio
try:
import discord
except:
os.system('pip install discord.py==1.7.3')
import discord
try:
import subprocess
except:
os.system('pip install subprocess')
import subprocess
try:
import datetime
except:
os.system('pip install datetime')
import datetime
'''
import json
import aiohttp
import asyncio
import discord
import datetime
import subprocess
'''
from utils import *
from os import system, name
from discord.ext.commands.core import cooldown
from discord import Permissions
from discord.ext import (
commands,
tasks
)
intents = discord.Intents.default()
intents.members = True
client = commands.Bot(command_prefix=prefix, intents=intents)
client.remove_command('help')
def token_check():
with open("json/config.json") as f:
config = json.load(f)
token = config.get("token")
try:
client.run(token)
except Exception as e:
print(e)
while True:
token = input(f"{r}[X] {wh}Enter token your bot: ")
#config["token"] = token
#with open("json/config.json", "w") as f:
# json.dump(config, f)
try:
client.run(token)
break
except Exception as e:
print(e)
@client.command()
async def load(ctx, extension):
if ctx.author.id in developer_list:
client.load_extension(f"cogs {extension}")
await ctx.send("Cogs loaded!")
else:
await ctx.send("You are not a bot developer.")
@client.command()
async def unload(ctx, extension):
if ctx.author.id in developer_list:
client.unload_extension(f"cogs {extension}")
await ctx.send("Cogs unloaded!")
else:
await ctx.send("You are not a bot developer.")
@client.command()
async def reload(ctx, extension):
if ctx.author.id in developer_list:
client.unload_extension(f"cogs {extension}")
client.load_extension(f"cogs {extension}")
await ctx.send("Cogs reloaded!")
else:
await ctx.send("You are not a bot developer.")
for filename in os.listdir("./cogs"):
if filename.endswith(".py"):
client.load_extension(f"cogs.{filename[:-3]}")
token_check()