This repository has been archived by the owner on May 28, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbot.py
1652 lines (1544 loc) · 60.9 KB
/
bot.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
### Modules ###
import os
import time
import praw
import math
import random
import pickle
import string
import os.path
import discord
import datetime
import requests
from time import sleep
from random import randint
from discord.ext import commands
from discord.ext.commands import *
from discord_slash import SlashCommand, SlashContext
from discord_slash.utils.manage_commands import create_choice, create_option
### Modules end ###
### Startup/variables ###
ids = [
#paste your discord id here
]
bad = [
'fuck',
'asshole',
'nigga',
'motherfucker',
'fuckyou',
'dick'
]
console = False
log = True
if os.name == 'nt':
os.system('cls')
else:
os.system('clear')
print('Enable logging?')
print('=====================')
print('Default is True')
print('1. Yes')
print('2. No')
print('=====================')
con = int(input('Input: '))
if con == 1:
pass
elif con == 2:
log = not log
intents = discord.Intents.all()
errHandlerVer = 'v1'
botVer = 'v1'
currencyVer = 'v1'
if os.name == 'nt':
os.system('cls')
else:
os.system('clear')
owner = 'fstab.goldfish#5794'
homedir = os.path.expanduser("~")
client = commands.Bot(command_prefix=".", intents=intents)
slash = SlashCommand(client, sync_commands=True)
global startTime
startTime = time.time()
client.remove_command('help')
reddit = praw.Reddit(client_id='_pazwWZHi9JldA',
client_secret='1tq1HM7UMEGIro6LlwtlmQYJ1jB4vQ',
user_agent='idk', check_for_async=False)
### Startup/variables end ###
### Command variables ###
beg = True
fish = True
work = True
daily = True
monthly = True
weekly = True
snipe = True
edit = True
shop = True
inventory = True
buy = True
networth = True
lbin = True
ah = True
### Functions and classes ###
data_filename = homedir + "\\database.pickle"
class Data:
def __init__(self, wallet, bank, xp, level, op):
self.wallet = wallet
self.bank = bank
self.xp = xp
self.level = level
self.op = op
class colors:
cyan = '\033[96m'
red = '\033[91m'
green = '\033[92m'
end = '\033[0m'
def load_data():
if os.path.isfile(data_filename):
with open(data_filename, "rb") as file:
return pickle.load(file)
else:
return dict()
def load_member_data(member_ID):
data = load_data()
if member_ID not in data:
return Data(0, 0, 0, 0, 0)
return data[member_ID]
def save_member_data(member_ID, member_data):
data = load_data()
data[member_ID] = member_data
with open(data_filename, "wb") as file:
pickle.dump(data, file)
def get_time():
now = datetime.datetime.now()
current_time = now.strftime("%H:%M:%S")
# def consoleFunc():
# while True:
# cmd = input(f'{colors.cyan}[{colors.end}{colors.green}Console{colors.end}{colors.cyan}]>{colors.end}')
# if cmd == 'shutdown':
# conf = input('Are you sure? (y/n)')
# if conf == 'y':
# # raise SystemExit
# exit()
# elif conf == 'n':
# pass
# else:
# print(f'What is {conf}')
# elif cmd == 'clear':
# os.system('cls')
# elif cmd == 'viewLog':
# os.system('notepad F:\\bot\\logs\\log.txt')
# elif cmd == 'clearLog':
# conf = input('Are you sure (y/n)')
# if conf == 'y':
# os.system('del F:\\bot\\logs\\log.txt -f')
# print('Log file deleted')
# elif conf == 'n':
# pass
# else:
# print(f'What is {conf}')
### Functions and classes end ###
currency = True
## Events ###
@client.event
async def on_ready():
if os.name == 'nt':
os.system('cls')
else:
os.system('clear')
await client.change_presence(activity=discord.Activity(type=discord.ActivityType.listening, name=".help"))
print('Bot is online')
print('==================')
print('------------------')
print('Bot Info')
print(f'Bot version: {colors.cyan}{botVer}{colors.end}')
print(f'Error handler version: {colors.cyan}{errHandlerVer}{colors.end}')
print(f'Currency system version: {colors.cyan}{currencyVer}{colors.end}')
print(f'Username: {colors.green}{client.user.name}{colors.end}\nId: {colors.green}{client.user.id}{colors.end}\nDeveloper name: {colors.green}{owner}{colors.end}')
print('==================')
print('Server list:')
print('------------------')
for guild in client.guilds:
guild_owner = client.get_user(guild.owner.id)
print(f'Server name: {colors.green}{guild.name}{colors.end}\nServer id: {colors.cyan}{guild.id}{colors.end}\nMember count: {colors.green}{guild.member_count}{colors.end}\nServer owner: {colors.cyan}{guild_owner}{colors.end}')
print('----------------')
print('==================')
print('Bot config:')
print('------------------')
print(f'Ping: {round(client.latency * 1000)}')
print('------------------')
boot = str(datetime.timedelta(seconds=int(round(time.time()-startTime))))
print(f'Startup time: {boot}')
print('------------------')
print(f'Server count: {str(len(client.guilds))}')
print('------------------')
if bool(currency) == True:
print(f'Currency: {colors.green}{currency}{colors.end}')
else:
print(f'Currency: {colors.red}{currency}{colors.end}')
print('------------------')
if bool(log) == True:
print(f'Logging: {colors.green}{log}{colors.end}')
print('------------------')
else:
print(f'Logging: {colors.red}{log}{colors.end}')
print('------------------')
if bool(console) == True:
print(f'Console: {colors.green}{console}{colors.end}')
print('==================')
threading.Thread(target=consoleFunc).start()
else:
print(f'Console: {colors.red}{console}{colors.end}')
print('==================')
pass
print('Bot admins')
print('------------------')
print(colors.cyan)
for id in ids:
print(id)
print(colors.end)
print('==================')
# Error handler #
@client.event
async def on_command_error(ctx, error):
now = datetime.datetime.now()
current_time = now.strftime("%H:%M:%S")
if isinstance(error, CommandNotFound):
pass
if isinstance(error, CommandOnCooldown):
await ctx.send(f'This command is on cooldown. Please try after {math.ceil(error.retry_after)} seconds')
if os.name == 'nt':
with open('F:\\bot\\logs\\errors.txt', 'a') as f:
f.write(f'[{current_time}]Ignoring exception at CommandOnCooldown. Details: This command is currently on cooldown\n')
f.close()
else:
pass
if isinstance(error, MissingRequiredArgument):
await ctx.send('Missing required argument(s)')
if os.name == 'nt':
with open('F:\\bot\\logs\\errors.txt', 'a') as f:
f.write(f'[{current_time}]Ignoring exception at MissingRequiredArgument. Details: The command can\'t be executed because required arguments are missing\n')
f.close()
else:
pass
if isinstance(error, MissingPermissions):
await ctx.send('You dont have permissions to use this')
if os.name == 'nt':
with open('F:\\bot\\logs\\errors.txt', 'a') as f:
f.write(f'[{current_time}]Ignoring exception at MissingPermissions. Details: The user doesn\'t have the required permissions')
f.close()
else:
pass
if isinstance(error, BadArgument):
await ctx.send('Invalid argument')
if os.name == 'nt':
with open('F:\\bot\\logs\\errors.txt', 'a') as f:
f.write(f'[{current_time}]Ignoring exception at BadArgument')
f.close()
else:
pass
if isinstance(error, BotMissingPermissions):
await ctx.send('I don\'t have the required permissions to use this.')
# Error handler end #
snipe_message_author = {}
snipe_message_content = {}
@client.event
async def on_message_delete(message):
now = datetime.datetime.now()
current_time = now.strftime("%H:%M:%S")
guild = client.guilds[0]
channel = message.channel
snipe_message_author[message.channel.id] = message.author
snipe_message_content[message.channel.id] = message.conten
@client.event
async def on_message_edit(message_before, message_after):
global author
author = message_before.author
guild = message_before.guild.id
channel = message_before.channel
global before
before = message_before.content
global after
after = message_after.content
if any(x in message_after.content.lower() for x in bad):
await message_after.delete()
@client.event
async def on_message(message):
if not message.author.bot:
member_data = load_member_data(message.author.id)
member_data.xp += 1
if member_data.level == 0:
if member_data.xp >= 25:
member_data.xp -= member_data.xp
member_data.level += 1
await message.channel.send(f"<@{message.author.id}> You leveled up to level {member_data.level}")
else:
pass
elif member_data.level == 1:
if member_data.xp >= 50:
member_data.xp -= member_data.xp
member_data.level += 1
await message.channel.send(f"<@{message.author.id}> You leveled up to level {member_data.level}")
else:
pass
elif member_data.level == 2:
if member_data.xp >= 100:
member_data.xp -= member_data.xp
member_data.level += 1
await message.channel.send(f"<@{message.author.id}> You leveled up to level {member_data.level}")
else:
pass
elif member_data.level == 3:
if member_data.xp >= 500:
member_data.xp -= member_data.xp
member_data.level += 1
await message.channel.send(f"<@{message.author.id}> You leveled up to level {member_data.level}")
elif member_data.level == 4:
if member_data.xp >= 750:
member_data.xp -= member_data.xp
member_data.level += 1
await message.channel.send(f"<@{message.author.id}> You leveled up to level {member_data.level}")
else:
pass
elif member_data.level >= 5:
if member_data.xp >= 1000:
member_data.xp -= member_data.xp
member_data.level += 1
await message.channel.send(f"<@{message.author.id}> You leveled up to level {member_data.level}")
else:
pass
save_member_data(message.author.id, member_data)
if '<@705462972415213588>' not in message.content:
pass
else:
print(f'{message.author.display_name} pinged you!\n Content: {message.content}')
else:
pass
await client.process_commands(message)
@client.event
async def on_message(message):
if not message.author.bot:
if any(x in message.content.lower() for x in bad):
await message.delete()
await message.channel.send(f'{message.author.mention} watch your language')
else:
pass
else:
pass
await client.process_commands(message)
### Events end ###
### Commands ###
# @client.command()
# async def disable(ctx):
# def check(msg):
# return msg.author == ctx.message.author and (msg.content)
# msg = await client.wait_for("message", check=check)
# if str(msg.content) == 'testcmd':
# test = not test
# await ctx.send('Command testcmd has been disabled')
# if bool(log) == True:
# print(f'{text} command has been disabled by {ctx.message.author.display_name}')
# else:
# pass
# else:
# await ctx.send('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')
@client.command(aliases=['goldfish'])
async def fstab(ctx):
await ctx.reply('https://cdn.discordapp.com/attachments/878297190576062515/879845618636423259/IMG_20210825_005111.jpg')
@client.command(aliases=['xp', 'level'])
async def rank(ctx, user : discord.User=None):
if user == None:
member_data = load_member_data(ctx.message.author.id)
if member_data.level <= 5:
rank = "New person"
elif member_data.level >= 10 and member_data.level > 5:
rank = "Active"
elif member_data.level >= 20 and member_data.level > 10:
rank = "Active af!!"
if member_data.level == 0:
e = discord.Embed(title=f"{ctx.message.author.display_name}'s xp", description=f"{rank}\nLevel: {member_data.level}\nXp: {member_data.xp}\\25")
elif member_data.level == 1:
e = discord.Embed(title=f"{ctx.message.author.display_name}'s xp", description=f"{rank}\nLevel: {member_data.level}\nXp: {member_data.xp}\\50")
elif member_data.level == 2:
e = discord.Embed(title=f"{ctx.message.author.display_name}'s xp", description=f"{rank}\nLevel: {member_data.level}\nXp: {member_data.xp}\\100")
elif member_data.level == 3:
e = discord.Embed(title=f"{ctx.message.author.display_name}'s xp", description=f"{rank}\nLevel: {member_data.level}\nXp: {member_data.xp}\\500")
elif member_data.level == 4:
e = discord.Embed(title=f"{ctx.message.author.display_name}'s xp", description=f"{rank}\nLevel: {member_data.level}\nXp: {member_data.xp}\\750")
elif member_data.level >= 5:
e = discord.Embed(title=f"{ctx.message.author.display_name}'s xp", description=f"{rank}\nLevel: {member_data.level}\nXp: {member_data.xp}\\1000")
await ctx.send(embed=e)
else:
if member_data.level <= 5:
rank = "New person"
elif member_data.level >= 10 and member_data.level > 5:
rank = "Active"
elif member_data.level >= 20 and member_data.level > 10:
rank = "Active af!!"
member_data = load_member_data(user.id)
if member_data.level == 0:
e = discord.Embed(title=f"{user.display_name}'s xp", description=f"{rank}\nLevel: {member_data.level}\nXp: {member_data.xp}\\25")
elif member_data.level == 1:
e = discord.Embed(title=f"{user.display_name}'s xp", description=f"{rank}\nLevel: {member_data.level}\nXp: {member_data.xp}\\50")
elif member_data.level == 2:
e = discord.Embed(title=f"{user.display_name}'s xp", description=f"{rank}\nLevel: {member_data.level}\nXp: {member_data.xp}\\100")
elif member_data.level == 3:
e = discord.Embed(title=f"{user.display_name}'s xp", description=f"{rank}\nLevel: {member_data.level}\nXp: {member_data.xp}\\500")
elif member_data.level == 4:
e = discord.Embed(title=f"{user.display_name}'s xp", description=f"{rank}\nLevel: {member_data.level}\nXp: {member_data.xp}\\750")
elif member_data.level >= 5:
e = discord.Embed(title=f"{user.display_name}'s xp", description=f"{rank}\nLevel: {member_data.level}\nXp: {member_data.xp}\\1000")
await ctx.send(embed=e)
@client.command()
async def add_xp(ctx, user : discord.User, *, arg1):
if ctx.message.author.id not in ids:
await ctx.reply(f'101% sure that this command doesn\'t exist :eyes:')
else:
if arg1.isdigit:
member_data = load_member_data(user.id)
member_data.xp += int(arg1)
save_member_data(user.id, member_data)
else:
await ctx.reply(f'{arg1} is not a number')
@client.command()
async def edit_snipe(ctx):
try:
em = discord.Embed(description=f'**Message before**: {before}\n**Message after**:{after}')
em.set_footer(text=f'This message was edited by {author}')
await ctx.send(embed = em)
except:
await ctx.reply('No recent edited messages here :eyes:')
@client.command()
@commands.cooldown(1,10, commands.BucketType.user)
async def stroke(ctx, *, text):
if text.isdigit:
if int(text) > 500:
await ctx.send("no strok")
return
else:
pass
strok = ("").join(random.choices(string.ascii_lowercase, k=int(text)))
await ctx.send(strok)
return
elif str(text) == 'random':
rnd = randint(3, 500)
strok = ("").join(random.choices(string.ascii_lowercase, k=int(rnd)))
await ctx.send(strok)
else:
raise BadArgument
@client.command()
async def add_lvl(ctx, user : discord.User, *, arg1):
if ctx.message.author.id not in ids:
await ctx.reply(f'101% sure that this command doesn\'t exist :eyes:')
else:
if arg1.isdigit:
member_data = load_member_data(user.id)
member_data.level += int(arg1)
save_member_data(user.id, member_data)
else:
await ctx.reply(f'{arg1} is not a number')
@client.command()
async def invite(ctx):
await ctx.reply("https://discord.com/api/oauth2/authorize?client_id=859869941535997972&permissions=8&scope=bot")
#await ctx.reply("https://discord.com/api/oauth2/authorize?client_id=881092078132670484&permissions=0&scope=bot")
@client.command()
async def say(ctx, *, text):
await ctx.message.delete()
await ctx.send(f'{text}')
@client.command()
async def uptime(ctx):
uptime = str(datetime.timedelta(seconds=int(round(time.time()-startTime))))
await ctx.send(uptime)
@client.command()
async def snipe(ctx):
channel = ctx.channel
try:
em = discord.Embed(name = f"Last deleted message in #{channel.name}", description = snipe_message_content[channel.id])
em.set_footer(text = f"This message was sent by {snipe_message_author[channel.id]}")
await ctx.send(embed = em)
except:
await ctx.send(f"There are no recently deleted messages in #{channel.name}")
@client.command()
async def whoAmI(ctx):
await ctx.send(f"I am: {client.user.name}\nMy id is: {client.user.id}\nMy developer is: {owner}\nMy ping is {client.latency}ms\nYour name is: {'saneite#5077 (not my dev)' if ctx.message.author.id == 795986008680300565 else ctx.message.author}\nYour id is: {ctx.message.author.id}")
@client.command()
async def ping(ctx):
now = datetime.datetime.now()
current_time = now.strftime("%H:%M:%S")
await ctx.send(f'Pong! My ping is {round(client.latency * 1000)}ms')
if bool(log) == True:
# with open('F:\\bot\\logs\\log.txt', 'a') as f:
# f.write(f'[{current_time}]Bot ping is {round(client.latency * 1000)}ms\n')
# f.close()
pass
else:
return
@client.command()
async def help(ctx):
helpEmbed = discord.Embed(title='**COMMAND LIST**', description='Economy\nBeg, bal, hunt, daily, weekly, monthly, postmeme\n\nModeration\nban, kick, nuke\n\nMisc\n8ball, meme, softwaregore')
await ctx.send(embed = helpEmbed)
@client.command(aliases=['8ball'])
async def _8ball(ctx, *, question):
responses = [
"no?????.",
"when you grow a braincell, yes",
"you stupid, of course not",
"lol no",
"As I see it, yes.",
"Most likely.",
"Yes.",
"try again",
"ask again later.",
"Better not tell you now.",
"Cannot predict now.",
"Concentrate and ask again.",
"Don't count on it.",
"My reply is no.",
"My sources say no.",
"Outlook not so good."
]
ballEmbed= discord.Embed(title=f'{question}', description=f'{random.choice(responses)}')
await ctx.send(embed=ballEmbed)
@client.command()
@commands.has_permissions(manage_channels=True)
async def nuke(ctx, channel: discord.TextChannel = None):
if channel == None:
await ctx.send("You did not mention a channel!")
return
nuke_channel = discord.utils.get(ctx.guild.channels, name=channel.name)
if nuke_channel is not None:
now = datetime.datetime.now()
current_time = now.strftime("%H:%M:%S")
new_channel = await nuke_channel.clone(reason="Has been Nuked!")
await nuke_channel.delete()
await new_channel.send("This channel has been nuked!")
await ctx.send("Nuked the Channel sucessfully!")
if bool(log) == True:
# with open('F:\\bot\\logs\\log.txt', 'a') as f:
# f.write(f'[{current_time}]{ctx.message.author.display_name}nuked{nuke_channel}\n')
# f.close()
print(f'[{current_time}]{ctx.message.author.display_name} nuked {nuke_channel}')
else:
pass
else:
await ctx.send(f"No channel named {channel.name} was found!")
@client.command()
async def invites(ctx, *, user : discord.User=None):
totalInvites = 0
if user == None:
for i in await ctx.guild.invites():
if i.inviter == ctx.author:
totalInvites += i.uses
e = discord.Embed(title=f'{ctx.message.author.display_name}\'s total invites', description=f"{totalInvites} invite{'' if totalInvites == 1 else 's'}")
await ctx.reply(embed=e)
elif user.bot:
await ctx.reply('This is a bot not a user')
return
else:
for i in await ctx.guild.invites():
if i.inviter == user:
totalInvites += i.uses
e = discord.Embed(title=f'{user.display_name}\'s total invites', description=f"{totalInvites} invite{'' if totalInvites == 1 else 's'}")
await ctx.reply(embed=e)
@client.command()
async def meme(ctx):
memes_submissions = reddit.subreddit('memes').hot()
post_to_pick = random.randint(1, 100)
for i in range(0, post_to_pick):
submission = next(x for x in memes_submissions if not x.stickied)
embed = discord.Embed(title = submission.title)
embed.set_image(url=submission.url)
await ctx.send(embed = embed)
@client.command()
async def ihadastroke(ctx):
memes_submissions = reddit.subreddit('ihadastroke').hot()
post_to_pick = random.randint(1, 100)
for i in range(0, post_to_pick):
submission = next(x for x in memes_submissions if not x.stickied)
embed = discord.Embed(title = submission.title)
embed.set_image(url=submission.url)
await ctx.send(embed = embed)
@client.command()
async def shutdown(ctx):
if ctx.message.author.id in ids:
def check(msg):
return msg.author == ctx.message.author and msg.channel == ctx.message.channel and (msg.content)
await ctx.send('You sure?')
msg = await client.wait_for("message", check=check)
if msg.content == 'y' or msg.content == 'yes':
await ctx.send('Shutting down the bot...')
time.sleep(0.5)
raise SystemExit('Bot shutdown')
elif msg.content == 'n' or msg.content == 'no':
await ctx.send('ok')
else:
await ctx.send(f'What is {msg.content}? You are supposed to reply with yes or no')
else:
await ctx.send(f'101% that this command doesn\'t exist :eyes:')
@client.command(aliases=['hl'])
@commands.cooldown(1, 40, commands.BucketType.user)
async def highlow(ctx):
now = datetime.datetime.now()
current_time = now.strftime("%H:%M:%S")
numb = randint(1, 100)
numb2 = randint(1, 100)
id = ctx.message.author.id
coins = randint(300, 1000)
member_data = load_member_data(id)
def check(msg):
return msg.author == ctx.message.author and msg.channel == ctx.message.channel and (msg.content)
await ctx.send(f'Your number is {numb} choose if the other is lower, higher or jackpot')
msg = await client.wait_for("message", check=check)
if msg.content == 'low':
if numb > numb2:
await ctx.send(f'Congrats, your number was {numb2} and you earned {coins} coins')
member_data.wallet += coins
save_member_data(id, member_data)
if bool(log) == True:
# with open('F:\\bot\\logs\\log.txt', 'a') as f:
# f.write(f'[{current_time}]{ctx.message.author.display_name} earned {coins} coins\n')
# f.close()
print(f'[{current_time}]{ctx.message.author.display_name} earned {coins} coins')
else:
pass
elif numb < numb2:
await ctx.send(f'Incorrect the number was {numb2}')
elif numb == numb2:
await ctx.send(f'You stupid you could won 1 mil coins if you choose jackpot')
if msg.content == 'jackpot':
if numb == numb2:
coins2 = randint(1000000, 5000000)
await ctx.send(f'Congrats, your number was {numb2} and you earned {coins2} coins gg!')
member_data = load_member_data(id)
member_data.wallet += coins2
save_member_data(id, member_data)
if bool(log) == True:
# with open('F:\\bot\\logs\\log.txt', 'a') as f:
# f.write(f'[{current_time}]{ctx.message.author.display_name} earned {coins2} coins\n')
# f.close()
print(f'[{current_time}]{ctx.message.author.display_name} earned {coins2} coins')
else:
pass
else:
await ctx.send(f'Incorrect the number was {numb2}')
if msg.content == 'high':
if numb < numb2:
await ctx.send(f'Congrats, your number was {numb2} and you earned {coins} coins')
member_data = load_member_data(id)
member_data.wallet += coins
save_member_data(id, member_data)
if bool(log) == True:
# with open('F:\\bot\\logs\\log.txt', 'a') as f:
# f.write(f'[{current_time}]{ctx.message.author.display_name} earned {coins} coins\n')
# f.close()
print(f'[{current_time}]{ctx.message.author.display_name} earned {coins} coins')
else:
pass
else:
await ctx.send(f'Incorrect your number was {numb2}')
else:
await ctx.send(f'{msg.content} is not an option')
@client.command()
async def kill(ctx, user : discord.User):
if user == None:
await ctx.send('Please tag someone to kill')
elif user.id == ctx.message.author.id:
await ctx.send('Ok you are dead, please tag someone else to kill')
else:
responses2 = [
f"<@{user.id}> died from a dang baguette",
f"<@{ctx.message.author.id}> strikes <@{user.id}> with the killing curse... *Avada Kedavra!*",
f"<@{user.id}> dies from dabbing too hard",
f"<@{user.id}> ripped their own heart out to show their love for <@{ctx.message.author.id}>"
]
await ctx.send(f'{random.choice(responses2)}')
@client.command()
@commands.has_permissions(kick_members=True)
async def kick(ctx, *, member : discord.Member):
now = datetime.datetime.now()
current_time = now.strftime("%H:%M:%S")
if member == ctx.message.author:
raise BadArgument
else:
await member.kick()
await ctx.send(f'{member} has been kicked from the server')
if bool(log) == True:
# with open('F:\\bot\\logs\\log.txt', 'a') as f:
# f.write(f'[{current_time}]{ctx.message.author.display_name} kicked {member} from {ctx.message.guild.name}')
# f.close()
print(f'[{current_time}]{ctx.message.author.display_name} kicked {member.display_name} from {ctx.message.guild.name}')
else:
pass
@client.command()
@commands.has_permissions(ban_members=True)
async def ban(ctx, *, member=discord.Member):
now = datetime.datetime.now()
current_time = now.strftime("%H:%M:%S")
if member == ctx.message.author:
raise BadArgument
else:
await member.ban()
await ctx.send(f'{member} has been banned from the server')
if bool(log) == True:
print(f'[{current_time}]{ctx.message.author.display_name} banned {member.display_name} from {ctx.message.guild.name}')
else:
pass
@client.command()
async def slap(ctx, user : discord.User):
responses3 = [
"https://cdn.weeb.sh/images/Hkw1VkYP-.gif",
"https://cdn.weeb.sh/images/SJlkNkFwb.gif",
"https://cdn.weeb.sh/images/rJ4141YDZ.gif",
"https://cdn.weeb.sh/images/HJKiX1tPW.gif"
]
e = discord.Embed(title=f'{ctx.message.author} slaps {user}')
e.set_image(url=f'{random.choice(responses3)}')
await ctx.send(embed = e)
@client.command(aliases=['sg'])
async def softwaregore(ctx):
sg_submissions = reddit.subreddit('softwaregore').hot()
post_to_pick = random.randint(1, 100)
for i in range(0, post_to_pick):
submission = next(x for x in sg_submissions if not x.stickied)
embed = discord.Embed(title = submission.title)
embed.set_image(url=submission.url)
await ctx.send(embed = embed)
@client.command(aliases=['sus'])
async def isSus(ctx, *, user : discord.User):
susvar = [
True,
False
]
sus = random.choice(susvar)
if bool(sus) == True:
await ctx.send(f'{user.mention} is very sus')
elif bool(sus) == False:
await ctx.send(f'{user.mention} isn\'t sus')
else:
await ctx.reply('undefined')
@client.command(aliases=['pm'])
@commands.cooldown(1, 40, commands.BucketType.user)
async def postmeme(ctx):
if bool(currency) == False:
await ctx.send('Currency is disabled')
return
else:
pass
member_data = load_member_data(ctx.message.author.id)
if int(member_data.wallet) >= value:
await ctx.reply(f'You have reached max value for your wallet ({value})')
return
else:
pass
now = datetime.datetime.now()
current_time = now.strftime("%H:%M:%S")
await ctx.send(f'{ctx.message.author.mention} What type of meme you want to post?\n`f` Fresh meme\n`d` Dank meme\n`c` Copypasta\n*more comming soon*')
def check(msg):
return msg.author == ctx.message.author and msg.channel == ctx.message.channel and (msg.content) in ['f', 'd', 'c']
msg = await client.wait_for("message", check=check)
x = randint(0, 200)
if x == 0:
await ctx.send(f'{ctx.message.author.mention} You earned 0 coins xD')
else:
await ctx.send(f'You earned {x} coins')
member_data.wallet += x
save_member_data(id, member_data)
if bool(log) == True:
print(f'[{current_time}]{colors.cyan}{ctx.message.author.display_name}{colors.end} has earned {colors.green}{x}{colors.end} coins')
else:
pass
@client.command()
async def null(ctx):
await ctx.reply('You got **null** coins dood.')
@client.command(aliases=['gift'])
async def give(ctx, user : discord.User, *, arg1):
if user.id == ctx.message.author.id:
await ctx.reply('You can\'t give coins to yourself')
return
else:
if arg1.isdigit:
member_data = load_member_data(ctx.message.author.id)
if member_data.wallet < int(arg1):
await ctx.reply('You don\'t have that many coins in your wallet')
return
elif int(arg1) < 0:
await ctx.reply('Don\'t try to break me **dood**')
elif int(arg1) == 0:
await ctx.reply('You can\'t gift 0 coins')
else:
member_data.wallet -= int(arg1)
save_member_data(ctx.message.author.id, member_data)
user_data = load_member_data(user.id)
user_data.wallet += int(arg1)
save_member_data(user.id, user_data)
await ctx.reply(f'You gave {arg1} coins to {user.display_name}')
else:
await ctx.reply(f'{arg1} is not a digit **dood**')
@client.command()
async def add(ctx, user : discord.User, *, arg1=None):
if ctx.message.author.id not in ids:
await ctx.reply(f'101% sure that this command doesn\'t exist :eyes:')
return
else:
now = datetime.datetime.now()
current_time = now.strftime("%H:%M:%S")
if arg1.startswith('0x') or arg1.startswith('-0x'):
try:
hexv = int(f'{arg1}', 16)
member_data = load_member_data(user.id)
member_data.wallet += int(hexv)
save_member_data(user.id, member_data)
await ctx.send(f'Added {hexv} coins to {user.display_name}\'s account')
print(f'[{current_time}]{colors.cyan}{ctx.message.author.display_name}{colors.end} added {colors.green}{hexv}{colors.end} coins to {colors.cyan}{user.display_name}\'s{colors.end} account')
except ValueError:
await ctx.send(f'Invalid hex value')
elif arg1.startswith('0b') or arg1.startswith('-0b'):
try:
binv = int(f'{arg1}', 2)
member_data = load_member_data(user.id)
member_data.wallet += int(binv)
save_member_data(user.id, member_data)
await ctx.send(f'Added {binv} coins to {user.display_name}\'s account')
print(f'[{current_time}]{colors.cyan}{ctx.message.author.display_name}{colors.end} added {colors.green}{binv}{colors.end} coins to {colors.cyan}{user.display_name}\'s{colors.end} account')
except ValueError:
await ctx.send('Invalid binary value')
elif arg1.isdigit:
member_data = load_member_data(user.id)
member_data.wallet += int(arg1)
save_member_data(user.id, member_data)
await ctx.send(f'Added {arg1} coins to {user.display_name}\'s account')
if bool(log) == True:
print(f"[{current_time}]{colors.cyan}{ctx.message.author.display_name}{colors.end} added {colors.green}{arg1}{colors.end} coins to {colors.cyan}{user.display_name}{colors.end}\'s account")
else:
pass
elif arg1 == None:
await ctx.reply('Usage: `;add <user> binary\\hex\\decimal`')
return
else:
await ctx.send('Invalid value.')
@client.command()
@commands.cooldown(1, 1800, commands.BucketType.user)
async def work(ctx):
if bool(currency) == False:
await message.channel.send('Currency is disabled')
return
else:
pass
now = datetime.datetime.now()
current_time = now.strftime("%H:%M:%S")
member_data = load_member_data(ctx.message.author.id)
coins = randint(1000, 25000)
member_data.wallet += coins
await ctx.send(f"You earned {coins} coins.")
save_member_data(ctx.message.author.id, member_data)
if bool(log) == True:
print(f'[{current_time}]{colors.cyan}{ctx.message.author.display_name}{colors.end} earned {colors.green}{coins}{colors.end} coins')
else:
pass
@client.command()
@commands.cooldown(1, 30, commands.BucketType.user)
async def beg(ctx):
if bool(currency) == False:
await ctx.send('Currency is disabled')
return
else:
pass
now = datetime.datetime.now()
current_time = now.strftime("%H:%M:%S")
member_data = load_member_data(ctx.message.author.id)
coins = randint(1, 500)
if int(member_data.wallet) >= value:
await ctx.reply(f'You reached max wallet value. ({value})')
return
else:
member_data.wallet += coins
await ctx.send(f'You earned {coins} coins.')
save_member_data(ctx.message.author.id, member_data)
if bool(log) == True:
print(f'[{current_time}]{colors.cyan}{ctx.message.author.display_name}{colors.end} earned {colors.green}{coins}{colors.end} coins')
else:
pass
@client.command()
@commands.cooldown(1, 86400, commands.BucketType.user)
async def daily(ctx):
if bool(currency) == False:
await ctx.reply('Currency is disabled')
return
else:
pass
now = datetime.datetime.now()
current_time = now.strftime("%H:%M:%S")
member_data = load_member_data(message.author.id)
member_data.wallet += 10000
await ctx.send('You claimed 10,000 coins')
save_member_data(message.author.id, member_data)
if bool(log) == True:
print(f'[{current_time}]{ctx.message.author.display_name} claimed 10k coins from daily command')
else:
pass
@client.command()
async def fish(message):
if bool(currency) == False:
await message.channel.send('Currency is disabled')
return
else:
pass
items = [
"nothing",
"fish",
"rare fish"
]
item = random.choice(items)
if item == 'nothing':
await message.channel.send('You got nothing XD')
elif item == 'fish':
await message.channel.send(f'You caught a fish and sold it for 100 coins')
member_data = load_member_data(message.author.id)
member_data.wallet += 100
save_member_data(message.author.id, member_data)
elif item == 'rare fish':
member_data = load_member_data(message.author.id)
await message.channel.send(f'You caught a rare fish and sold it for 300 coins')
member_data.wallet += 300
save_member_data(message.author.id, member_data)
@client.command(aliases=['dep'])
async def deposit(ctx, *, arg1):
if bool(currency) == False:
await ctx.send('Currency is disabled')
return
else:
member_data = load_member_data(ctx.message.author.id)
if arg1 == 'all' or arg1 == 'max':
if member_data.wallet == 0:
await ctx.send('You don\'t have any coins in your wallet')
return
else:
if member_data.wallet == 1:
await ctx.reply(f'You deposited {member_data.wallet} coin')
else:
await ctx.reply(f'You deposited {member_data.wallet} coins')
member_data.bank += int(member_data.wallet)
member_data.wallet -= int(member_data.wallet)
save_member_data(ctx.message.author.id, member_data)
return
elif arg1.isdigit:
if int(arg1) > member_data.wallet:
await ctx.reply('You don\'t have that many coins in your wallet')
return
elif int(arg1) < 0: