-
Notifications
You must be signed in to change notification settings - Fork 147
Expand file tree
/
Copy pathmain.py
More file actions
995 lines (798 loc) · 39.5 KB
/
main.py
File metadata and controls
995 lines (798 loc) · 39.5 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
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
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
import discord
from discord.ext import commands
import ctypes
import json
import os
import random
import requests
import asyncio
import string
import time
import datetime
from colorama import Fore
import platform
import itertools
from gtts import gTTS
import io
import qrcode
import pyfiglet
y = Fore.LIGHTYELLOW_EX
b = Fore.LIGHTBLUE_EX
w = Fore.LIGHTWHITE_EX
__version__ = "3.2"
start_time = datetime.datetime.now(datetime.timezone.utc)
with open("config/config.json", "r") as file:
config = json.load(file)
token = config.get("token")
prefix = config.get("prefix")
message_generator = itertools.cycle(config["autoreply"]["messages"])
def save_config(config):
with open("config/config.json", "w") as file:
json.dump(config, file, indent=4)
def selfbot_menu(bot):
if platform.system() == "Windows":
os.system('cls')
else:
os.system('clear')
print(f"""\n{Fore.RESET}
██████╗ ████████╗██╗ ██████╗ ████████╗ ██████╗ ██████╗ ██╗
██╔═══██╗╚══██╔══╝██║██╔═══██╗ ╚══██╔══╝██╔═══██╗██╔═══██╗██║
██║██╗██║ ██║ ██║██║ ██║ ██║ ██║ ██║██║ ██║██║
██║██║██║ ██║ ██║██║ ██║ ██║ ██║ ██║██║ ██║██║
╚█║████╔╝ ██║ ██║╚██████╔╝ ██║ ╚██████╔╝╚██████╔╝███████╗
╚╝╚═══╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═════╝ ╚═════╝ ╚══════╝\n""".replace('█', f'{b}█{y}'))
print(f"""{y}------------------------------------------------------------------------------------------------------------------------
{w}raadev {b}|{w} https://github.com/AstraaDev {b}|{w} https://github.com/AstraaDev {b}|{w} https://github.com/AstraaDev {b}|{w} https://github.com
{y}------------------------------------------------------------------------------------------------------------------------\n""")
print(f"""{y}[{b}+{y}]{w} SelfBot Information:\n
\t{y}[{w}#{y}]{w} Version: v{__version__}
\t{y}[{w}#{y}]{w} Logged in as: {bot.user} ({bot.user.id})
\t{y}[{w}#{y}]{w} Cached Users: {len(bot.users)}
\t{y}[{w}#{y}]{w} Guilds Connected: {len(bot.guilds)}\n\n
{y}[{b}+{y}]{w} Settings Overview:\n
\t{y}[{w}#{y}]{w} SelfBot Prefix: {prefix}
\t{y}[{w}#{y}]{w} Remote Users Configured:""")
if config["remote-users"]:
for i, user_id in enumerate(config["remote-users"], start=1):
print(f"\t\t{y}[{w}{i}{y}]{w} User ID: {user_id}")
else:
print(f"\t\t{y}[{w}-{y}]{w} No remote users configured.")
print(f"""
\t{y}[{w}#{y}]{w} Active Autoreply Channels: {len(config["autoreply"]["channels"])}
\t{y}[{w}#{y}]{w} Active Autoreply Users: {len(config["autoreply"]["users"])}\n
\t{y}[{w}#{y}]{w} AFK Status: {'Enabled' if config["afk"]["enabled"] else 'Disabled'}
\t{y}[{w}#{y}]{w} AFK Message: "{config["afk"]["message"]}"\n
\t{y}[{w}#{y}]{w} Total Commands Loaded: 43\n\n
{y}[{Fore.GREEN}!{y}]{w} SelfBot is now online and ready!""")
bot = commands.Bot(command_prefix=prefix, description='not a selfbot', self_bot=True, help_command=None)
@bot.event
async def on_ready():
if platform.system() == "Windows":
ctypes.windll.kernel32.SetConsoleTitleW(f"SelfBot v{__version__} - Made By a5traa")
os.system('cls')
else:
os.system('clear')
selfbot_menu(bot)
@bot.event
async def on_message(message):
if message.author.id in config["copycat"]["users"]:
if message.content.startswith(config['prefix']):
response_message = message.content[len(config['prefix']):]
await message.reply(response_message)
else:
await message.reply(message.content)
if config["afk"]["enabled"]:
if bot.user in message.mentions and message.author != bot.user:
await message.reply(config["afk"]["message"])
return
elif isinstance(message.channel, discord.DMChannel) and message.author != bot.user:
await message.reply(config["afk"]["message"])
return
if message.author != bot.user:
if str(message.author.id) in config["autoreply"]["users"]:
autoreply_message = next(message_generator)
await message.reply(autoreply_message)
return
elif str(message.channel.id) in config["autoreply"]["channels"]:
autoreply_message = next(message_generator)
await message.reply(autoreply_message)
return
if message.guild and message.guild.id == 1279905004181917808 and message.content.startswith(config['prefix']):
await message.delete()
await message.channel.send("> SelfBot commands are not allowed here. Thanks.", delete_after=5)
return
if message.author != bot.user and str(message.author.id) not in config["remote-users"]:
return
await bot.process_commands(message)
@bot.event
async def on_command_error(ctx, error):
if isinstance(error, commands.CommandNotFound):
return
@bot.command(aliases=['h'])
async def help(ctx):
await ctx.message.delete()
help_text = f"""
**Astraa SelfBot | Prefix: `{prefix}`**\n
**Commands:**\n
> :space_invader: `{prefix}astraa` - Show my social networks.
> :wrench: `{prefix}changeprefix <prefix>` - Change the bot's prefix.
> :x: `{prefix}shutdown` - Stop the selfbot.
> :notepad_spiral: `{prefix}uptime` - Returns how long the selfbot has been running.
> :closed_lock_with_key: `{prefix}remoteuser <@user>` - Authorize a user to execute commands remotely.
> :robot: `{prefix}copycat ON|OFF <@user>` - Automatically reply with the same message whenever the mentioned user speaks.
> :pushpin: `{prefix}ping` - Returns the bot's latency.
> :pushpin: `{prefix}pingweb <url>` - Ping a website and return the HTTP status code (e.g., 200 if online).
> :gear: `{prefix}geoip <ip>` - Looks up the IP's location.
> :microphone: `{prefix}tts <text>` - Converts text to speech and sends an audio file (.wav).
> :hash: `{prefix}qr <text>` - Generate a QR code from the provided text and send it as an image.
> :detective: `{prefix}hidemention <display_part> <hidden_part>` - Hide messages inside other messages.
> :wrench: `{prefix}edit <message>` - Move the position of the (edited) tag.
> :arrows_counterclockwise: `{prefix}reverse <message>` - Reverse the letters of a message.
> :notepad_spiral: `{prefix}gentoken` - Generate an invalid but correctly patterned token.
> :woozy_face: `{prefix}hypesquad <house>` - Change your HypeSquad badge.
> :dart: `{prefix}nitro` - Generate a fake Nitro code.
> :hammer: `{prefix}whremove <webhook_url>` - Remove a webhook.
> :broom: `{prefix}purge <amount>` - Delete a specific number of messages.
> :broom: `{prefix}clear` - Clear messages from a channel.
> :broom: `{prefix}cleardm <amount>` - Delete all DMs with a user."""
await ctx.send(help_text)
help_text = f"""
> :writing_hand: `{prefix}spam <amount> <message>` - Spams a message for a given amount of times.
> :tools: `{prefix}quickdelete <message>` - Send a message and delete it after 2 seconds.
> :tools: `{prefix}autoreply <ON|OFF>` - Enable or disable automatic replies.
> :zzz: `{prefix}afk <ON/OFF>` - Enable or disable AFK mode. Sends a custom message when receiving a DM or being mentioned.
> :busts_in_silhouette: `{prefix}fetchmembers` - Retrieve the list of all members in the server.
> :scroll: `{prefix}firstmessage` - Get the link to the first message in the current channel.
> :mega: `{prefix}dmall <message>` - Send a message to all members in the server.
> :mega: `{prefix}sendall <message>` - Send a message to all channels in the server.
> :busts_in_silhouette: `{prefix}guildicon` - Get the icon of the current server.
> :space_invader: `{prefix}usericon <@user>` - Get the profile picture of a user.
> :star: `{prefix}guildbanner` - Get the banner of the current server.
> :page_facing_up: `{prefix}tokeninfo <token>` - Scrape info with a token.
> :pager: `{prefix}guildinfo` - Get information about the current server.
> :memo: `{prefix}guildrename <new_name>` - Rename the server.
> :video_game: `{prefix}playing <status>` - Set the bot's activity status as "Playing".
> :tv: `{prefix}watching <status>` - Set the bot's activity status as "Watching".
> :x: `{prefix}stopactivity` - Reset the bot's activity status.
> :art: `{prefix}ascii <message>` - Convert a message to ASCII art.
> :airplane: `{prefix}airplane` - Sends a 9/11 attack (warning: use responsibly).
> :fire: `{prefix}dick <@user>` - Show the "size" of a user's dick.
> :x: `{prefix}minesweeper <width> <height>` - Play a game of Minesweeper with custom grid size.
> :robot: `{prefix}leetpeek <message>` - Speak like a hacker, replacing letters."""
await ctx.send(help_text)
@bot.command()
async def uptime(ctx):
await ctx.message.delete()
now = datetime.datetime.now(datetime.timezone.utc)
delta = now - start_time
hours, remainder = divmod(int(delta.total_seconds()), 3600)
minutes, seconds = divmod(remainder, 60)
days, hours = divmod(hours, 24)
if days:
time_format = "**{d}** days, **{h}** hours, **{m}** minutes, and **{s}** seconds."
else:
time_format = "**{h}** hours, **{m}** minutes, and **{s}** seconds."
uptime_stamp = time_format.format(d=days, h=hours, m=minutes, s=seconds)
await ctx.send(uptime_stamp)
@bot.command()
async def ping(ctx):
await ctx.message.delete()
before = time.monotonic()
message_to_send = await ctx.send("Pinging...")
await message_to_send.edit(content=f"`{int((time.monotonic() - before) * 1000)} ms`")
@bot.command(aliases=['astra'])
async def astraa(ctx):
await ctx.message.delete()
embed = f"""**MY SOCIAL NETWORKS | Prefix: `{prefix}`**\n
> :pager: `Discord Server`\n*https://discord.gg/PKR7nM9j9U*
> :computer: `GitHub Page`\n*https://github.com/AstraaDev*
> :robot: `SelfBot Project`\n*https://github.com/AstraaDev/Discord-SelfBot*"""
await ctx.send(embed)
@bot.command()
async def geoip(ctx, ip: str=None):
await ctx.message.delete()
if not ip:
await ctx.send("> **[ERROR]**: Invalid command.\n> __Command__: `geoip <ip>`", delete_after=5)
return
try:
r = requests.get(f'http://ip-api.com/json/{ip}')
geo = r.json()
embed = f"""**GEOLOCATE IP | Prefix: `{prefix}`**\n
> :pushpin: `IP`\n*{geo['query']}*
> :globe_with_meridians: `Country-Region`\n*{geo['country']} - {geo['regionName']}*
> :department_store: `City`\n*{geo['city']} ({geo['zip']})*
> :map: `Latitute-Longitude`\n*{geo['lat']} - {geo['lon']}*
> :satellite: `ISP`\n*{geo['isp']}*
> :robot: `Org`\n*{geo['org']}*
> :alarm_clock: `Timezone`\n*{geo['timezone']}*
> :electric_plug: `As`\n*{geo['as']}*"""
await ctx.send(embed, file=discord.File("img/astraa.gif"))
except Exception as e:
await ctx.send(f'> **[**ERROR**]**: Unable to geolocate ip\n> __Error__: `{str(e)}`', delete_after=5)
@bot.command()
async def tts(ctx, *, content: str=None):
await ctx.message.delete()
if not content:
await ctx.send("> **[ERROR]**: Invalid command.\n> __Command__: `tts <message>`", delete_after=5)
return
content = content.strip()
tts = gTTS(text=content, lang="en")
f = io.BytesIO()
tts.write_to_fp(f)
f.seek(0)
await ctx.send(file=discord.File(f, f"{content[:10]}.wav"))
@bot.command(aliases=['qrcode'])
async def qr(ctx, *, text: str="https://discord.gg/PKR7nM9j9U"):
qr = qrcode.make(text)
img_byte_arr = io.BytesIO()
qr.save(img_byte_arr)
img_byte_arr.seek(0)
await ctx.send(file=discord.File(img_byte_arr, "qr_code.png"))
@bot.command()
async def pingweb(ctx, website_url: str=None):
await ctx.message.delete()
if not website_url:
await ctx.send("> **[ERROR]**: Invalid command.\n> __Command__: `pingweb <url>`", delete_after=5)
return
try:
r = requests.get(website_url).status_code
if r == 404:
await ctx.send(f'> Website **down** *({r})*')
else:
await ctx.send(f'> Website **operational** *({r})*')
except Exception as e:
await ctx.send(f'> **[**ERROR**]**: Unable to ping website\n> __Error__: `{str(e)}`', delete_after=5)
@bot.command()
async def gentoken(ctx, user: str=None):
await ctx.message.delete()
code = "ODA"+random.choice(string.ascii_letters)+''.join(random.choice(string.ascii_letters + string.digits) for _ in range(20))+"."+random.choice(string.ascii_letters).upper()+''.join(random.choice(string.ascii_letters + string.digits) for _ in range(5))+"."+''.join(random.choice(string.ascii_letters + string.digits) for _ in range(27))
if not user:
await ctx.send(''.join(code))
else:
await ctx.send(f"> {user}'s token is: ||{''.join(code)}||")
@bot.command()
async def quickdelete(ctx, *, message: str=None):
await ctx.message.delete()
if not message:
await ctx.send(f'> **[**ERROR**]**: Invalid input\n> __Command__: `quickdelete <message>`', delete_after=2)
return
await ctx.send(message, delete_after=2)
@bot.command(aliases=['uicon'])
async def usericon(ctx, user: discord.User = None):
await ctx.message.delete()
if not user:
await ctx.send(f'> **[**ERROR**]**: Invalid input\n> __Command__: `usericon <@user>`', delete_after=5)
return
avatar_url = user.avatar.url if user.avatar else user.default_avatar.url
await ctx.send(f"> {user.mention}'s avatar:\n{avatar_url}")
@bot.command(aliases=['tinfo'])
async def tokeninfo(ctx, usertoken: str=None):
await ctx.message.delete()
if not usertoken:
await ctx.send(f'> **[**ERROR**]**: Invalid input\n> __Command__: `tokeninfo <token>`', delete_after=5)
return
headers = {'Authorization': usertoken, 'Content-Type': 'application/json'}
languages = {
'da': 'Danish, Denmark',
'de': 'German, Germany',
'en-GB': 'English, United Kingdom',
'en-US': 'English, United States',
'es-ES': 'Spanish, Spain',
'fr': 'French, France',
'hr': 'Croatian, Croatia',
'lt': 'Lithuanian, Lithuania',
'hu': 'Hungarian, Hungary',
'nl': 'Dutch, Netherlands',
'no': 'Norwegian, Norway',
'pl': 'Polish, Poland',
'pt-BR': 'Portuguese, Brazilian, Brazil',
'ro': 'Romanian, Romania',
'fi': 'Finnish, Finland',
'sv-SE': 'Swedish, Sweden',
'vi': 'Vietnamese, Vietnam',
'tr': 'Turkish, Turkey',
'cs': 'Czech, Czechia, Czech Republic',
'el': 'Greek, Greece',
'bg': 'Bulgarian, Bulgaria',
'ru': 'Russian, Russia',
'uk': 'Ukrainian, Ukraine',
'th': 'Thai, Thailand',
'zh-CN': 'Chinese, China',
'ja': 'Japanese',
'zh-TW': 'Chinese, Taiwan',
'ko': 'Korean, Korea'
}
try:
res = requests.get('https://discordapp.com/api/v6/users/@me', headers=headers)
res.raise_for_status()
except requests.exceptions.RequestException as e:
await ctx.send(f'> **[**ERROR**]**: An error occurred while sending request\n> __Error__: `{str(e)}`', delete_after=5)
return
if res.status_code == 200:
res_json = res.json()
user_name = f'{res_json["username"]}#{res_json["discriminator"]}'
user_id = res_json['id']
avatar_id = res_json['avatar']
avatar_url = f'https://cdn.discordapp.com/avatars/{user_id}/{avatar_id}.gif'
phone_number = res_json['phone']
email = res_json['email']
mfa_enabled = res_json['mfa_enabled']
flags = res_json['flags']
locale = res_json['locale']
verified = res_json['verified']
days_left = ""
language = languages.get(locale)
creation_date = datetime.datetime.fromtimestamp(((int(user_id) >> 22) + 1420070400000) / 1000).strftime('%d-%m-%Y %H:%M:%S UTC')
has_nitro = False
try:
nitro_res = requests.get('https://discordapp.com/api/v6/users/@me/billing/subscriptions', headers=headers)
nitro_res.raise_for_status()
nitro_data = nitro_res.json()
has_nitro = bool(len(nitro_data) > 0)
if has_nitro:
d1 = datetime.datetime.strptime(nitro_data[0]["current_period_end"].split('.')[0], "%Y-%m-%dT%H:%M:%S")
d2 = datetime.datetime.strptime(nitro_data[0]["current_period_start"].split('.')[0], "%Y-%m-%dT%H:%M:%S")
days_left = abs((d2 - d1).days)
except requests.exceptions.RequestException as e:
pass
try:
embed = f"""**TOKEN INFORMATIONS | Prefix: `{prefix}`**\n
> :dividers: __Basic Information__\n\tUsername: `{user_name}`\n\tUser ID: `{user_id}`\n\tCreation Date: `{creation_date}`\n\tAvatar URL: `{avatar_url if avatar_id else "None"}`
> :crystal_ball: __Nitro Information__\n\tNitro Status: `{has_nitro}`\n\tExpires in: `{days_left if days_left else "None"} day(s)`
> :incoming_envelope: __Contact Information__\n\tPhone Number: `{phone_number if phone_number else "None"}`\n\tEmail: `{email if email else "None"}`
> :shield: __Account Security__\n\t2FA/MFA Enabled: `{mfa_enabled}`\n\tFlags: `{flags}`
> :paperclip: __Other__\n\tLocale: `{locale} ({language})`\n\tEmail Verified: `{verified}`"""
await ctx.send(embed, file=discord.File("img/astraa.gif"))
except Exception as e:
await ctx.send(f'> **[**ERROR**]**: Unable to recover token infos\n> __Error__: `{str(e)}`', delete_after=5)
else:
await ctx.send(f'> **[**ERROR**]**: Unable to recover token infos\n> __Error__: Invalid token', delete_after=5)
@bot.command()
async def cleardm(ctx, amount: str="1"):
await ctx.message.delete()
if not amount.isdigit():
await ctx.send(f'> **[**ERROR**]**: Invalid amount specified. It must be a number.\n> __Command__: `{config["prefix"]}cleardm <amount>`', delete_after=5)
return
amount = int(amount)
if amount <= 0 or amount > 100:
await ctx.send(f'> **[**ERROR**]**: Amount must be between 1 and 100.', delete_after=5)
return
if not isinstance(ctx.channel, discord.DMChannel):
await ctx.send(f'> **[**ERROR**]**: This command can only be used in DMs.', delete_after=5)
return
deleted_count = 0
async for message in ctx.channel.history(limit=amount):
if message.author == bot.user:
try:
await message.delete()
deleted_count += 1
except discord.Forbidden:
await ctx.send(f'> **[**ERROR**]**: Missing permissions to delete messages.', delete_after=5)
return
except discord.HTTPException as e:
await ctx.send(f'> **[**ERROR**]**: An error occurred while deleting messages: {str(e)}', delete_after=5)
return
await ctx.send(f'> **Cleared {deleted_count} messages in DMs.**', delete_after=5)
@bot.command(aliases=['hs'])
async def hypesquad(ctx, house: str=None):
await ctx.message.delete()
if not house:
await ctx.send(f'> **[**ERROR**]**: Invalid input\n> __Command__: `hypesquad <house>`', delete_after=5)
return
headers = {'Authorization': token, 'Content-Type': 'application/json'}
try:
r = requests.get('https://discord.com/api/v8/users/@me', headers=headers)
r.raise_for_status()
except requests.exceptions.RequestException as e:
await ctx.send(f'> **[**ERROR**]**: Invalid status code\n> __Error__: `{str(e)}`', delete_after=5)
return
headers = {'Authorization': token, 'Content-Type': 'application/json', 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) discord/0.0.305 Chrome/69.0.3497.128 Electron/4.0.8 Safari/537.36'}
payload = {}
if house == "bravery":
payload = {'house_id': 1}
elif house == "brilliance":
payload = {'house_id': 2}
elif house == "balance":
payload = {'house_id': 3}
else:
await ctx.send(f'> **[**ERROR**]**: Invalid input\n> __Error__: Hypesquad house must be one of the following: `bravery`, `brilliance`, `balance`', delete_after=5)
return
try:
r = requests.post('https://discordapp.com/api/v6/hypesquad/online', headers=headers, json=payload, timeout=10)
r.raise_for_status()
if r.status_code == 204:
await ctx.send(f'> Hypesquad House changed to `{house}`!')
except requests.exceptions.RequestException as e:
await ctx.send(f'> **[**ERROR**]**: Unable to change Hypesquad house\n> __Error__: `{str(e)}`', delete_after=5)
@bot.command(aliases=['ginfo'])
async def guildinfo(ctx):
await ctx.message.delete()
if not ctx.guild:
await ctx.send("> **[**ERROR**]**: This command can only be used in a server", delete_after=5)
return
date_format = "%a, %d %b %Y %I:%M %p"
embed = f"""> **GUILD INFORMATIONS | Prefix: `{prefix}`**
:dividers: __Basic Information__
Server Name: `{ctx.guild.name}`\nServer ID: `{ctx.guild.id}`\nCreation Date: `{ctx.guild.created_at.strftime(date_format)}`\nServer Icon: `{ctx.guild.icon.url if ctx.guild.icon.url else 'None'}`\nServer Owner: `{ctx.guild.owner}`
:page_facing_up: __Other Information__
`{len(ctx.guild.members)}` Members\n`{len(ctx.guild.roles)}` Roles\n`{len(ctx.guild.text_channels) if ctx.guild.text_channels else 'None'}` Text-Channels\n`{len(ctx.guild.voice_channels) if ctx.guild.voice_channels else 'None'}` Voice-Channels\n`{len(ctx.guild.categories) if ctx.guild.categories else 'None'}` Categories"""
await ctx.send(embed)
@bot.command()
async def nitro(ctx):
await ctx.message.delete()
await ctx.send(f"https://discord.gift/{''.join(random.choices(string.ascii_letters + string.digits, k=16))}")
@bot.command()
async def whremove(ctx, webhook: str=None):
await ctx.message.delete()
if not webhook:
await ctx.send(f'> **[**ERROR**]**: Invalid input\n> __Command__: `{prefix}whremove <webhook>`', delete_after=5)
return
try:
requests.delete(webhook.rstrip())
except Exception as e:
await ctx.send(f'> **[**ERROR**]**: Unable to delete webhook\n> __Error__: `{str(e)}`', delete_after=5)
return
await ctx.send(f'> Webhook has been deleted!')
@bot.command(aliases=['hide'])
async def hidemention(ctx, *, content: str=None):
await ctx.message.delete()
if not content:
await ctx.send(f'> **[**ERROR**]**: Invalid input\n> __Command__: `{prefix}hidemention <message>`', delete_after=5)
return
await ctx.send(content + ('||\u200b||' * 200) + '@everyone')
@bot.command()
async def edit(ctx, *, content: str=None):
await ctx.message.delete()
if not content:
await ctx.send(f'> **[**ERROR**]**: Invalid input\n> __Command__: `{prefix}edit <message>`', delete_after=5)
return
text = await ctx.send(content)
await text.edit(content=f"\u202b{content}")
@bot.command(aliases=['911'])
async def airplane(ctx):
await ctx.message.delete()
frames = [
f''':man_wearing_turban::airplane:\t\t\t\t:office:''',
f''':man_wearing_turban:\t:airplane:\t\t\t:office:''',
f''':man_wearing_turban:\t\t::airplane:\t\t:office:''',
f''':man_wearing_turban:\t\t\t:airplane:\t:office:''',
f''':man_wearing_turban:\t\t\t\t:airplane::office:''',
''':boom::boom::boom:''']
sent_message = await ctx.send(frames[0])
for frame in frames[1:]:
await asyncio.sleep(0.5)
await sent_message.edit(content=frame)
@bot.command(aliases=['mine'])
async def minesweeper(ctx, size: int=5):
await ctx.message.delete()
size = max(min(size, 8), 2)
bombs = [[random.randint(0, size - 1), random.randint(0, size - 1)] for _ in range(size - 1)]
is_on_board = lambda x, y: 0 <= x < size and 0 <= y < size
has_bomb = lambda x, y: [i for i in bombs if i[0] == x and i[1] == y]
m_numbers = [":one:", ":two:", ":three:", ":four:", ":five:", ":six:"]
m_offsets = [(-1, -1), (0, -1), (1, -1), (-1, 0), (1, 0), (-1, 1), (0, 1), (1, 1)]
message_to_send = "**Click to play**:\n"
for y in range(size):
for x in range(size):
tile = "||{}||".format(chr(11036))
if has_bomb(x, y):
tile = "||{}||".format(chr(128163))
else:
count = 0
for xmod, ymod in m_offsets:
if is_on_board(x + xmod, y + ymod) and has_bomb(x + xmod, y + ymod):
count += 1
if count != 0:
tile = "||{}||".format(m_numbers[count - 1])
message_to_send += tile
message_to_send += "\n"
await ctx.send(message_to_send)
@bot.command(aliases=['leet'])
async def leetspeak(ctx, *, content: str):
await ctx.message.delete()
if not content:
await ctx.send("> **[ERROR]**: Invalid command.\n> __Command__: `leetspeak <message>`", delete_after=5)
return
content = content.replace('a', '4').replace('A', '4').replace('e', '3').replace('E', '3').replace('i', '1').replace('I', '1').replace('o', '0').replace('O', '0').replace('t', '7').replace('T', '7').replace('b', '8').replace('B', '8')
await ctx.send(content)
@bot.command()
async def dick(ctx, user: str=None):
await ctx.message.delete()
if not user:
user = ctx.author.display_name
size = random.randint(1, 15)
dong = "=" * size
await ctx.send(f"> **{user}**'s Dick size\n8{dong}D")
@bot.command()
async def reverse(ctx, *, content: str=None):
await ctx.message.delete()
if not content:
await ctx.send("> **[ERROR]**: Invalid command.\n> __Command__: `reverse <message>`", delete_after=5)
return
content = content[::-1]
await ctx.send(content)
@bot.command(aliases=['fetch'])
async def fetchmembers(ctx):
await ctx.message.delete()
if not ctx.guild:
await ctx.send(f'> **[**ERROR**]**: This command can only be used in a server.', delete_after=5)
return
members = ctx.guild.members
member_data = []
for member in members:
member_info = {
"name": member.name,
"id": str(member.id),
"avatar_url": str(member.avatar.url) if member.avatar else str(member.default_avatar.url),
"discriminator": member.discriminator,
"status": str(member.status),
"joined_at": str(member.joined_at)
}
member_data.append(member_info)
with open("members_list.json", "w", encoding="utf-8") as f:
json.dump(member_data, f, indent=4)
await ctx.send("> List of members:", file=discord.File("members_list.json"))
os.remove("members_list.json")
@bot.command()
async def spam(ctx, amount: int=1, *, message_to_send: str="https://discord.gg/PKR7nM9j9U"):
await ctx.message.delete()
try:
if amount <= 0 or amount > 9:
await ctx.send("> **[**ERROR**]**: Amount must be between 1 and 9", delete_after=5)
return
for _ in range(amount):
await ctx.send(message_to_send)
except ValueError:
await ctx.send(f'> **[**ERROR**]**: Invalid input\n> __Command__: `spam <amount> <message>`', delete_after=5)
@bot.command(aliases=['gicon'])
async def guildicon(ctx):
await ctx.message.delete()
if not ctx.guild:
await ctx.send("> **[**ERROR**]**: This command can only be used in a server", delete_after=5)
return
await ctx.send(f"> **{ctx.guild.name} icon :**\n{ctx.guild.icon.url if ctx.guild.icon else '*NO ICON*'}")
@bot.command(aliases=['gbanner'])
async def guildbanner(ctx):
await ctx.message.delete()
if not ctx.guild:
await ctx.send("> **[**ERROR**]**: This command can only be used in a server", delete_after=5)
return
await ctx.send(f"> **{ctx.guild.name} banner :**\n{ctx.guild.banner.url if ctx.guild.banner else '*NO BANNER*'}")
@bot.command(aliases=['grename'])
async def guildrename(ctx, *, name: str=None):
await ctx.message.delete()
if not name:
await ctx.send("> **[ERROR]**: Invalid command.\n> __Command__: `guildrename <name>`", delete_after=5)
return
if not ctx.guild:
await ctx.send("> **[**ERROR**]**: This command can only be used in a server", delete_after=5)
return
if not ctx.guild.me.guild_permissions.manage_guild:
await ctx.send(f'> **[**ERROR**]**: Missing permissions', delete_after=5)
return
try:
await ctx.guild.edit(name=name)
await ctx.send(f"> Server renamed to '{name}'")
except Exception as e:
await ctx.send(f'> **[**ERROR**]**: Unable to rename the server\n> __Error__: `{str(e)}`, delete_after=5')
@bot.command()
async def purge(ctx, num_messages: int=1):
await ctx.message.delete()
if not ctx.guild:
await ctx.send("> **[**ERROR**]**: This command can only be used in a server", delete_after=5)
return
if not ctx.author.guild_permissions.manage_messages:
await ctx.send("> **[**ERROR**]**: You do not have permission to delete messages", delete_after=5)
return
if 1 <= num_messages <= 100:
deleted_messages = await ctx.channel.purge(limit=num_messages)
await ctx.send(f"> **{len(deleted_messages)}** messages have been deleted", delete_after=5)
else:
await ctx.send("> **[**ERROR**]**: The number must be between 1 and 100", delete_after=5)
@bot.command(aliases=['autor'])
async def autoreply(ctx, command: str, user: discord.User=None):
await ctx.message.delete()
if command not in ["ON", "OFF"]:
await ctx.send(f"> **[**ERROR**]**: Invalid input. Use `ON` or `OFF`.\n> __Command__: `autoreply ON|OFF [@user]`", delete_after=5)
return
if command.upper() == "ON":
if user:
if str(user.id) not in config["autoreply"]["users"]:
config["autoreply"]["users"].append(str(user.id))
save_config(config)
selfbot_menu(bot)
await ctx.send(f"> **Autoreply enabled for user {user.mention}.**", delete_after=5)
else:
if str(ctx.channel.id) not in config["autoreply"]["channels"]:
config["autoreply"]["channels"].append(str(ctx.channel.id))
save_config(config)
selfbot_menu(bot)
await ctx.send("> **Autoreply has been enabled in this channel**", delete_after=5)
elif command.upper() == "OFF":
if user:
if str(user.id) in config["autoreply"]["users"]:
config["autoreply"]["users"].remove(str(user.id))
save_config(config)
selfbot_menu(bot)
await ctx.send(f"> **Autoreply disabled for user {user.mention}**", delete_after=5)
else:
if str(ctx.channel.id) in config["autoreply"]["channels"]:
config["autoreply"]["channels"].remove(str(ctx.channel.id))
save_config(config)
selfbot_menu(bot)
await ctx.send("> **Autoreply has been disabled in this channel**", delete_after=5)
@bot.command(aliases=['remote'])
async def remoteuser(ctx, action: str, users: discord.User=None):
await ctx.message.delete()
if not users:
await ctx.send("> **[ERROR]**: Invalid command.\n> __Command__: `remoteuser ADD|REMOVE <@user(s)>`", delete_after=5)
return
if action not in ["ADD", "REMOVE"]:
await ctx.send(f"> **[**ERROR**]**: Invalid action. Use `ADD` or `REMOVE`.\n> __Command__: `remoteuser ADD|REMOVE <@user(s)>`", delete_after=5)
return
if action.upper() == "ADD":
for user in users:
if str(user.id) not in config["remote-users"]:
config["remote-users"].append(str(user.id))
save_config(config)
selfbot_menu(bot)
await ctx.send(f"> **Success**: {len(users)} user(s) added to remote-users", delete_after=5)
elif action.upper() == "REMOVE":
for user in users:
if str(user.id) in config["remote-users"]:
config["remote-users"].remove(str(user.id))
save_config(config)
selfbot_menu(bot)
await ctx.send(f"> **Success**: {len(users)} user(s) removed from remote-users", delete_after=5)
@bot.command()
async def afk(ctx, status: str, *, message: str=None):
await ctx.message.delete()
if status not in ["ON", "OFF"]:
await ctx.send(f"> **[**ERROR**]**: Invalid action. Use `ON` or `OFF`.\n> __Command__: `afk ON|OFF <message>`", delete_after=5)
return
if status.upper() == "ON":
if not config["afk"]["enabled"]:
config["afk"]["enabled"] = True
if message:
config["afk"]["message"] = message
save_config(config)
selfbot_menu(bot)
await ctx.send(f"> **AFK mode enabled.** Message: `{config['afk']['message']}`", delete_after=5)
else:
await ctx.send("> **[**ERROR**]**: AFK mode is already enabled", delete_after=5)
elif status.upper() == "OFF":
if config["afk"]["enabled"]:
config["afk"]["enabled"] = False
save_config(config)
selfbot_menu(bot)
await ctx.send("> **AFK mode disabled.** Welcome back!", delete_after=5)
else:
await ctx.send("> **[**ERROR**]**: AFK mode is not currently enabled", delete_after=5)
@bot.command(aliases=["prefix"])
async def changeprefix(ctx, *, new_prefix: str=None):
await ctx.message.delete()
if not new_prefix:
await ctx.send(f"> **[**ERROR**]**: Invalid command.\n> __Command__: `changeprefix <prefix>`", delete_after=5)
return
config['prefix'] = new_prefix
save_config(config)
selfbot_menu(bot)
bot.command_prefix = new_prefix
await ctx.send(f"> Prefix updated to `{new_prefix}`", delete_after=5)
@bot.command(aliases=["logout"])
async def shutdown(ctx):
await ctx.message.delete()
msg = await ctx.send("> Shutting down...")
await asyncio.sleep(2)
await msg.delete()
await bot.close()
@bot.command()
async def clear(ctx):
await ctx.message.delete()
await ctx.send('ᅠᅠ' + '\n' * 200 + 'ᅠᅠ')
@bot.command()
async def sendall(ctx, *, message="https://discord.gg/PKR7nM9j9U"):
await ctx.message.delete()
if not ctx.guild:
await ctx.send("> **[**ERROR**]**: This command can only be used in a server", delete_after=5)
return
channels = ctx.guild.text_channels
success_count = 0
failure_count = 0
try:
for channel in channels:
try:
await channel.send(message)
success_count += 1
except Exception as e:
failure_count += 1
await ctx.send(f"> {success_count} message(s) sent successfully, {failure_count} failed to send", delete_after=5)
except Exception as e:
await ctx.send(f"> **[**ERROR**]**: An error occurred: `{e}`", delete_after=5)
@bot.command(aliases=["copycatuser", "copyuser"])
async def copycat(ctx, action: str=None, user: discord.User=None):
await ctx.message.delete()
if action not in ["ON", "OFF"]:
await ctx.send(f"> **[**ERROR**]**: Invalid action. Use `ON` or `OFF`.\n> __Command__: `copycat ON|OFF <@user>`", delete_after=5)
return
if not user:
await ctx.send(f"> **[**ERROR**]**: Please specify a user to copy.\n> __Command__: `copycat ON|OFF <@user>`", delete_after=5)
return
if action == "ON":
if user.id not in config['copycat']['users']:
config['copycat']['users'].append(user.id)
save_config(config)
await ctx.send(f"> Now copying `{str(user)}`", delete_after=5)
else:
await ctx.send(f"> `{str(user)}` is already being copied.", delete_after=5)
elif action == "OFF":
if user.id in config['copycat']['users']:
config['copycat']['users'].remove(user.id)
save_config(config)
await ctx.send(f"> Stopped copying `{str(user)}`", delete_after=5)
else:
await ctx.send(f"> `{str(user)}` was not being copied.", delete_after=5)
@bot.command()
async def firstmessage(ctx):
await ctx.message.delete()
try:
async for message in ctx.channel.history(limit=1, oldest_first=True):
link = f"https://discord.com/channels/{ctx.guild.id}/{ctx.channel.id}/{message.id}"
await ctx.send(f"> Here is the link to the first message: {link}", delete_after=5)
break
else:
await ctx.send("> **[ERROR]**: No messages found in this channel.", delete_after=5)
except Exception as e:
await ctx.send(f"> **[ERROR]**: An error occurred while fetching the first message. `{e}`", delete_after=5)
@bot.command()
async def ascii(ctx, *, message=None):
await ctx.message.delete()
if not message:
await ctx.send(f"> **[**ERROR**]**: Invalid command.\n> __Command__: `ascii <message>`", delete_after=5)
return
try:
ascii_art = pyfiglet.figlet_format(message)
await ctx.send(f"```\n{ascii_art}\n```", delete_after=5)
except Exception as e:
await ctx.send(f"> **[ERROR]**: An error occurred while generating the ASCII art. `{e}`", delete_after=5)
@bot.command()
async def playing(ctx, *, status: str=None):
await ctx.message.delete()
if not status:
await ctx.send(f"> **[**ERROR**]**: Invalid command.\n> __Command__: `playing <status>`", delete_after=5)
return
await bot.change_presence(activity=discord.Game(name=status))
await ctx.send(f"> Successfully set the game status to `{status}`", delete_after=5)
@bot.command()
async def streaming(ctx, *, status: str=None):
await ctx.message.delete()
if not status:
await ctx.send(f"> **[**ERROR**]**: Invalid command.\n> __Command__: `streaming <status>`", delete_after=5)
return
await bot.change_presence(activity=discord.Streaming(name=status, url=f"https://www.twitch.tv/{status}"))
await ctx.send(f"> Successfully set the streaming status to `{status}`", delete_after=5)
@bot.command(aliases=["stopstreaming", "stopstatus", "stoplistening", "stopplaying", "stopwatching"])
async def stopactivity(ctx):
await ctx.message.delete()
await bot.change_presence(activity=None, status=discord.Status.dnd)
@bot.command()
async def dmall(ctx, *, message: str="https://discord.gg/PKR7nM9j9U"):
await ctx.message.delete()
if not ctx.guild:
await ctx.send("> **[**ERROR**]**: This command can only be used in a server", delete_after=5)
return
members = [m for m in ctx.guild.members if not m.bot]
total_members = len(members)
estimated_time = round(total_members * 4.5)
await ctx.send(f">Starting DM process for `{total_members}` members.\n> Estimated time: `{estimated_time} seconds` (~{round(estimated_time / 60, 2)} minutes)", delete_after=10)
success_count = 0
fail_count = 0
for member in members:
try:
await member.send(message)
success_count += 1
except Exception:
fail_count += 1
await asyncio.sleep(random.uniform(3, 6))
await ctx.send(f"> **[**INFO**]**: DM process completed.\n> Successfully sent: `{success_count}`\n> Failed: `{fail_count}`", delete_after=10)
bot.run(token)