-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
main.py
294 lines (251 loc) · 11.6 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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
#!/usr/bin/python3
#####################################################
## Black Discord (BlackDC) ##
## A discord Selfbot. ##
## https://drkbro.ml/ ##
## Coded by: drk ##
#####################################################
# Imports
from logging import exception
from urllib.parse import uses_fragment
import discord
from colorama import Fore # OLD LIB
from pystyle import Colorate, Colors # NEW LIB
import time
import os
from datetime import datetime
from discord.ext import commands, tasks
import linecache
import asyncio
import requests
import numpy
from discord.ext.commands import Bot
from discord.utils import get
from discord import Permissions
from discord.ext import *
from discord.ext.commands import bot
from discord.ext.commands.errors import *
from discord.ext.commands.errors import DiscordException, ClientException
import discord.ext.commands.errors
from discord.ext.commands.errors import CommandError, CommandNotFound
import traceback
import sys
import json
# Useful Defines
token_file_size = os.stat("./assets/token.txt").st_size
client = discord.Client()
activity = discord.Activity(type=discord.ActivityType.playing, name="BlackDC")
bot = commands.Bot (command_prefix="bdc ", self_bot=True, help_command=None, activity=activity)
def checktoken():
if token_file_size == 1:
print(f"{Colors.red}[-]{Colors.white} No local token found.")
user_token = input(f"{Colors.yellow}[?] {Colors.white}Enter a {Colors.green}VALID{Colors.white} token\n{Colors.red}>")
with open("./assets/token.txt", "w+") as file:
file.write("## DO NOT CHANGE ANY OF THIS OTHERWISE BlackDC WILL NOT WORK PROPERLY!!! If you want a new token then you should edit the token below!\n")
file.write(user_token)
file.close()
print(f"{Colors.green}[+]{Colors.white} Saved token in {Colors.yellow}./assets/token.txt{Colors.white}")
time.sleep(1.5)
clearcmd()
print(f"{Colors.yellow}[*]{Colors.white} New token found restart BlackDC to make change.")
time.sleep(1)
input(f"{Colors.yellow}Press enter to quit")
clearcmd()
quit()
else:
print(f"{Colors.green}[+]{Colors.white} Token Found: {Colors.yellow}{TOKEN}{Colors.white}")
change_yn = input(f"{Colors.yellow}[?]{Colors.white} Is this the correct token? (y/n)\n{Colors.red}>")
if change_yn == "n":
tokench = input(f"Desired new token?\n{Colors.red}>")
with open("./assets/token.txt", "w+") as file:
file.write("## DO NOT CHANGE ANY OF THIS OTHERWISE BlackDC WILL NOT WORK PROPERLY!!! If you want a new token then you should edit the token below!\n")
file.write(tokench)
file.close()
clearcmd()
print(f"{Colors.green}[+]{Colors.white} Set token as: {Colors.yellow} {tokench}")
time.sleep(1)
clearcmd()
print(f"{Colors.yellow}[*]{Colors.white} New token found restart BlackDC to make change.")
time.sleep(1)
input(f"{Colors.yellow}Press enter to quit")
clearcmd()
quit()
elif change_yn == "y":
clearcmd()
pass
else:
print(f"{Colors.red}[-]{Colors.white} Did not recognize your input. Continuing with the found token.")
time.sleep(2)
clearcmd()
TOKEN_VAR = linecache.getline('./assets/token.txt', 2)
TOKEN = TOKEN_VAR
def clearcmd():
os.system('cls' if os.name == 'nt' else 'clear')
# Global Variables
# bot = discord.Client()
now = datetime.now()
curtime = now.strftime("%H:%M")
# Main
clearcmd()
print(f"{Colors.yellow}[*] Starting BDC...")
time.sleep(1.5)
clearcmd()
checktoken()
print(f"""
{Colors.red}LICENSE AGREEMNT\n{Colors.white}
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it and removing credits is not allowed.
{Colors.yellow}https://github.com/DrkTheDon/BlackDC/blob/main/LICENSE
""")
time.sleep(3.3)
clearcmd()
@bot.event
async def on_ready():
print(f"{Colors.purple}BlackDC - V.0.7 - BETA ACCESS")
time.sleep(0.5)
print(f"{Colors.yellow}----------------------------------------------------------------------------------{Colors.white}")
print(f"{Colors.green}[+]{Colors.white} Loaded {Colors.red}BlackDC V.0.7{Colors.white} by {Colors.green}drk#1337")
time.sleep(0.5)
print(f"{Colors.yellow}----------------------------------------------------------------------------------{Colors.white}")
print(f"{Colors.green}[+]{Colors.white} Connected to {Colors.yellow}{bot.user}")
print(f"{Colors.yellow}[!]{Colors.white} Send {Colors.green}bdc help{Colors.white} In Discord to start!")
print(f"{Colors.yellow}----------------------------------------------------------------------------------\n{Colors.white}")
@bot.command()
async def help(ctx):
if ctx.author != bot.user:
return
else:
await ctx.message.delete()
print(f"{Colors.green}COMMANDS:")
print(f"""
{Colors.yellow}test{Colors.white} - tests the bot -{Colors.yellow} bdc test
{Colors.yellow}spam{Colors.white} - spams a certain message -{Colors.yellow} bdc spam <amount> <message> {Colors.red} UNDER DEVELOPMENT!
{Colors.yellow}ghostping{Colors.white} - Ghostspings people -{Colors.yellow} bdc ghostping <amount> <user>
{Colors.yellow}delchn{Colors.white} - deletes all channels in server -{Colors.yellow} bdc delchn
{Colors.yellow}crechn{Colors.white} - creates alot of channels -{Colors.yellow} bdc crechn <amount> <channelname>
{Colors.yellow}serverinfo{Colors.white} - displays info about the server-{Colors.yellow} bdc serverinfo {Colors.red} UNDER DEVELOPMENT!
{Colors.yellow}clearcmd{Colors.white} - clears the cmd/terminal -{Colors.yellow} bdc clearcmd {Colors.red} UNDER DEVELOPMENT!
""")
@bot.command()
async def test(ctx):
if ctx.author != bot.user:
print(f"{Colors.blue}{curtime} {Colors.yellow}[!] {Colors.white}Ignored command from{Colors.red} {ctx.author} {Colors.white}In {Colors.yellow}#{ctx.channel} ")
return
await ctx.message.delete()
await ctx.send(f"{ctx.author.mention} BlackDC is working!", delete_after=1.5)
print(f"{Colors.blue}{curtime} {Colors.yellow}[*] {Colors.white}BlackDC is {Colors.red}Working{Colors.white} sent in {Colors.yellow}#{ctx.channel} ")
@bot.command()
async def clearpm(ctx):
if ctx.author != bot.user:
return
await ctx.message.delete()
@bot.command()
async def clearcmd(ctx):
if ctx.author != bot.user:
return
await ctx.message.delete()
await ctx.send(f"{ctx.author.mention} Making the terminal clean!", delete_after=0.5)
clearcmd()
print(f"{Colors.purple}BlackDC - V.0.7 - BETA ACCESS")
print(f"{Colors.yellow}----------------------------------------------------------------------------------{Colors.white}")
print(f"{Colors.green}[+]{Colors.white} Loaded {Colors.red}BlackDC V.0.7{Colors.white} by {Colors.green}drk#1337")
print(f"{Colors.yellow}----------------------------------------------------------------------------------{Colors.white}")
print(f"{Colors.green}[+]{Colors.white} Connected to {Colors.yellow}{bot.user}")
print(f"{Colors.yellow}[!]{Colors.white} Send {Colors.green}bdc help{Colors.white} In Discord to start!")
print(f"{Colors.yellow}----------------------------------------------------------------------------------\n{Colors.white}")
@bot.command()
async def av(ctx, member : discord.Member = None):
if member == None:
member = ctx.author
avatar = member.avatar_url
await ctx.send(f"{ctx.member.mention}'s avatar", avatar)
@bot.command()
async def delchn(ctx):
if ctx.author != bot.user:
return
await ctx.message.delete()
for chn in ctx.guild.channels:
await chn.delete()
print(f"{Colors.blue}{curtime} {Colors.yellow}[*] {Colors.red}Deleted Channel{Colors.white}{Colors.yellow} {chn}{Colors.white}")
print(f"{Colors.blue}{curtime} {Colors.green}[+] {Colors.red}Deleted All Channels in{Colors.white}{Colors.yellow} {ctx.guild}{Colors.white}")
@bot.command()
async def crechn(ctx, amount:int, *, name):
if ctx.author != bot.user:
return
await ctx.message.delete()
guild = ctx.message.guild
for chn in range(amount):
await guild.create_text_channel(f'{name}-{chn}')
print(f"{Colors.blue}{curtime} {Colors.yellow}[*] {Colors.red}Created Channel{Colors.white}{Colors.yellow} {name}-{chn}{Colors.white} In {Colors.yellow}{guild}")
print(f"{Colors.blue}{curtime} {Colors.green}[+] {Colors.red}Created {amount} Channels in{Colors.white}{Colors.yellow} {guild}{Colors.white}")
@bot.command()
async def spam(ctx, *, message):
if ctx.author != bot.user:
return
await ctx.message.delete()
for i in range(100000):
await ctx.send(message)
if message == "stop":
return
@bot.command()
async def serverinfo(ctx):
if ctx.author != bot.user:
return
await ctx.message.delete()
guild = ctx.message.guild
for member in guild.members:
print(member)
@bot.command()
async def massban(ctx):
guild = ctx.message.guild
if ctx.author != bot.user:
return
for user in ctx.guild.members:
try:
await user.ban()
print(f"{Colors.blue}{curtime} {Colors.green}[+] {Colors.green}Succsessfully {Colors.red}Banned {user}{Colors.white}in{Colors.yellow} {guild}{Colors.white}")
except:
pass
@bot.command()
async def ghostping(ctx, amount:int, *, message):
if ctx.author != bot.user:
return
guild = ctx.message.guild
await ctx.message.delete()
for i in range(amount):
await ctx.send(message, delete_after=0.1)
await asyncio.sleep(5.0)
print(f"{Colors.blue}{curtime} {Colors.green}[+] {Colors.green}Succsessfully {Colors.red}Ghostpinged {message} {Colors.yellow}{amount} times {Colors.white}in{Colors.yellow} {guild}{Colors.white}")
# Main Run
while __name__ == '__main__':
try:
bot.run(TOKEN, bot=False)
except AttributeError:
print(f"{Colors.red}[-]{Colors.white} Attribute error, try cheking for misspellings")
except ModuleNotFoundError:
print(f"{Colors.red}[-]{Colors.white} Got An import error try following the instructions in https://github.com/DrkTheDon/BlackDC/wiki/Installation-of-BlackDC")
time.sleep(1)
quit()
except discord.errors.LoginFailure:
print(f"{Colors.purple}TOKEN: {Colors.white}{TOKEN}")
print(f"{Colors.red}[-]{Colors.white} Improper Token or disabled account.\n{Colors.yellow}NOTE:{Colors.white} If you have any quotes like \" or \' then remove them from your token in ./assets/token.txt")
time.sleep(1.5)
quit()
except KeyboardInterrupt:
print(f"{Colors.red}[-]{Colors.white} Quitting.")
time.sleep(0.5)
clearcmd()
quit()
except RuntimeError:
clearcmd()
print(f"{Colors.red}[-]{Colors.white} CTRL + C detected, quitting...")
time.sleep(0.5)
clearcmd()
quit()
@client.event
async def on_command_error(ctx, error):
if isinstance(error, discord.ext.commands.errors.CommandNotFound):
await ctx.send("Unknown command")