-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbot.py
More file actions
1332 lines (1286 loc) · 74.9 KB
/
Copy pathbot.py
File metadata and controls
1332 lines (1286 loc) · 74.9 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
996
997
998
999
1000
import discord as dd
from discord.ext import commands
import datetime as date
import yt_dlp as yt
import asyncio
import os
from zxcvbn import zxcvbn
import requests
import psutil
from bs4 import BeautifulSoup
import google.generativeai as genai
from google.generativeai import types
from dotenv import load_dotenv
import socket
import whois
import dns.resolver
import subprocess
load_dotenv()
# Carrega as variáveis de ambiente do arquivo .env
GEMINI_API_KEY = os.getenv("API_Gimini_token")
genai.configure(api_key=GEMINI_API_KEY)
model = genai.GenerativeModel('gemini-3-flash-preview')
# Configurações do bot
class MyClient(dd.Client):
async def on_ready(self):
print("="*40)
print(f"🤖 Bot Online!")
print(f"Logged on as: {self.user} ({self.user.name}#{self.user.discriminator})")
print(f"Bot ID: {self.user.id}")
print(f"Avatar URL: {self.user.avatar.url if self.user.avatar else 'Sem avatar'}")
print(f"Data/hora de inicialização: {date.datetime.now().strftime('%d/%m/%Y %H:%M:%S')}")
print(f"Servidores conectados: {len(self.guilds)}")
for guild in self.guilds:
print(f" - {guild.name} (ID: {guild.id}) | Membros: {guild.member_count}")
print(f"Versão do discord.py: {dd.__version__}")
print(f"Versão do Python: {os.sys.version.split()[0]}")
print("="*40)
# Marca o tempo de início para uptime
self.start_time = date.datetime.now()
time = date.datetime.now()
embed = dd.Embed(
title="🤖 Bot Online e Pronto para Ajudar!",
color=0x5865F2,
description=(
f"Olá, {self.user.mention if hasattr(self.user, 'mention') else self.user.name}! 👋\n"
f"Hoje é **{time.strftime('%A, %d/%m/%Y')}**\n"
f"🕒 Agora são **{time.strftime('%H:%M:%S')}**\n\n"
"Bem-vindo ao seu assistente multifuncional para o servidor!\n"
"Explore os comandos abaixo para aproveitar ao máximo a experiência:"
)
)
# No message context here, so use bot info for thumbnail/footer
embed.set_thumbnail(url=self.user.avatar.url if hasattr(self.user, 'avatar') and self.user.avatar else None)
embed.add_field(
name="📜 `/regras`",
value="Veja as regras do servidor para uma convivência saudável.",
inline=False
)
embed.add_field(
name="📰 `/not`",
value="Receba as últimas notícias de tecnologia dos principais portais.",
inline=False
)
embed.add_field(
name="🤖 `/botinfo`",
value="Veja informações detalhadas sobre o bot, você e o servidor.",
inline=False
)
embed.add_field(
name="🏅 `/cargos`",
value="Descubra os cargos disponíveis e suas permissões.",
inline=False
)
embed.add_field(
name="💬 `/ia <pergunta>`",
value="Converse com a IA Gemini e tire suas dúvidas!",
inline=False
)
embed.add_field(
name="🎵 `/music <nome ou link>`",
value="Toque músicas no canal de voz com qualidade.",
inline=False
)
embed.add_field(
name="⏹️ `/stopmusic`",
value="Pare a música e desconecte o bot do canal de voz.",
inline=False
)
embed.add_field(
name="👋 `/boasvindas`",
value="Receba uma mensagem de boas-vindas personalizada.",
inline=False
)
embed.add_field(
name="🛠️ `/teste`",
value="Teste se o bot está funcionando corretamente.",
inline=False
)
embed.add_field(
name="📊 `/status`",
value="Veja o status detalhado do bot e do sistema.",
inline=False
)
embed.add_field(
name="👤 `/user`",
value="Informações do usuário.",
inline=False
)
embed.add_field(
name="🔎 `/ipsite <site>`",
value="Encontre informações sobre um site, incluindo IP, registros DNS e WHOIS.",
inline=False
)
embed.add_field(
name="📅 `/events`",
value="Veja os eventos agendados.",
inline=False
)
embed.add_field(
name="🧹🪣 `/clear`",
value="Apague mensagens de um canal.",
inline=False
)
embed.add_field(
name="🔍 `/nmap <ip ou domínio>`",
value="Realize uma varredura Nmap em um IP ou domínio.",
inline=False
)
embed.add_field(
name="🌐 `/myip`",
value="Descubra o seu próprio endereço IP público.",
inline=False
)
embed.set_footer(
text="Desenvolvido por suchsoak | github.com/suchsoak | 🚀 Aproveite o servidor!",
icon_url=self.user.avatar.url if hasattr(self.user, 'avatar') and self.user.avatar else None
)
# Envia a mensagem apenas para o primeiro canal de texto disponível
text_channels = [c for c in self.get_all_channels() if isinstance(c, dd.TextChannel)]
if text_channels:
await text_channels[0].send(embed=embed)
else:
print("Nenhum canal de texto disponível para enviar a mensagem.")
async def on_message(self, message):
if message.author == self.user:
with open("logs.txt", "a") as f:
f.write(f"{message.content}\n")
f.write("\n")
f.write(f"Mensagem: {message.content}\n")
f.write(f"Autor: {message.author}\n")
f.write(f"Canal: {message.channel}\n")
f.write(f"Servidor: {message.guild}\n")
f.write(f"atualização: {message.edited_at}\n")
f.write(f"criação: {message.created_at}\n")
f.write(f"comando: {message.content.startswith('/')}\n")
f.write(f"Data/hora: {date.datetime.now().strftime('%d/%m/%Y %H:%M:%S')}\n")
print(f'Message from {message.author}: {message.content}')
try:
async with message.channel.typing():
print("Bot está digitando")
if message.content == f'/regras':
regras_channel = None
for channel in message.guild.text_channels:
if "regra" in channel.name.lower():
regras_channel = channel
break
if regras_channel:
messages = [msg async for msg in regras_channel.history(limit=30, oldest_first=True)]
regras_texto = "\n".join([msg.content for msg in messages if msg.content.strip()])
if regras_texto:
embed = dd.Embed(
title="📜 Regras do Servidor",
description=regras_texto,
color=0xED4245
)
embed.set_footer(text=f"Canal: #{regras_channel.name}")
await message.channel.send(embed=embed)
else:
await message.channel.send(f"{message.author.mention} Não foi possível encontrar regras no canal {regras_channel.mention}.")
else:
await message.channel.send(f"{message.author.mention} Não foi possível localizar um canal de regras neste servidor.")
elif message.content.startswith('/nmap'):
nmap_target = message.content.split(' ')[1] if len(message.content.split(' ')) > 1 else None
if not nmap_target:
await message.channel.send("Por favor, forneça o IP ou domínio após o comando.")
else:
etapas = [
"🔍 Iniciando varredura de portas...",
"🌐 Verificando serviços ativos...",
"🛡️ Analisando vulnerabilidades...",
"📊 Compilando resultados...",
"✨ Pronto! Aqui estão os resultados da varredura:"
]
msg = await message.channel.send(etapas[0])
for etapa in etapas[1:]:
await asyncio.sleep(1.2)
await msg.edit(content=etapa)
try:
completed = subprocess.run(
["sudo", "nmap", "-sO", nmap_target],
capture_output=True, text=True
)
if completed.returncode != 0:
await message.channel.send(
"❌ Erro ao executar o Nmap. Verifique se o comando está correto e se você tem permissão para executá-lo."
)
return
# Processa a saída do Nmap para exibir de forma mais amigável
nmap_output = completed.stdout or "Nenhum resultado retornado."
# Separa por linhas e filtra as principais informações
lines = nmap_output.splitlines()
portas = []
protocolos = []
hosts = []
outros = []
for line in lines:
l = line.strip()
if l.startswith("PORT") or l.startswith("PORTA"):
continue
elif "open" in l or "aberta" in l:
portas.append(f"🟢 {l}")
elif "closed" in l or "fechada" in l:
portas.append(f"🔴 {l}")
elif "filtered" in l or "filtrada" in l:
portas.append(f"🟡 {l}")
elif l.lower().startswith("protocol"):
protocolos.append(f"📡 {l}")
elif l.lower().startswith("host is up") or l.lower().startswith("host está ativo"):
hosts.append(f"✅ {l}")
elif l.lower().startswith("host is down") or l.lower().startswith("host está inativo"):
hosts.append(f"❌ {l}")
elif l:
outros.append(l)
embed = dd.Embed(
title=f"🔍 Resultados da Varredura Nmap para `{nmap_target}`",
color=0x3498db,
description="Veja abaixo os principais resultados da varredura:"
)
if hosts:
embed.add_field(name="🌐 Status do Host", value="\n".join(hosts), inline=False)
if protocolos:
embed.add_field(name="📡 Protocolos", value="\n".join(protocolos), inline=False)
if portas:
embed.add_field(name="🔑 Portas", value="\n".join(portas), inline=False)
if outros:
# Mostra até 10 linhas extras para não poluir
outros_show = outros[:10]
embed.add_field(
name="📄 Outros Detalhes",
value="\n".join(outros_show) + ("\n..." if len(outros) > 10 else ""),
inline=False
)
embed.set_footer(text="github.com/suchsoak | Varredura de rede avançada 🚀")
embed.set_footer(text="github.com/suchsoak | Varredura de rede avançada 🚀")
await message.channel.send(embed=embed)
except Exception as e:
await message.channel.send(f"❌ Não foi possível realizar a varredura Nmap: {e}")
elif message.content.startswith('/ipsite'):
ipsite = message.content.split(' ')[1] if len(message.content.split(' ')) > 1 else None
if not ipsite:
await message.channel.send("Por favor, forneça o domínio do site após o comando.")
else:
etapas = [
"🔍 Procurando o IP nos confins da internet...",
"🌐 Consultando servidores DNS secretos...",
"🛰️ Rastreando satélites digitais...",
"🧠 Decifrando registros ocultos...",
"💡 Encontrando informações extras...",
"✨ Pronto! Aqui está tudo que descobri:"
]
msg = await message.channel.send(etapas[0])
for etapa in etapas[1:]:
await asyncio.sleep(1.2)
await msg.edit(content=etapa)
try:
ip_addr = socket.gethostbyname(ipsite)
# Tenta obter registros DNS
try:
a_records = [r.address for r in dns.resolver.resolve(ipsite, 'A')]
except Exception:
a_records = []
try:
mx_records = [str(r.exchange) for r in dns.resolver.resolve(ipsite, 'MX')]
except Exception:
mx_records = []
try:
ns_records = [str(r.target) for r in dns.resolver.resolve(ipsite, 'NS')]
except Exception:
ns_records = []
# Tenta obter informações WHOIS
try:
w = whois.whois(ipsite)
registrar = w.registrar or "Desconhecido"
creation_date = w.creation_date.strftime('%d/%m/%Y') if hasattr(w.creation_date, 'strftime') else str(w.creation_date)
expiration_date = w.expiration_date.strftime('%d/%m/%Y') if hasattr(w.expiration_date, 'strftime') else str(w.expiration_date)
org = w.org or "Desconhecido"
country = w.country or "Desconhecido"
except Exception:
registrar = creation_date = expiration_date = org = country = "Desconhecido"
embed = dd.Embed(
title=f"🌐 Informações do site: {ipsite}",
color=0x3498db,
description=f"🔗 **Domínio:** `{ipsite}`\n💻 **IP Principal:** `{ip_addr}`"
)
embed.add_field(name="📦 Registros A", value="\n".join(a_records) if a_records else "Nenhum encontrado", inline=False)
embed.add_field(name="📬 Registros MX", value="\n".join(mx_records) if mx_records else "Nenhum encontrado", inline=False)
embed.add_field(name="🛰️ Registros NS", value="\n".join(ns_records) if ns_records else "Nenhum encontrado", inline=False)
embed.add_field(name="🏢 Registrar", value=registrar, inline=True)
embed.add_field(name="🗓️ Criado em", value=creation_date, inline=True)
embed.add_field(name="⌛ Expira em", value=expiration_date, inline=True)
embed.add_field(name="🏛️ Organização", value=org, inline=True)
embed.add_field(name="🌎 País", value=country, inline=True)
# Informações extras de WHOIS
try:
embed.add_field(name="📧 Email do registrante", value=w.emails if hasattr(w, 'emails') and w.emails else "Desconhecido", inline=True)
embed.add_field(name="📞 Telefone", value=w.phone if hasattr(w, 'phone') and w.phone else "Desconhecido", inline=True)
embed.add_field(name="🌐 Servidores WHOIS", value=", ".join(w.whois_server) if hasattr(w, 'whois_server') and w.whois_server else "Desconhecido", inline=True)
embed.add_field(name="🏠 Endereço", value=w.address if hasattr(w, 'address') and w.address else "Desconhecido", inline=True)
embed.add_field(name="👤 Nome do registrante", value=w.name if hasattr(w, 'name') and w.name else "Desconhecido", inline=True)
except Exception:
pass
# Informações extras de DNS
try:
soa_records = [str(r.mname) for r in dns.resolver.resolve(ipsite, 'SOA')]
embed.add_field(name="📝 Registro SOA", value="\n".join(soa_records) if soa_records else "Nenhum encontrado", inline=False)
except Exception:
embed.add_field(name="📝 Registro SOA", value="Não encontrado", inline=False)
try:
txt_records = [str(r.strings[0], 'utf-8') if hasattr(r, 'strings') and r.strings else str(r) for r in dns.resolver.resolve(ipsite, 'TXT')]
embed.add_field(name="🗒️ Registros TXT", value="\n".join(txt_records) if txt_records else "Nenhum encontrado", inline=False)
except Exception:
embed.add_field(name="🗒️ Registros TXT", value="Não encontrado", inline=False)
try:
cname_records = [str(r.target) for r in dns.resolver.resolve(ipsite, 'CNAME')]
embed.add_field(name="🔗 Registros CNAME", value="\n".join(cname_records) if cname_records else "Nenhum encontrado", inline=False)
except Exception:
embed.add_field(name="🔗 Registros CNAME", value="Não encontrado", inline=False)
try:
dmarc_records = [str(r.strings[0], 'utf-8') if hasattr(r, 'strings') and r.strings else str(r) for r in dns.resolver.resolve(f"_dmarc.{ipsite}", 'TXT')]
embed.add_field(name="🛡️ DMARC", value="\n".join(dmarc_records) if dmarc_records else "Nenhum encontrado", inline=False)
except Exception:
embed.add_field(name="🛡️ DMARC", value="Não encontrado", inline=False)
try:
spf_records = [str(r.strings[0], 'utf-8') if hasattr(r, 'strings') and r.strings else str(r) for r in dns.resolver.resolve(ipsite, 'TXT') if b"v=spf1" in r.strings[0]]
embed.add_field(name="🛡️ SPF", value="\n".join(spf_records) if spf_records else "Nenhum encontrado", inline=False)
except Exception:
embed.add_field(name="🛡️ SPF", value="Não encontrado", inline=False)
# Tenta pegar reverso do IP
try:
rev_dns = socket.gethostbyaddr(ip_addr)[0]
embed.add_field(name="🔄 DNS Reverso", value=rev_dns, inline=True)
except Exception:
embed.add_field(name="🔄 DNS Reverso", value="Não encontrado", inline=True)
embed.set_footer(text="github.com/suchsoak | Consulta de domínio avançada 🚀")
await message.channel.send(embed=embed)
except Exception as e:
await message.channel.send(f"❌ Não foi possível obter informações de {ipsite}: {e}")
guild = message.guild
try:
events = await guild.fetch_scheduled_events()
except AttributeError:
await message.channel.send("❌ Este recurso não está disponível nesta versão do discord.py ou o bot não tem permissões suficientes.")
return
except Exception as e:
await message.channel.send(f"❌ Erro ao buscar eventos: {e}")
return
if not events:
await message.channel.send("Nenhum evento encontrado.")
else:
embed = dd.Embed(
title="📅 Eventos do Servidor\n\n",
color=0x5865F2,
description="Aqui estão os próximos eventos agendados:"
)
for event in events:
start_time = event.start_time.strftime('%d/%m/%Y %H:%M:%S') if hasattr(event, 'start_time') and event.start_time else "Desconhecido"
description = event.description or "Sem descrição."
location = getattr(event, 'location', None) or getattr(event, 'entity_metadata', {}).get('location', None) or "Nenhum local especificado."
embed.add_field(
name=f"🎉 {event.name}",
value=(
f"**🆔 ID:** {event.id}\n\n"
f"**🕒 Início:** {start_time}\n\n"
f"**🗓️ Data:** {start_time}\n\n"
f"**📝 Descrição:** {description}\n\n"
f"**📍 Local:** {location}\n\n"
f"**👤 Organizador:** {event.creator.mention if hasattr(event, 'creator') and event.creator else 'Desconhecido'}\n\n\n"
f"**🔗 [Ver Evento]({event.url})**\n\n"
f"**🧑🤝🧑 Participantes:** {event.user_count if hasattr(event, 'user_count') else 'N/A'}"
),
inline=False
)
if hasattr(event, 'cover_image') and event.cover_image:
embed.set_image(url=event.cover_image)
embed.set_footer(text="github.com/suchsoak | Eventos do servidor 🚀")
await message.channel.send(embed=embed)
elif message.content == f'/user':
embed = dd.Embed(
title="👤 Informações Completas do Usuário",
color=0x5865F2,
description=f"Olá, {message.author.mention}! Aqui estão todas as suas informações detalhadas:"
)
embed.add_field(
name="👤 Usuário",
value=(
f"**Nome:** {message.author.name}\n"
f"**ID:** {message.author.id}\n"
f"**Discriminador:** {message.author.discriminator}\n"
f"**Conta criada em:** {message.author.created_at.strftime('%d/%m/%Y %H:%M:%S') if hasattr(message.author, 'created_at') and message.author.created_at else 'Desconhecido'}\n"
f"**Avatar:** [Clique aqui]({message.author.avatar.url})\n" if message.author.avatar else "Sem avatar\n"
f"**Status:** {str(message.author.status).capitalize()}\n"
f"**Bot:** {'Sim' if message.author.bot else 'Não'}\n"
f"**Apelido:** {message.author.nick if hasattr(message.author, 'nick') and message.author.nick else 'Nenhum'}\n"
f"**Dispositivos:** {', '.join([d.capitalize() for d in message.author.devices]) if hasattr(message.author, 'devices') and message.author.devices else 'Desconhecido'}\n"
f"**Atividades:** {', '.join([a.name for a in message.author.activities]) if hasattr(message.author, 'activities') and message.author.activities else 'Nenhuma'}\n"
f"**Cargos:** {', '.join([role.name for role in message.author.roles if role.name != '@everyone']) or 'Nenhum'}\n"
f"**Cor do cargo mais alto:** {message.author.top_role.color if hasattr(message.author, 'top_role') and message.author.top_role else 'Desconhecido'}\n"
f"**Permissões:** {', '.join([perm[0].replace('_', ' ').title() for perm in message.author.guild_permissions if perm[1]]) if hasattr(message.author, 'guild_permissions') else 'Desconhecido'}\n"
f"**Boostando o servidor:** {'Sim' if getattr(message.author, 'premium_since', None) else 'Não'}\n"
f"**Entrou no servidor em:** {message.author.joined_at.strftime('%d/%m/%Y %H:%M:%S') if hasattr(message.author, 'joined_at') and message.author.joined_at else 'Desconhecido'}\n"
f"**Servidor:** {message.guild.name if message.guild else 'Desconhecido'}\n"
f"**ID do Servidor:** {message.guild.id if message.guild else 'Desconhecido'}\n"
f"**É dono do servidor:** {'Sim' if message.guild and message.guild.owner_id == message.author.id else 'Não'}\n"
f"**Membro desde:** {message.author.joined_at.strftime('%d/%m/%Y %H:%M:%S') if hasattr(message.author, 'joined_at') and message.author.joined_at else 'Desconhecido'}\n"
f"**Menção:** {message.author.mention}\n"
),
inline=False
)
embed.add_field(
name="📅 Entrou no servidor em",
value=message.author.joined_at.strftime('%d/%m/%Y %H:%M:%S') if hasattr(message.author, 'joined_at') and message.author.joined_at else "Desconhecido",
inline=True
)
embed.add_field(
name="🏷️ Cargos",
value=", ".join([role.mention for role in message.author.roles if role.name != "@everyone"]) or "Nenhum",
inline=True
)
embed.add_field(
name="🔢 Número de cargos",
value=str(len([role for role in message.author.roles if role.name != "@everyone"])),
inline=True
)
embed.add_field(
name="💻 Status",
value=f"{str(message.author.status).capitalize()}",
inline=True
)
embed.add_field(
name="📱 Dispositivos",
value=", ".join([d.capitalize() for d in getattr(message.author, 'devices', [])]) if hasattr(message.author, 'devices') and message.author.devices else "Desconhecido",
inline=True
)
embed.add_field(
name="🗣️ Apelido",
value=message.author.nick if hasattr(message.author, 'nick') and message.author.nick else "Nenhum",
inline=True
)
embed.add_field(
name="🎮 Atividades",
value=", ".join([a.name for a in getattr(message.author, 'activities', [])]) if hasattr(message.author, 'activities') and message.author.activities else "Nenhuma",
inline=True
)
embed.add_field(
name="🛡️ Permissões",
value=", ".join([perm[0].replace('_', ' ').title() for perm in getattr(message.author, 'guild_permissions', []) if perm[1]]) if hasattr(message.author, 'guild_permissions') else "Desconhecido",
inline=False
)
embed.add_field(
name="🌐 Servidor",
value=f"**Nome:** {message.guild.name}\n**ID:** {message.guild.id}",
inline=False
)
embed.add_field(
name="👑 É dono do servidor?",
value="Sim" if message.guild and message.guild.owner_id == message.author.id else "Não",
inline=True
)
embed.add_field(
name="🚀 Boostando o servidor?",
value="Sim" if getattr(message.author, 'premium_since', None) else "Não",
inline=True
)
embed.add_field(
name="🆔 ID do Usuário",
value=str(message.author.id),
inline=True
)
embed.add_field(
name="🆔 ID do Servidor",
value=str(message.guild.id) if message.guild else "Desconhecido",
inline=True
)
embed.add_field(
name="📅 Conta criada em",
value=message.author.created_at.strftime('%d/%m/%Y %H:%M:%S') if hasattr(message.author, 'created_at') and message.author.created_at else "Desconhecido",
inline=True
)
embed.add_field(
name="👤 Menção",
value=message.author.mention,
inline=True
)
embed.add_field(
name="🎨 Cor do cargo mais alto",
value=str(message.author.top_role.color) if hasattr(message.author, 'top_role') and message.author.top_role else "Desconhecido",
inline=True
)
embed.add_field(
name="🤖 É um bot?",
value="Sim" if message.author.bot else "Não",
inline=True
)
embed.set_thumbnail(url=message.author.avatar.url if message.author.avatar else None)
embed.set_footer(text="github.com/suchsoak | Bot em desenvolvimento 🚀")
await message.channel.send(embed=embed)
elif message.content == f'/help':
time = date.datetime.now()
embed = dd.Embed(
title="🤖 Bot Online e Pronto para Ajudar!",
color=0x5865F2,
description=(
f"Olá, {message.author.mention}! 👋\n"
f"Hoje é **{time.strftime('%A, %d/%m/%Y')}**\n"
f"🕒 Agora são **{time.strftime('%H:%M:%S')}**\n\n"
"Bem-vindo ao seu assistente multifuncional para o servidor!\n"
"Explore os comandos abaixo para aproveitar ao máximo a experiência:"
)
)
embed.set_thumbnail(url=message.guild.icon.url if message.guild and message.guild.icon else None)
# Matrix animation before mostrar comandos
matrix = dd.utils.get(self.get_all_channels(), name="🖥️ Matrix")
frames = [
"🟩▒▒▒▒▒▒▒▒▒ 10%\nIniciando conexão com a Matrix...",
"🟩🟩🟩▒▒▒▒▒▒▒ 30%\nCarregando códigos verdes...",
"🟩🟩🟩🟩🟩▒▒▒▒ 50%\nDesviando de agentes...",
"🟩🟩🟩🟩🟩🟩🟩▒▒ 70%\nPegando pílula vermelha...",
"🟩🟩🟩🟩🟩🟩🟩🟩🟩▒ 90%\nDespertando Neo...",
"🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩 100%\n💾 Upload completo!\n🧠 Conectando à Matriz...",
"🔢 Decodificando...\n01001100 01101001 01100010 01100101 01110010 0110010001101111\n👁 Acorde, Neo.",
"💻 Bem-vindo à Matrix! Escolha seu comando e desafie a realidade. 🕶️"
]
msg = await message.channel.send(frames[0])
for frame in frames[1:]:
await asyncio.sleep(1.2)
await msg.edit(content=frame)
matrix
embed.add_field(
name="📜 `/regras`",
value="Veja as regras do servidor para uma convivência saudável.",
inline=False
)
embed.add_field(
name="📰 `/not`",
value="Receba as últimas notícias de tecnologia dos principais portais.",
inline=False
)
embed.add_field(
name="🤖 `/botinfo`",
value="Veja informações detalhadas sobre o bot, você e o servidor.",
inline=False
)
embed.add_field(
name="🏅 `/cargos`",
value="Descubra os cargos disponíveis e suas permissões.",
inline=False
)
embed.add_field(
name="💬 `/ia <pergunta>`",
value="Converse com a IA Gemini e tire suas dúvidas!",
inline=False
)
embed.add_field(
name="🎵 `/music <nome ou link>`",
value="Toque músicas no canal de voz com qualidade.",
inline=False
)
embed.add_field(
name="⏹️ `/stopmusic`",
value="Pare a música e desconecte o bot do canal de voz.",
inline=False
)
embed.add_field(
name="👋 `/boasvindas`",
value="Receba uma mensagem de boas-vindas personalizada.",
inline=False
)
embed.add_field(
name="🛠️ `/teste`",
value="Teste se o bot está funcionando corretamente.",
inline=False
)
embed.add_field(
name="📊 `/status`",
value="Veja o status detalhado do bot e do sistema.",
inline=False
)
embed.add_field(
name="👤 `/user`",
value="Informações do usuário.",
inline=False
)
embed.add_field(
name="🔎 `/ipsite <site>`",
value="Encontre informações sobre um site, incluindo IP, registros DNS e WHOIS.",
inline=False
)
embed.add_field(
name="📢 `/events`",
value="Veja os eventos agendados.",
inline=False
)
embed.add_field(
name="🧹🪣 `/clear`",
value="Apague mensagens de um canal.",
inline=False
)
embed.add_field(
name="🔍 `/nmap <ip ou domínio>`",
value="Realize uma varredura Nmap em um IP ou domínio.",
inline=False
)
embed.add_field(
name="🌐 `/myip`",
value="Descubra o seu próprio endereço IP público.",
inline=False
)
embed.set_footer(
text="Desenvolvido por suchsoak | github.com/suchsoak | 🚀 Aproveite o servidor!",
icon_url=message.author.avatar.url if message.author.avatar else None
)
await message.channel.send(embed=embed)
elif message.content == f"/botinfo":
# Animação divertida antes de mostrar as informações
etapas = [
"🕸️ Estabelecendo túnel Tor...",
"🧠 Verificando proxies anônimos...",
"💉 Injetando SQL em alvo obscuro...",
"💀 Log de transações criptografadas interceptado...",
"🎯 Rastreamento do alvo concluído com sucesso."
]
msg = await message.channel.send(etapas[0])
for etapa in etapas[1:]:
await asyncio.sleep(1.5)
await msg.edit(content=etapa)
await asyncio.sleep(1)
await msg.edit(content="☠️ Arquivos confidenciais extraídos. Boa sorte. ☠️")
embed = dd.Embed(
title="🤖 Informações do Bot",
color=0x5865F2,
description=f"Olá, {message.author.mention}! Aqui estão suas informações e do servidor:"
)
embed.add_field(
name="👤 Usuário",
value=(
f"**Nome:** {message.author.name}\n"
f"**ID:** {message.author.id}\n"
f"**Discriminador:** {message.author.discriminator}\n"
f"**Conta criada em:** {message.author.created_at.strftime('%d/%m/%Y %H:%M:%S')}\n"
f"**Avatar:** [Clique aqui]({message.author.avatar.url})" if message.author.avatar else "Sem avatar"
),
inline=False
)
embed.add_field(
name="🛠️ Bot",
value=(
f"**Versão:** 1.0.0\n"
f"**Dev:** suchsoak\n"
f"**Ping:** {round(self.latency * 1000)}ms\n"
f"**Linguagem:** Python {os.sys.version.split()[0]}\n"
f"**Biblioteca:** discord.py {dd.__version__}\n"
f"**Tempo online:** {str(date.datetime.now() - self.start_time).split('.')[0] if hasattr(self, 'start_time') else 'N/A'}"
),
inline=False
)
embed.add_field(
name="🌐 Servidor",
value=(
f"**Nome:** {message.guild.name}\n"
f"**ID:** {message.guild.id}\n"
f"**Membros:** {message.guild.member_count}\n"
f"**Criado em:** {message.guild.created_at.strftime('%d/%m/%Y %H:%M:%S')}\n"
f"**Dono:** {message.guild.owner.mention if message.guild.owner else 'Desconhecido'}\n"
f"**Região:** {getattr(message.guild, 'preferred_locale', 'N/A')}\n"
f"**Canais de texto:** {len(message.guild.text_channels)}\n"
f"**Canais de voz:** {len(message.guild.voice_channels)}\n"
f"**Boosts:** {message.guild.premium_subscription_count or 0}\n"
f"**Nível de Boost:** {getattr(message.guild, 'premium_tier', 'N/A')}\n"
f"**Emoji personalizados:** {len(message.guild.emojis)}"
),
inline=False
)
embed.set_thumbnail(url=message.author.avatar.url if message.author.avatar else None)
embed.set_image(url=message.guild.icon.url if message.guild.icon else None)
embed.set_footer(text="github.com/suchsoak | Bot em desenvolvimento 🚀")
await message.channel.send(embed=embed)
elif message.content == f'/cargos':
roles = [role.name for role in message.guild.roles if role.name != "@everyone"]
if not roles:
await message.channel.send("😕 Este servidor não possui cargos além de @everyone.")
else:
cargos_formatados = ""
for idx, nome in enumerate(roles, 1):
role_obj = dd.utils.get(message.guild.roles, name=nome)
cor = role_obj.color if role_obj else dd.Color.default()
mencao = role_obj.mention if role_obj else nome
cargos_formatados += f"**{idx}.** {mencao} \n"
embed = dd.Embed(
title="🏅 Cargos do Servidor",
color=0x5865F2,
description="Veja abaixo os cargos disponíveis neste servidor:\n\n" + cargos_formatados
)
embed.set_footer(text="Consulte um administrador para mais informações sobre cargos.")
embed.set_thumbnail(url=message.guild.icon.url if message.guild.icon else None)
await message.channel.send(embed=embed)
elif message.content == f'/boasvindas':
png = dd.File("PNG/Novo_Projeto.png", filename="PNG/Novo_Projeto.png")
await message.channel.send(file=png)
welcome_message = (
f"🎉 **Bem-vindo(a), {message.author.mention}!** 🎉\n\n"
"👋 Olá! É um prazer ter você conosco no servidor **{0}**!\n\n"
"Aqui estão algumas dicas para começar:\n"
"• 📜 Use `/regras` para conhecer as regras do servidor.\n"
"• 🏅 Veja os cargos disponíveis com `/cargos`.\n"
"• 📰 Fique por dentro das novidades usando `/not`.\n"
"• 🤖 Converse com a IA usando `/ia <sua pergunta>`.\n"
"• 🎵 Ouça músicas com `/music <nome ou link>`.\n\n"
"Se precisar de ajuda, mencione um administrador ou utilize os comandos acima.\n\n"
"💡 **Dica:** Explore os canais, faça amigos e aproveite a comunidade!\n\n"
"🔗 Confira também meu repositório no GitHub:\n"
"https://www.github.com/suchsoak\n\n"
"🚀 **Divirta-se e aproveite ao máximo!**"
).format(message.guild.name if message.guild else "nosso servidor")
if message.author.avatar:
await message.author.send(message.author.avatar.url)
await message.author.send(welcome_message)
if message.author.avatar:
await message.channel.send(f"{message.author.mention}, acabei de te enviar uma mensagem de boas-vindas no privado! 📬")
pass
elif message.content == f'/teste':
# Mensagem animada antes do embed
embed = dd.Embed(
title="✅ Bot em Funcionamento!",
color=0x57F287,
description=f"{message.author.mention} Olá! Eu sou o bot do servidor, pronto para ajudar você! 🚀"
)
if message.author.avatar:
embed.set_thumbnail(url=message.author.avatar.url)
embed.add_field(
name="Status",
value="Estou funcionando perfeitamente! Se precisar de ajuda, use os comandos disponíveis ou fale com um administrador.",
inline=False
)
embed.set_footer(text="github.com/suchsoak | Bot em desenvolvimento")
await message.channel.send(embed=embed)
elif message.content.startswith('/ia '):
user_input = message.content[len('/ia '):].strip()
attachments = message.attachments
if not user_input and not attachments:
await message.channel.send("Por favor, envie uma pergunta, prompt ou imagem para o Gemini.")
return
response = await model.generate_content_async(user_input)
if response.text:
chucks = [response.text[i:i+2000] for i in range(0, len(response.text), 2000)]
for chunk in chucks:
await message.channel.send(chunk)
else:
await message.channel.send("O Gemini não gerou uma resposta de texto para essa requisição.")
try:
# Se o usuário enviou uma imagem junto com o prompt, faz modificação
if attachments:
image_url = attachments[0].url
image_bytes = await attachments[0].read()
# Cria um objeto Image para o Gemini (ajuste conforme o SDK)
gemini_image = genai.Image.from_bytes(image_bytes)
# Prompt para modificação
prompt = user_input or "Melhore esta imagem"
response = await model.generate_content_async(
[prompt, gemini_image]
)
# A resposta pode conter uma imagem gerada
if hasattr(response, "images") and response.images:
for img in response.images:
await message.channel.send(file=dd.File(img, filename="gemini_edit.png"))
elif hasattr(response, "text") and response.text:
await message.channel.send(response.text)
else:
await message.channel.send("O Gemini não retornou uma imagem modificada.")
elif any(word in user_input.lower() for word in ["imagem", "image", "foto", "picture", "draw", "desenhe", "crie uma imagem"]):
response = await model.generate_content_async(user_input, generation_config={"response_mime_type": "image/png"})
if hasattr(response, "images") and response.images:
for img in response.images:
await message.channel.send(file=dd.File(img, filename="gemini_image.png"))
elif hasattr(response, "text") and response.text:
await message.channel.send(response.text)
else:
await message.channel.send("O Gemini não gerou uma imagem para esse prompt.")
else:
response = await model.generate_content_async(user_input)
if hasattr(response, "text") and response.text:
chucks = [response.text[i:i+2000] for i in range(0, len(response.text), 2000)]
for chunk in chucks:
await message.channel.send(chunk)
elif hasattr(response, "candidates") and response.candidates:
text = response.candidates[0].content.parts[0].text
await message.channel.send(text)
else:
await message.channel.send("O Gemini não gerou uma resposta de texto para essa requisição.")
except Exception as e:
print(f"Erro ao processar Gemini: {e}")
print("Resposta completa do Gemini:", response)
print("Atributos disponíveis na resposta do Gemini:", dir(response))
elif message.content.startswith('/myip'):
await message.channel.send(f"{message.author.mention}, Seu IP está no seu privado, evite compartilhar com qualquer um. 🌐")
try:
response = requests.get('https://api.ipify.org?format=json')
if response.status_code == 200:
ip_data = response.json()
ip_address = ip_data.get('ip', 'Desconhecido')
ip_city = ip_data.get('city', 'Desconhecido')
ip_country = ip_data.get('country', 'Desconhecido')
await message.author.send(f"🌐 Seu IP público é: `{ip_address}`")
await message.author.send(f"🏙️ Cidade aproximada: `{ip_city}`")
await message.author.send(f"🌍 País aproximado: `{ip_country}`")
await message.author.send(f"🌐 Internet: `{ip_data.get('org', 'Desconhecido')}`")
await message.author.send("⚠️ Lembre-se de que seu IP pode revelar sua localização aproximada e outras informações pessoais.")
await message.author.send("🔒 Mantenha seu IP seguro e evite compartilhá-lo desnecessariamente!")
else:
await message.channel.send("❌ Não foi possível obter seu IP público no momento.")
except requests.RequestException as e:
print(f"Erro ao obter IP público: {e}")
await message.channel.send("❌ Ocorreu um erro ao tentar obter seu IP público.")
elif message.content.startswith('/clear'):
channel = message.content.split(' ')[1] if len(message.content.split(' ')) > 1 else None
if channel:
try:
channel = self.get_channel(int(channel))
except ValueError:
channel = None
else:
channel = message.channel
if channel:
async for message in channel.history(limit=500): # Limite de mensagens a serem apagadas
try:
await message.delete()
except Exception as e:
# Captura e exibe erros ao tentar deletar mensagens
print(f"Erro ao deletar mensagem: {e}")
else:
print("Canal não encontrado ou ID inválido.")
delete = dd.utils.get(self.get_all_channels(), name="🗑️ Deletar Mensagens")
delall = [
"🗑️ Invocando o exército de robôs limpadores...",
"🤖 Robô 1: 'Preparando lasers anti-memes!'",
"🤖 Robô 2: 'Carregando aspirador de vergonha...'",
"💣 Ativando protocolo de autodestruição de mensagens...",
"🧹 Varrendo piadas ruins para debaixo do tapete digital...",
"🦠 Eliminando vírus de cringe...",
"🕳️ Abrindo buraco negro para memes esquecidos...",
"🧽 Esfregando o histórico até brilhar...",
"🚀 Enviando mensagens antigas para Marte...",
"🎩 Fazendo mágica: *abracadabra, sumam!*",
"💨 Deletando rastros do passado...",
"🎉 Pronto! Seu servidor está mais limpo que nunca! ✨"
]
msg = await message.channel.send(delall[0])
for item in delall[1:]:
await asyncio.sleep(1.1)
await msg.edit(content=item)
# Pequena animação de "limpeza final"
for dots in ["🧽", "🧽🧽", "🧽🧽🧽", "✨"]:
await asyncio.sleep(0.4)
await msg.edit(content=f"Limpando as paradas... {dots}")
await asyncio.sleep(0.7)
await msg.edit(content="✅ Tudo limpo! Seu servidor está brilhando! ✨")
delete
#/not
elif message.content == '/not':
embeds = []
# G1 Tecnologia
try:
response_g1 = requests.get('https://g1.globo.com/tecnologia/')
if response_g1.status_code == 200:
soup_g1 = BeautifulSoup(response_g1.content, 'html.parser')
noticias_g1 = soup_g1.find_all('a', class_='feed-post-link gui-color-primary gui-color-hover')
for noticia in noticias_g1[:10]:
titulo = noticia.get_text(strip=True)
link = noticia['href']
parent = noticia.find_parent('div', class_='feed-post-body')
resumo = None
hora = None
imagem = None
if parent:
resumo_tag = parent.find('div', class_='feed-post-body-resumo')
if resumo_tag:
resumo = resumo_tag.get_text(strip=True)
hora_tag = parent.find('span', class_='feed-post-datetime')
if hora_tag:
hora = hora_tag.get_text(strip=True)
img_tag = parent.find('img')
if img_tag and img_tag.has_attr('src'):
imagem = img_tag['src']
embed = dd.Embed(
title=f"📰 {titulo}",
url=link,
color=0x1abc9c,
description=resumo if resumo else "Sem resumo disponível."
)
if hora:
embed.set_footer(text=f"Fonte: G1 Tecnologia | {hora}")
else:
embed.set_footer(text="Fonte: G1 Tecnologia")
if imagem:
embed.set_image(url=imagem)
embeds.append(embed)
except requests.RequestException as e:
print(f"Erro ao acessar G1 Tecnologia: {e}")
await message.channel.send("Erro ao acessar o G1 Tecnologia.")
try:
response_tm = requests.get('https://www.tecmundo.com.br/novidades')
if response_tm.status_code == 200:
soup_tm = BeautifulSoup(response_tm.content, 'html.parser')
noticias_tm = soup_tm.find_all('a', class_='tec--card__title__link')
for noticia in noticias_tm[:2]:
titulo = noticia.get_text(strip=True)
link = noticia['href']
card = noticia.find_parent('div', class_='tec--card')
resumo = None
imagem = None
hora = None
if card:
resumo_tag = card.find('div', class_='tec--card__description')
if resumo_tag:
resumo = resumo_tag.get_text(strip=True)
img_tag = card.find('img')
if img_tag and img_tag.has_attr('src'):
imagem = img_tag['src']
hora_tag = card.find('time')
if hora_tag and hora_tag.has_attr('datetime'):
hora = hora_tag['datetime']
embed = dd.Embed(
title=f"📰 {titulo}",
url=link,
color=0x3498db,
description=resumo if resumo else "Sem resumo disponível."
)
if hora:
embed.set_footer(text=f"Fonte: TecMundo | {hora}")
else:
embed.set_footer(text="Fonte: TecMundo")
if imagem:
embed.set_image(url=imagem)
embeds.append(embed)
else:
await message.channel.send("Erro ao acessar o TecMundo.")
except Exception as e:
print(f"Erro ao buscar notícias do TecMundo: {e}")
# Canaltech
try:
response_ct = requests.get('https://canaltech.com.br/ultimas/')
if response_ct.status_code == 200:
soup_ct = BeautifulSoup(response_ct.content, 'html.parser')
noticias_ct = soup_ct.find_all('a', class_='card-article')
for noticia in noticias_ct[:2]:
titulo = noticia.find('h3').get_text(strip=True) if noticia.find('h3') else "Sem título"
link = noticia['href']
resumo = noticia.find('p').get_text(strip=True) if noticia.find('p') else None