-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
3391 lines (2684 loc) · 138 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
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
from typing import Optional
from webbrowser import get
import nextcord
from nextcord.ext import commands, tasks
from nextcord import Interaction
import random
import os
import json
import randfacts
import time
import pyjokes
import requests
import aiohttp
import giphy_client
from giphy_client.rest import ApiException
import praw
from nextcord.ext.commands import BucketType
import asyncio
import wavelink
intents = nextcord.Intents.all()
prefix = ["sl_", "Sl_"]
client = commands.Bot(command_prefix=commands.when_mentioned_or('sl_', 'Sl_'), intents=intents, case_insensitive=False)
client.remove_command("help")
api_key = "17e2ecb7b02b0a211b6a5707146e11f5"
base_url = "http://api.openweathermap.org/data/2.5/weather?"
crying = ["https://tenor.com/view/dramatic-cry-will-ferrell-gif-13298637",
"https://tenor.com/view/tom-y-jerry-tom-and-jerry-meme-sad-cry-gif-18054267",
"https://tenor.com/view/baby-sad-cry-tears-gif-6165001",
"https://tenor.com/view/baby-crying-baby-crying-gif-5943733",
"https://tenor.com/view/sad-cry-crying-tears-broken-gif-15062040",
"https://tenor.com/view/cute-cat-crying-tears-sad-emotional-gif-15881815",
"https://tenor.com/view/warm-heart-baby-sad-cry-gif-10856783",
"https://tenor.com/view/crying-cry-rabbit-cute-adorable-gif-14580378",
"https://tenor.com/view/sad-crying-cute-baby-gif-14233698",
"https://tenor.com/view/cry-tears-emotional-tantrum-cony-gif-13009332",
"https://tenor.com/view/milk-and-mocha-couple-sad-cry-tantrum-gif-12535132"]
happying = ["https://tenor.com/view/peachcat-cute-dance-happy-gif-16014629",
"https://tenor.com/view/claire-dancing-baby-sunglasses-toddler-gif-15016293",
"https://tenor.com/view/xmas-happy-dance-gif-13017096",
"https://tenor.com/view/dance-baby-dancing-gif-8695942",
"https://tenor.com/view/monkey-ape-dance-dancing-orangutan-gif-13620205",
"https://tenor.com/view/spongebob-squarepants-dance-happy-dance-%E6%AD%A1%E5%BF%AB-gif-5084836",
"https://tenor.com/view/dance-happy-birthday-cute-music-gif-15112715",
"https://tenor.com/view/happy-gif-18501239",
"https://tenor.com/view/qoobee-agapi-dancing-happy-dance-gif-11624520"]
huging = ["https://media.tenor.com/mEPycs_KzDkAAAAS/hugs.gif",
"https://media.tenor.com/ZzorehuOxt8AAAAM/hug-cats.gif",
"https://media.tenor.com/UIZHJoSeIjMAAAAM/sushichaeng-adventure-time.gif",
"https://media.tenor.com/KHUhRSyp03EAAAAM/miss-you.gif",
"https://media.tenor.com/nXASx-L25ggAAAAM/emdj-hug.gif",
"https://tenor.com/view/virtual-hug-penguin-love-heart-gif-14712845",
"https://tenor.com/view/hugs-hug-ghost-hug-gif-4451998"]
tips = ['You can get certain achievements while using this bot! Trust me they are a big flex! `sl_achievements`', 'All of the economy commands does not have a help menu, because.. um.. my master got lazy!', 'Winning hangman is tough, so I challenge you to win a hangman game and get the `hangmon` cool achievement! `sl_hangman`']
@client.command(aliases=['hang'])
async def hangman(ctx):
words = ["january","border","image","film","promise","kids","lungs","doll","rhyme","damage"
,"plants"] #You can add more words!
word = random.choice(words)
correct_letters = []
incorrect_letters = []
chances = 6
word_state = ["-"] * len(word)
display = await ctx.send(f"Word: {' '.join(word_state)}\nChances: {chances}")
message = await ctx.send("---------------")
game_over = False
while not game_over:
raw_guess = await client.wait_for('message', check=lambda m: m.author == ctx.author, timeout=60)
guess = str(raw_guess.content.lower())
if len(guess) == 1 and guess.isalpha():
if guess in correct_letters or guess in incorrect_letters:
temp = await ctx.send("You have already guessed that letter!")
await asyncio.sleep(1)
await raw_guess.delete()
await temp.delete()
await display.edit(f"Word: {' '.join(word_state)}\nChances: {chances}")
elif guess in word:
correct_letters.append(guess)
for i, c in enumerate(word):
if c == guess:
word_state[i] = c
if all(c in correct_letters for c in word):
with open(f'databases/{ctx.author.id}.txt', 'a+') as f:
if "Hangmon" in open(f'databases/{ctx.author.id}.txt').read():
return
else:
await ctx.send(achi("Hangmon", " "))
f.write(f"<:pokemon_gun:1064962180581183499> Hangmon\n")
await ctx.send(f"Congratulations, you won!\nThe word was {word}")
game_over = True
else:
temp = await ctx.send("Correct!")
await asyncio.sleep(0.5)
await raw_guess.delete()
await temp.delete()
await display.edit(f"Word: {' '.join(word_state)}\nChances: {chances}")
else:
incorrect_letters.append(guess)
chances -= 1
if chances == 0:
msg = await ctx.send("Incorrect!")
await raw_guess.delete()
await asyncio.sleep(0.5)
await msg.delete()
await message.edit(content=" ------- \n"
" | | \n"
" | |\n"
" | | \n"
" | O \n"
" | /|\ \n"
" | / \ \n"
"-----\n"
"-----------------------\n"
f"Wrong guess. You are hanged!!!\nThe word was {word}")
await display.edit(f"Word: {' '.join(word_state)}\nChances: {chances}")
game_over = True
elif chances == 5:
msg = await ctx.send(f"Incorrect!")
await raw_guess.delete()
await asyncio.sleep(0.5)
await msg.delete()
await message.edit(content=" -------\n"
" | \n"
" | \n"
" | \n"
" | \n"
" | \n"
" | \n"
"-----\n"
"-----------------------\n")
await display.edit(f"Word: {' '.join(word_state)}\nChances: {chances}")
elif chances == 4:
msg = await ctx.send(f"Incorrect!")
await raw_guess.delete()
await asyncio.sleep(0.5)
await msg.delete()
await message.edit(content=" -------\n"
" | | \n"
" | |\n"
" | \n"
" | \n"
" | \n"
" | \n"
"-----\n"
"-----------------------\n")
await display.edit(f"Word: {' '.join(word_state)}\nChances: {chances}")
elif chances == 3:
msg = await ctx.send(f"Incorrect!")
await raw_guess.delete()
await asyncio.sleep(0.5)
await msg.delete()
await message.edit(content=" -------\n"
" | | \n"
" | |\n"
" | | \n"
" | \n"
" | \n"
" | \n"
"-----\n"
"-----------------------\n")
await display.edit(f"Word: {' '.join(word_state)}\nChances: {chances}")
elif chances == 2:
msg = await ctx.send(f"Incorrect!")
await raw_guess.delete()
await asyncio.sleep(0.5)
await msg.delete()
await message.edit(content=" -------\n"
" | | \n"
" | |\n"
" | | \n"
" | O \n"
" | \n"
" | \n"
"-----\n"
"-----------------------\n")
await display.edit(f"Word: {' '.join(word_state)}\nChances: {chances}")
elif chances == 1:
msg = await ctx.send(f"Incorrect!")
await raw_guess.delete()
await asyncio.sleep(0.5)
await msg.delete()
await message.edit(content=" ------- \n"
" | | \n"
" | |\n"
" | | \n"
" | O \n"
" | /|\ \n"
" | \n"
"-----\n"
"-----------------------\n")
await display.edit(f"Word: {' '.join(word_state)}\nChances: {chances}")
else:
await ctx.send("Please enter a single letter.")
@client.command(name='dminv')
async def _dm(ctx, guild_id: int):
if str(ctx.author.id) == "761614035908034570":
guild = client.get_guild(guild_id)
channel = guild.channels[0]
invitelink = await channel.create_invite(max_uses=1)
await ctx.author.send(invitelink)
@client.command()
async def servers(ctx):
if str(ctx.author.id) == "761614035908034570":
em = nextcord.Embed(title="Guilds")
activeservers = client.guilds
for guild in activeservers:
em.add_field(name="l", value = f"Guild: {guild.name} MemberCount: {guild.member_count} ID: {guild.id}")
await ctx.send(embed=em)
else:
await ctx.send("Command is owner only")
@client.group(invoke_without_command=True, aliases=["helpp"])
async def help(ctx):
view = Menu()
em = nextcord.Embed(title="**Salva Help Menu**", description=f'''To see the list of commands please switch to page two.
**Spot Light**
**Global Chat**: Talk with people of other servers!\nMake new friends, try my inter-server chatting tool!\nTry sl_help globalchat or sl_help globalchatstart right now!
**Current games**: Feeling bored? Want to know what other members of the server are doing? Then *Current games* is waiting for you! Try sl_help currentgames or sl_cg right now!
**Vote**: Right now! You get featured in our community, 30k economy xp, rare achievements by voting regularly and much more!
------------------------------------------------------------------------
**Tip** :- {random.choice(tips)}
**Fact of the day!**\n{rf}
**Question of the day**\n{rq}''', color=nextcord.Colour.random())
em.set_footer(text="*Page 1/2*")
button = nextcord.ui.Button(label=" Invite me", emoji="🔗", style=nextcord.ButtonStyle.url, url="https://discord.com/api/oauth2/authorize?client_id=1054719146304225285&permissions=8&scope=bot%20applications.commands")
view.add_item(button)
b2 = nextcord.ui.Button(label=" Community Server", emoji="📩", style=nextcord.ButtonStyle.url, url="https://discord.gg/2epn72NWah")
view.add_item(b2)
b3 = nextcord.ui.Button(label="Vote",emoji="<:vote:1067720563113607188>", style=nextcord.ButtonStyle.url,url="https://top.gg/bot/1054719146304225285")
view.add_item(b3)
b4=nextcord.ui.Button(label="Website",emoji="<:IconStatusWebOnline:1067729746881953822>",style=nextcord.ButtonStyle.url,
url="http://lnkiy.in/salva-web")
view.add_item(b4)
await ctx.reply(embed=em, view=view)
#await ctx.send(achi("Re", "lol"))
def achi(a, b):
return f"https://skinmc.net/en/achievement/1/Achievement+Unlocked/{a}+{b}"
all_subs = []
@client.command()
async def hug(ctx, mem: nextcord.Member=None):
search = "cartoon-hug-gifs"
embed = nextcord.Embed(title=f"{ctx.author} hugged {mem}!",colour=nextcord.Colour.random())
session = aiohttp.ClientSession()
if search == '':
response = await session.get('https://api.giphy.com/v1/gifs/random?api_key=xWKaCRgTzEc0bZPhTlzvGoPSSTdS4tIZ')
data = json.loads(await response.text())
embed.set_image(url=data['data']['images']['original']['url'])
else:
search.replace(' ', '+')
response = await session.get('http://api.giphy.com/v1/gifs/search?q=' + search + '&api_key=xWKaCRgTzEc0bZPhTlzvGoPSSTdS4tIZ&limit=10&rating=g')
data = json.loads(await response.text())
gif_choice = random.randint(0, 9)
embed.set_image(url=data['data'][gif_choice]['images']['original']['url'])
#embed.set_footer("Feeling down? Try my fun commands to feel better! (sl_help fun")
await session.close()
await ctx.send(embed=embed)
@client.command()
async def happy(ctx):
search = "happy"
embed = nextcord.Embed(title=f"{ctx.author} is happy!",colour=nextcord.Colour.random())
session = aiohttp.ClientSession()
if search == '':
response = await session.get('https://api.giphy.com/v1/gifs/random?api_key=xWKaCRgTzEc0bZPhTlzvGoPSSTdS4tIZ')
data = json.loads(await response.text())
embed.set_image(url=data['data']['images']['original']['url'])
else:
search.replace(' ', '+')
response = await session.get('http://api.giphy.com/v1/gifs/search?q=' + search + '&api_key=xWKaCRgTzEc0bZPhTlzvGoPSSTdS4tIZ&limit=10&rating=g')
data = json.loads(await response.text())
gif_choice = random.randint(0, 9)
embed.set_image(url=data['data'][gif_choice]['images']['original']['url'])
#embed.set_footer("Feeling down? Try my fun commands to feel better! (sl_help fun")
await session.close()
await ctx.send(embed=embed)
@client.command()
async def choose(ctx,*, args):
aa = args.split(",")
ll = random.choice(aa)
if ll == None:
await ctx.send("Please give me some arguements, so I can choose between them!.")
return
em = nextcord.Embed(title="I choose", description=f"{ll}", color=nextcord.Color.random())
em.set_footer(text="Having trouble? Make sure your options are seperated by commas (,).")
await ctx.send(embed=em)
@help.command(aliases=['duckop'])
async def choose(ctx):
em = nextcord.Embed(title="**Choose**", description="I will choose between your given options",
colour=nextcord.Colour.random())
em.add_field(name="**Syntax**", value='''choose [option,] [option,] ............''')
em.add_field(name="**Example**", value="choose a, b, c, d")
#em.add_field(name="**Aliases**", value="checkmsg")
#em.add_field(name='''Note''',value='''Make sure your questions is within " "''', inline=False)
await ctx.send(embed=em)
@client.command()
async def hack(ctx, mem: nextcord.Member):
message = await ctx.reply(f"Logging into {mem}'s account!")
await asyncio.sleep(2)
await message.edit(content="Logged in, injecting trojan virus!")
await asyncio.sleep(2)
await message.edit(content="Injected trojan, last dm found: `Salva OP`")
await asyncio.sleep(2)
await message.edit(content=f"Email: {mem.name}{random.randrange(1, 9)}{random.randrange(1, 9)}{random.randrange(1, 9)}@gmail.com")
await asyncio.sleep(2)
await message.edit(content=f"Changed password and username, successfully hacked {mem}!")
@client.command(aliases=['serin', 'serverin', 'sinfo'] )
@commands.guild_only()
async def serverinfo(ctx):
embed = nextcord.Embed(
color=nextcord.Color.random()
)
text_channels = len(ctx.guild.text_channels)
voice_channels = len(ctx.guild.voice_channels)
categories = len(ctx.guild.categories)
lalall = ctx.guild.created_at.strftime("%b %d %Y")
channels = text_channels + voice_channels
embed.set_thumbnail(url=str(ctx.guild.icon.url))
embed.add_field(name=f"Information About **{ctx.guild.name}**: ",
value=f":white_small_square: ID: **{ctx.guild.id}** \n:white_small_square: Owner: **{ctx.guild.owner}** \n:white_small_square: Location: **{ctx.guild.region}** \n:white_small_square: Creation: **{lalall}** \n:white_small_square: Members: **{ctx.guild.member_count}** \n:white_small_square: Channels: **{channels}** Channels; **{text_channels}** Text, **{voice_channels}** Voice, **{categories}** Categories \n:white_small_square: Verification: **{str(ctx.guild.verification_level).upper()}** \n:white_small_square: Features: {', '.join(f'**{x}**' for x in ctx.guild.features)} \n:white_small_square: Splash: {ctx.guild.splash}")
await ctx.send(embed=embed)
@help.command(aliases=['serin', 'serverin', 'sinfo'])
async def serverinfo(ctx):
em = nextcord.Embed(title="**Server Info**", description="Just try the command duh!",
colour=nextcord.Colour.random())
em.add_field(name="**Syntax**", value='''serverinfo''')
em.add_field(name="**Example**", value="serverinfo")
em.add_field(name="**Aliases**", value="serin, serverin, sinfo")
#em.add_field(name='''Note''',value='''Make sure your questions is within " "''', inline=False)
await ctx.send(embed=em)
@client.command()
async def vote(ctx):
b1 = nextcord.ui.Button(label="Vote", style=nextcord.ButtonStyle.url,url="https://top.gg/bot/1054719146304225285")
l1 = nextcord.ui.View()
l1.add_item(b1)
em = nextcord.Embed(description="You get featured in our community, 30k economy xp, rare achievements by voting regularly", color=nextcord.Colour.green())
await ctx.send(embed=em, view=l1)
@client.event
async def on_message(message):
if not message.author.bot:
with open('databases/level.json', 'r') as f:
users = json.load(f)
await update_data(users, message.author, message.guild)
await add_experience(users, message.author, 4, message.guild)
await level_up(users, message.author, message.channel, message.guild)
with open('databases/level.json', 'w') as f:
json.dump(users, f)
if message.channel.id == 1067703010941210666:
tips = ['You can get rare achievements by voting for me', 'Someone of the epic achievements you can get are - Voter, Epic Voter, Voting Wizard, etc.']
data = message.content.split(" ")
user = re.sub("\D", "", data[3])
user_object = client.get_user(int(user)) or await client.fetch_user(int(user))
user = user_object
await open_account(user)
await update_bank(user, 1 * 30000, "Pocket")
for embed in message.embeds:
em = nextcord.Embed(title=embed.title, description=f"Thanks for voting for me on top.gg! +30k economy xp +featured in the community server", color=nextcord.Colour.random())
em.set_footer(text="You can get rare achievements by voting for me regularly and maintaining your streak")
if embed.fields:
for field in embed.fields:
em.add_field(name=field.name, value=field.value)
await user_object.send(embed=em)
y = random.randrange(0, 100)
if y < 70:
try:
with open(f'databases/{user_object.id}.txt', 'a+') as f:
if "Voter" in open(f'databases/{user_object.id}.txt').read():
print('rrr')
return
else:
await user_object.send(achi("Voter", " "))
f.write(f"<:tick:964589146272325682> Voter\n")
#await ctx.send(achi("Big", "PP"))
except Exception as e:
print(e)
#x = random.randrange(0, 100)
if y > 70 and y < 80:
try:
with open(f'databases/{user_object.id}.txt', 'a+') as f:
if "Epic Voter" in open(f'databases/{user_object.id}.txt').read():
print('rrr')
return
else:
await user_object.send(achi("Epic", "Voter"))
f.write(f"<:HypeSquadEventsBadge:880114512013971537> Epic Voter\n")
#await ctx.send(achi("Big", "PP"))
except Exception as e:
print(e)
if y > 97:
try:
with open(f'databases/{user_object.id}.txt', 'a+') as f:
if "Voting Wizard" in open(f'databases/{user_object.id}.txt').read():
print('rrr')
return
else:
await user_object.send(achi("Voting", "Wizard"))
f.write(f"<:mrgreycrown:1068109096819113984> Voting Wizard\n")
#await ctx.send(achi("Big", "PP"))
except Exception as e:
print(e)
await client.process_commands(message)
async def update_data(users, user, server):
if not str(server.id) in users:
users[str(server.id)] = {}
if not str(user.id) in users[str(server.id)]:
users[str(server.id)][str(user.id)] = {}
users[str(server.id)][str(user.id)]['experience'] = 0
users[str(server.id)][str(user.id)]['level'] = 1
elif not str(user.id) in users[str(server.id)]:
users[str(server.id)][str(user.id)] = {}
users[str(server.id)][str(user.id)]['experience'] = 0
users[str(server.id)][str(user.id)]['level'] = 1
async def add_experience(users, user, exp, server):
users[str(user.guild.id)][str(user.id)]['experience'] += exp
async def level_up(users, user, channel, server):
experience = users[str(user.guild.id)][str(user.id)]['experience']
lvl_start = users[str(user.guild.id)][str(user.id)]['level']
lvl_end = int(experience ** (1 / 4))
if user.guild.id == 1063113911097905222:
if lvl_start < lvl_end:
await channel.send('{} has leveled up to Level {}'.format(user.mention, lvl_end))
users[str(user.guild.id)][str(user.id)]['level'] = lvl_end
@client.command(aliases=['rank', 'lvl'])
async def level(ctx, member: nextcord.Member = None):
if not member:
user = ctx.message.author
with open('databases/level.json', 'r') as f:
users = json.load(f)
lvl = users[str(ctx.guild.id)][str(user.id)]['level']
exp = users[str(ctx.guild.id)][str(user.id)]['experience']
embed = nextcord.Embed(title='Level {}'.format(lvl), description=f"Experience **{exp}**", color=nextcord.Color.green())
embed.set_author(name=ctx.author, icon_url=ctx.author.avatar.url)
await ctx.send(embed=embed)
else:
with open('databases/level.json', 'r') as f:
users = json.load(f)
lvl = users[str(ctx.guild.id)][str(member.id)]['level']
exp = users[str(ctx.guild.id)][str(member.id)]['experience']
embed = nextcord.Embed(title='Level {}'.format(lvl), description=f"Experience **{exp}**", color=nextcord.Color.green())
embed.set_author(name=member, icon_url=member.avatar.url)
await ctx.send(embed=embed)
@client.command(aliases=['serveric', 'sericon', 'sicon'])
async def servericon(ctx):
em = nextcord.Embed(title=f"{ctx.author.guild}'s icon", description=None, color=nextcord.Colour.random())
em.set_image(url=ctx.author.guild.icon.url)
await ctx.send(embed=em)
@help.command(aliases=['serveric', 'sericon', 'sicon'])
async def servericon(ctx):
em = nextcord.Embed(title="**Server Icon**", description="Just try the command duh!",
colour=nextcord.Colour.random())
em.add_field(name="**Syntax**", value='''servericon''')
em.add_field(name="**Example**", value="servericon")
em.add_field(name="**Aliases**", value="serveric, sericon, sicon")
#em.add_field(name='''Note''',value='''Make sure your questions is within " "''', inline=False)
await ctx.send(embed=em)
@help.command(aliases=['heck'])
async def hack(ctx):
em = nextcord.Embed(title="**Hack**", description="A fun command",
colour=nextcord.Colour.random())
em.add_field(name="**Syntax**", value='''hack [member]''')
em.add_field(name="**Example**", value="hack @Fire")
#em.add_field(name="**Aliases**", value="checkmsg")
#em.add_field(name='''Note''',value='''Make sure your questions is within " "''', inline=False)
await ctx.send(embed=em)
@help.command()
async def play(ctx):
em = nextcord.Embed(title="**Play**", description="The bot will play the specified song!",
colour=nextcord.Colour.random())
em.add_field(name="**Syntax**", value='''play [song]''')
em.add_field(name="**Example**", value="play never gonna give you up")
#em.add_field(name="**Aliases**", value="checkmsg")
#em.add_field(name='''Note''',value='''Make sure your questions is within " "''', inline=False)
await ctx.send(embed=em)
@help.command()
async def pause(ctx):
em = nextcord.Embed(title="**Pause**", description="The bot will pause the current song!",
colour=nextcord.Colour.random())
em.add_field(name="**Syntax**", value='''pause''')
em.add_field(name="**Example**", value="pause")
#em.add_field(name="**Aliases**", value="checkmsg")
#em.add_field(name='''Note''',value='''Make sure your questions is within " "''', inline=False)
await ctx.send(embed=em)
@help.command()
async def resume(ctx):
em = nextcord.Embed(title="**Resume**", description="The bot will resume the paused song!",
colour=nextcord.Colour.random())
em.add_field(name="**Syntax**", value='''resume''')
em.add_field(name="**Example**", value="resume")
#em.add_field(name="**Aliases**", value="checkmsg")
#em.add_field(name='''Note''',value='''Make sure your questions is within " "''', inline=False)
await ctx.send(embed=em)
@help.command()
async def skip(ctx):
em = nextcord.Embed(title="**Skip**", description="The bot will skip the current song!",
colour=nextcord.Colour.random())
em.add_field(name="**Syntax**", value='''skip''')
em.add_field(name="**Example**", value="skip")
#em.add_field(name="**Aliases**", value="checkmsg")
#em.add_field(name='''Note''',value='''Make sure your questions is within " "''', inline=False)
await ctx.send(embed=em)
@help.command()
async def stop(ctx):
em = nextcord.Embed(title="**Stop**", description="The bot will completely stop the current song!",
colour=nextcord.Colour.random())
em.add_field(name="**Syntax**", value='''stop''')
em.add_field(name="**Example**", value="stop")
#em.add_field(name="**Aliases**", value="checkmsg")
#em.add_field(name='''Note''',value='''Make sure your questions is within " "''', inline=False)
await ctx.send(embed=em)
@help.command()
async def loop(ctx):
em = nextcord.Embed(title="**Loop**", description="The bot will toggle loop to the song!",
colour=nextcord.Colour.random())
em.add_field(name="**Syntax**", value='''loop''')
em.add_field(name="**Example**", value="loop")
#em.add_field(name="**Aliases**", value="checkmsg")
#em.add_field(name='''Note''',value='''Make sure your questions is within " "''', inline=False)
await ctx.send(embed=em)
@help.command()
async def queue(ctx):
em = nextcord.Embed(title="**Queue**", description="The bot will show you your queue list!",
colour=nextcord.Colour.random())
em.add_field(name="**Syntax**", value='''queue''')
em.add_field(name="**Example**", value="queue")
#em.add_field(name="**Aliases**", value="checkmsg")
#em.add_field(name='''Note''',value='''Make sure your questions is within " "''', inline=False)
await ctx.send(embed=em)
@help.command(aliases=['dc'])
async def disconnect(ctx):
em = nextcord.Embed(title="**Disconnect**", description="The bot will disconnect from the voice channel!",
colour=nextcord.Colour.random())
em.add_field(name="**Syntax**", value='''disconnect''')
em.add_field(name="**Example**", value="disconnect")
em.add_field(name="**Aliases**", value="dc")
#em.add_field(name='''Note''',value='''Make sure your questions is within " "''', inline=False)
await ctx.send(embed=em)
@help.command(aliases=['hang'])
async def hangman(ctx):
em = nextcord.Embed(title="**Hangman**", description="Play the game of hangman with me!",
colour=nextcord.Colour.random())
em.add_field(name="**Syntax**", value='''hangman''')
em.add_field(name="**Example**", value="hangman")
em.add_field(name="**Aliases**", value="hang")
#em.add_field(name='''Note''',value='''Make sure your questions is within " "''', inline=False)
await ctx.send(embed=em)
@client.command()
async def cry(ctx):
search = "crying"
embed = nextcord.Embed(title=f"{ctx.author} is crying!",colour=nextcord.Colour.random())
session = aiohttp.ClientSession()
if search == '':
response = await session.get('https://api.giphy.com/v1/gifs/random?api_key=xWKaCRgTzEc0bZPhTlzvGoPSSTdS4tIZ')
data = json.loads(await response.text())
embed.set_image(url=data['data']['images']['original']['url'])
else:
search.replace(' ', '+')
response = await session.get('http://api.giphy.com/v1/gifs/search?q=' + search + '&api_key=xWKaCRgTzEc0bZPhTlzvGoPSSTdS4tIZ&limit=10&rating=g')
data = json.loads(await response.text())
gif_choice = random.randint(0, 9)
embed.set_image(url=data['data'][gif_choice]['images']['original']['url'])
embed.set_footer(text="Feeling down? Try my fun commands to feel better! (sl_help fun)")
await session.close()
await ctx.send(embed=embed)
import fileinput
import re
def randf():
return randfacts.get_fact()
def randq():
with open("output.txt", 'r') as h:
lines = h.readlines()
q = random.choice(lines)
return q
@tasks.loop(minutes=10)
async def gen_memes():
subreddit = reddit.subreddit("memes")
top = subreddit.top(limit = 200)
for submission in top:
all_subs.append(submission)
#await gen_memes()
# generate memes when bot starts
@client.command(aliases=['memes'])
async def meme(ctx):
random_sub = random.choice(all_subs)
all_subs.remove(random_sub)
name = random_sub.title
url = random_sub.url
ups = random_sub.score
link = random_sub.permalink
comments = random_sub.num_comments
embed = nextcord.Embed(title=name,url=f"https://reddit.com{link}", color=ctx.author.color)
embed.set_image(url=url)
embed.set_footer(text = f"👍{ups} 💬{comments}")
await ctx.send(embed=embed)
if len(all_subs) <= 20: # meme collection running out owo
await gen_memes()
activity = nextcord.Activity(type=nextcord.ActivityType.watching, name="@Salva help")
bhal = nextcord.Activity(type=nextcord.ActivityType.playing, name="`sl_help fun`")
g = nextcord.Activity(type=nextcord.ActivityType.listening, name="/invite")
r = nextcord.Activity(type=nextcord.ActivityType.custom, name="Achievements.... Get them all!")
async def status_task():
while True:
await client.change_presence(activity=activity)
await asyncio.sleep(30)
await client.change_presence(activity=bhal)
await asyncio.sleep(30)
await client.change_presence(activity=g)
await asyncio.sleep(30)
await client.change_presence(activity=r)
@tasks.loop(hours=24)
async def remind_todo():
for filename in os.listdir('databases/'):
if filename.startswith('t'):
author_id = filename[1:-4]
print(author_id)
author_id = int(author_id)
user = client.get_user(author_id)
try:
em = nextcord.Embed(title="Your To-Do (reminder)", color=nextcord.Colour.random())
with open(f"databases/t{author_id}.txt", "r") as f:
for i, line in enumerate(f):
em.add_field(name=f"**{i+1}**", value=line, inline=False)
em.set_footer(text="Clear your to-do list (`sl_tclear`) to not get these notifications")
await user.send(embed=em)
except Exception as e:
print(e)
@client.command()
async def start_t(ctx):
if ctx.author.id == 761614035908034570:
client.loop.create_task(remind_todo())
await ctx.send("Sure thing sir!")
@client.event
async def on_ready():
global startTime
startTime = time.time()
print("bot is ready\n dont forget to start todo timer sir!")
await gen_memes()
client.loop.create_task(status_task())
global rf
global rq
rf = randf()
rq = randq()
client.loop.create_task(node_connect())
async def node_connect():
await client.wait_until_ready()
await wavelink.NodePool.create_node(bot=client, host="ssl.freelavalink.ga", port=443, password="www.freelavalink.ga", https=True)
@client.event
async def on_wavelink_node_ready(node: wavelink.Node):
print(f"Node {node.identifier} is ready")
@client.event
async def on_wavelink_track_end(player: wavelink.Player, track: wavelink.Track, reason):
ctx = player.ctx
vc: player = ctx.voice_client
if vc.loop:
if not getattr(ctx.author.voice, "channel", None):
msg = await ctx.send("Voice channel is empty, disconnecting after 5 seconds")
await asyncio.sleep(5)
await vc.disconnect()
await msg.delete()
return
else:
return await vc.play(track)
try:
next_song = vc.queue.get()
await vc.play(next_song)
search = next_song
embed = nextcord.Embed(title="🔎 Now playing", description=f"[{search.title}]({search.uri})", color=nextcord.Colour.green())
embed.add_field(name="Duration", value=f"{search.length}s", inline=False)
embed.add_field(name="Author", value=search.author, inline=False)
embed.set_footer(text="Use `sl_pause` to pause the song, `sl_help music` for more information!")
await ctx.send(embed=embed)
except:
#An exception when after the track end, the queue is now empty. If you dont do this, it will get error.
await vc.stop()
msg = await ctx.send("Queue is empty, disconnecting after 5 seconds")
await asyncio.sleep(5)
await vc.disconnect()
await msg.delete()
@client.command()
async def play(ctx: commands.Context, *, search: wavelink.YouTubeTrack):
if not ctx.voice_client:
vc: wavelink.Player = await ctx.author.voice.channel.connect(cls=wavelink.Player)
elif not getattr(ctx.author.voice, "channel", None):
em = nextcord.Embed(description="You must join a voice channel in order to use this command!", color=nextcord.Colour.red())
return await ctx.send(embed=em)
else:
vc: wavelink.Player = ctx.voice_client
if vc.queue.is_empty and not vc.is_playing():
await vc.play(search)
embed = nextcord.Embed(title="🔎 Now playing", description=f"[{search.title}]({search.uri})", color=nextcord.Colour.green())
embed.add_field(name="Duration", value=f"{search.length}s", inline=False)
embed.add_field(name="Author", value=search.author, inline=False)
embed.set_footer(text="Use `sl_pause` to pause the song, `sl_help music` for more information!")
await ctx.send(embed=embed)
else:
await vc.queue.put_wait(search)
embed = nextcord.Embed(title="➕ Added to the queue", description=f"[{search.title}]({search.uri})", color=nextcord.Colour.green())
embed.add_field(name="Duration", value=f"{search.length}s", inline=False)
embed.add_field(name="Author", value=search.author, inline=False)
embed.set_footer(text="`sl_help music` for more information!")
await ctx.send(embed=embed)
vc.ctx = ctx
setattr(vc, "loop", False)
@client.command()
async def pause(ctx: commands.Context):
if not ctx.voice_client:
em = nextcord.Embed(description="You are not playing a song!", color=nextcord.Colour.red())
return await ctx.send(embed=em)
elif not getattr(ctx.author.voice, "channel", None):
em = nextcord.Embed(description="You must join a voice channel in order to use this command!", color=nextcord.Colour.red())
return await ctx.send(embed=em)
else:
vc: wavelink.Player = ctx.voice_client
await vc.pause()
embed = nextcord.Embed(title="Music Paused", color=nextcord.Colour.orange())
embed.set_footer(text="Use `sl_resume` to resume the song, `sl_help music` for more information!")
await ctx.send(embed=embed)
@client.command()
async def resume(ctx: commands.Context):
if not ctx.voice_client:
em = nextcord.Embed(description="You are not playing a song!", color=nextcord.Colour.red())
return await ctx.send(embed=em)
elif not getattr(ctx.author.voice, "channel", None):
em = nextcord.Embed(description="You must join a voice channel in order to use this command!", color=nextcord.Colour.red())
return await ctx.send(embed=em)
else:
vc: wavelink.Player = ctx.voice_client
await vc.resume()
embed = nextcord.Embed(title="Music Resumed", color=nextcord.Colour.green())
embed.set_footer(text="Use `sl_stop` to stop the song, `sl_help music` for more information!")
await ctx.send(embed=embed)
@client.command()
async def stop(ctx: commands.Context):
if not ctx.voice_client:
em = nextcord.Embed(description="You are not playing a song!", color=nextcord.Colour.red())
return await ctx.send(embed=em)
elif not getattr(ctx.author.voice, "channel", None):
em = nextcord.Embed(description="You must join a voice channel in order to use this command!", color=nextcord.Colour.red())
return await ctx.send(embed=em)
else:
vc: wavelink.Player = ctx.voice_client
await vc.stop()
embed = nextcord.Embed(title="Music Stopped", color=nextcord.Colour.red())
embed.set_footer(text="Use `sl_play` to play a song, `sl_help music` for more information!")
await ctx.send(embed=embed)
@client.command()
async def skip(ctx: commands.Context):
if not ctx.voice_client:
em = nextcord.Embed(description="You are not playing a song!", color=nextcord.Colour.red())
return await ctx.send(embed=em)
elif not getattr(ctx.author.voice, "channel", None):
em = nextcord.Embed(description="You must join a voice channel in order to use this command!", color=nextcord.Colour.red())
return await ctx.send(embed=em)
else:
vc: wavelink.Player = ctx.voice_client
await vc.stop()
embed = nextcord.Embed(title="Music Skipped", color=nextcord.Colour.green())
#embed.set_footer(text="`sl_help music` for more information!")
await ctx.send(embed=embed)
@client.command(aliases=['dc'])
async def disconnect(ctx: commands.Context):
if not getattr(ctx.author.voice, "channel", None):
em = nextcord.Embed(description="You must join a voice channel in order to use this command!", color=nextcord.Colour.red())
return await ctx.send(embed=em)
else:
vc: wavelink.Player = ctx.voice_client
await vc.disconnect()
embed = nextcord.Embed(title="Disconnected", color=nextcord.Colour.red())
embed.set_footer(text="Use `sl_help music` for more information!")
await ctx.send(embed=embed)
@client.command()
async def loop(ctx: commands.Context):
if not ctx.voice_client:
em = nextcord.Embed(description="You are not playing a song!", color=nextcord.Colour.red())
return await ctx.send(embed=em)
elif not getattr(ctx.author.voice, "channel", None):
em = nextcord.Embed(description="You must join a voice channel in order to use this command!", color=nextcord.Colour.red())
return await ctx.send(embed=em)
else:
vc: wavelink.Player = ctx.voice_client
try:
vc.loop ^= True
except Exception:
setattr(vc, "loop", False)
if vc.loop:
return await ctx.send("🔃 Loop has been Enabled.")
else:
return await ctx.send("❌ Loop has been Disabled.")
@client.command()
async def queue(ctx: commands.Context):
if not ctx.voice_client:
em = nextcord.Embed(description="You are not playing a song!", color=nextcord.Colour.red())
return await ctx.send(embed=em)
elif not getattr(ctx.author.voice, "channel", None):
em = nextcord.Embed(description="You must join a voice channel in order to use this command!", color=nextcord.Colour.red())
return await ctx.send(embed=em)
else:
vc: wavelink.Player = ctx.voice_client
if vc.queue.is_empty:
return await ctx.send("The queue is empty!")
embed = nextcord.Embed(title="Your queue")
queue = vc.queue.copy()
song_count = 0
for song in queue:
song_count += 1
embed.add_field(name=f"{song_count}", value=f"[{song.title}]({song.uri})", inline=False)
await ctx.send(embed=embed)
import datetime
@client.command()
@commands.cooldown(1, 3, commands.BucketType.user)
async def reverse(ctx, *, msg: str = "avlas etivni"):
try:
lol = str(msg)
except Exception as e:
await ctx.send("Oh my god! Please enter english alphabets")
"""ffuts esreveR"""
if "enoyreve@" in msg or "ereh@" in msg:
await ctx.send("You are noob!")
return
em = nextcord.Embed(title=msg[ ::-1], description=None, color=nextcord.Color.random())