-
Notifications
You must be signed in to change notification settings - Fork 0
/
barney.py
3632 lines (3134 loc) · 160 KB
/
barney.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
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# MODULE IMPORTS
# pip required for: discord.py[voice], asyncio, logging, requests, pytesseract, pillow, schoolopy, pyyaml
# other programs required: ffmpeg, tesseract-ocr, a valid libopus-x64.dll file (obtained from the discord.py python directory) for voice recognition
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
import time
current_time = time.time()
from typing import Any, Dict, List, Tuple
import asyncio
import sys
import copy
import datetime
import io
import json
import logging
import math
import os
import random
import re as regex
import threading
from pprint import pprint
import discord
import pytesseract
import requests
import schoolopy
import yaml
from discord import FFmpegPCMAudio
from discord.ext import commands
from PIL import Image
from sympy import *
import unicodedata
import emoji
import confusables
from pyzbar import pyzbar
import numpy as np
import secrets
import qrcode
import fbchat
import subprocess
from multiprocessing import Process
import audioop
import rsa
import base64
from enum import Enum
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# DISCORD.LOG LOGGER
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
logger = logging.getLogger('discord')
logger.setLevel(logging.DEBUG)
handler = logging.FileHandler(filename='discord.log', encoding='utf-8', mode='w')
handler.setFormatter(logging.Formatter('%(asctime)s:%(levelname)s:%(name)s: %(message)s'))
logger.addHandler(handler)
emoji_regex = emoji.get_emoji_regexp()
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# GLOBAL VARIABLE DECLARATION
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
token = 'not that easy'
GUILD = '210716706501296128'
schmalex = True
bazinga = False
mafia_game_started = False
user_voice_cooldown = {}
user_cooldown_time_remaining = {}
voice_cooldown = False
message_received = False
connected = True
steve_stream = False
previous_5_messages = []
receive_connections = 0
receive_users = []
listeners_active = {}
league_players = []
league_detection = False
token_js_dict = {
1: ['good luck', 'baby_bop-listener.js', 'baby bop'],
2: ['finding more', 'b_j-listener.js', 'b.j.'],
3: ['tokens i left in places', 'riff-listener.js', 'riff']
}
whos_listening_to_who = {}
swear_pattern = regex.compile('(fuck)|(shit)') # there was more...
kpop_pattern = regex.compile(r"((k[^ ]*[pP][o0O][pP])|(k p o p)|(korean pop)|(pop(.*) korea)|(01101011 01110000 01101111 01110000)|" # BIG MATCHES
r"(([𐤀κk🇰ᵏ⛕片k𝕜k长k͓̽ꈵҜkқᏦk𝕂𝓀K<]+)|(ᖽᐸ)|(\|⊰)|(l𡿨)|(\|<)|(\|-<)|(/<)|(\:regional_indicator_k\:)|(\)<))" # K MATCHES
r"[.,/'\"%^&*?!@’#$()-_+=~`|<> ]*" # SEPARATORS
r"(([مƤ尸ρ𐡑卩𝕡pᖘᚦρ९ⓟקp͓̽𝓅Ƥᕵየ𐡒ƤƿᕿꉣᎮ𝓟pþمр𝔭🇵РP]+)|(\|>)|(\|ˀ)|(/>)|(,o)|(\|?)|(\:parking\:)|(\:regional_indicator_p\:))" # P MATCHES 1
r"[.,/'\"%^&’*?!@#$()-_+=~`|<> ]*" # SEPARATORS
r"(([םo𓆠Q𓍶@口🇴़𓃿鬱õºο𓇳𓄣.๏૦𓂒𓂸๐𝓸°ᵒ𓃯𐡈ꁏoᎧσ〇Ⓞᓎ回𑀩𝕠θㆁôōㄖøo͓̽оðО٥סּᓍ0O]+)|c *ɔ|(< *>)|(\{ *\})|(\[o\])|(\( *\))|(\:regional_indicator_o\:))" # O MATCHES
r"[.,/'\"%^&*?!@#’$()-_+=~`|<> ]*" # SEPARATORS
r"(([مƤ尸ρ𐡑卩𝕡pᖘᚦ९ρקp͓̽ⓟ𝓅Ƥᕵየ𐡒Ƥƿᕿ𝓟ꉣpᎮþمр𝔭🇵РP]+)|(\|>)|(\|ˀ)|(/>)|(,o)|(\|?)|(\:parking\:)|(\:regional_indicator_p\:)))") # P MATCHES 2
user_dict = {
188800837328306176: 'user1',
183880560454664192: 'user2',
192957897192374272: 'user3',
226567954551144449: 'user4',
183880246917988353: 'user5',
203672102509740042: 'user6',
249029217524645889: 'user7',
240380481563131905: 'user8',
330535151790718976: 'user9',
236694472883175426: 'user10',
203491015808516096: 'user11',
373033173715517440: 'user12',
185165742495367168: 'user13',
194323407431532544: 'user14',
188483813159075840: 'user15',
195841061531287552: 'user16',
197264395196170240: 'user17',
189339029265842176: 'user18',
470086166503489536: 'user19',
218977515404787712: 'user20',
186276713364324353: 'user21',
185285433012387840: 'user22',
211810742003957761: 'user23',
236682223128936448: 'user24',
402764753195368448: 'user25',
264676005933744128: 'user26',
273347745488699392: 'user27',
236002193189240833: 'user28',
732621248395346020: 'user29',
576284647181254656: 'user30'
}
meme_dict = {
'mark': 'https://preview.redd.it/vjm9wz9jymb31.png?width=640&auto=webp&s=47c7c5875da11f07e5fdd9ab61ce3d02a9193105',
'chicken': 'https://video-syd2-1.xx.fbcdn.net/v/t42.3356-2/95183862_3801944146544171_5579162729793050027_n.mp4/video-1588594638.mp4?_nc_cat=100&_nc_sid=060d78&_nc_ohc=zCVoFSr3AGcAX8On2mQ&vabr=443343&_nc_ht=video-syd2-1.xx&oh=7511cba117866d145742e8944d75bb17&oe=5EB149A2&dl=1',
'obama': 'https://preview.redd.it/j7z0dk5yqdf31.jpg?width=773&auto=webp&s=864891cd7f95ab225e9d62a912bfc27011ddee36',
'cat': 'https://preview.redd.it/wrhyk1qe6cm31.jpg?width=500&auto=webp&s=095186a45c539b077092b5672dc63d2f1d9e7bd9',
'dog': 'https://preview.redd.it/6w2gkixd2bb31.jpg?width=786&auto=webp&s=ec83fcb1ce8d4663f191a2475c04c8ff1de2741e',
'meme': 'https://preview.redd.it/c4km9r4ditd31.jpg?width=193&auto=webp&s=979a568ab6a0b5a227099c1caf6c4ffd81979ed0',
}
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# UNICODE DICTIONARY CREATER
# Creates a mapping of all unicode characters with their descriptors, used for kpop
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
unicode_dict = {}
for i in range(sys.maxunicode):
c = chr(i)
try:
x = unicodedata.name(c)
unicode_dict[c] = x
except:
pass
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# CONFUSABLE LIST CREATOR
# Creates a list of confusable characters for 'k' 'o' and 'p'
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
k_regex_str = confusables.confusable_regex('k')
k_regex = regex.compile(k_regex_str)
p_regex_str = confusables.confusable_regex('p')
p_regex = regex.compile(p_regex_str)
o_regex_str = confusables.confusable_regex('o')
o_regex = regex.compile(o_regex_str)
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# FACEBOOK LOGIN
# Logs in to facebook so that Barney can message the chat about steve stream
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# if __name__ == "__main__":
# fb_client = fbchat.Client("[email protected]", "112233Qwer")
# if not fb_client.isLoggedIn():
# fb_client.login()
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# DISCORD CLIENT SETTER
# Techincally a lot of this code, especially the @client.event stuff should be wrapped inside a class, but eh
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
intents = discord.Intents.all()
client = discord.Client(intents=intents)
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# PERIOD ANNOUNCER
# Used on weekdays to announce period times
# At recess, lunch, and after school, all users in voice channels are moved to the "Green Zone" channel
# At 3:20, all users in voice channels are moved to their corresponding transport
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
async def period_announcer(self):
global connected
await self.wait_until_ready()
guild = discord.utils.get(self.guilds, id=210716706501296128)
channel = discord.utils.get(guild.text_channels, id=704836355070361780)
mention = "@everyone"
green_zone_channel = discord.utils.get(guild.voice_channels, id=469410821294784512)
bus_channel = discord.utils.get(guild.voice_channels, name="BUS")
t4_channel = discord.utils.get(guild.voice_channels, id=691863175288586261)
t1_channel = discord.utils.get(guild.voice_channels, id=691863169991311431)
walk_channel = discord.utils.get(guild.voice_channels, name="WALK")
boat_channel = discord.utils.get(guild.voice_channels, name="BOAT")
print(f'{guild.name}, {channel.name} ')
while connected:
if datetime.datetime.today().weekday() == 5 or datetime.datetime.today().weekday() == 6:
await asyncio.sleep(28800)
continue
else:
if datetime.datetime.now().hour == 8 and datetime.datetime.now().minute == 25 and datetime.datetime.now().second <= 2:
await channel.send(f"It's 8:25 {mention}. 5 minutes until school starts! Woohoo!")
await asyncio.sleep(60)
continue
elif datetime.datetime.now().hour == 8 and datetime.datetime.now().minute == 30 and datetime.datetime.now().second <= 2:
await channel.send(f"It's 8:30 {mention}. Time for morning tutorial! Yay!")
await asyncio.sleep(60)
continue
elif datetime.datetime.now().hour == 8 and datetime.datetime.now().minute == 40 and datetime.datetime.now().second <= 2:
await channel.send("It's 8:40. Period 1 has started!")
await asyncio.sleep(60)
continue
elif datetime.datetime.now().hour == 9 and datetime.datetime.now().minute == 20 and datetime.datetime.now().second <= 2:
await channel.send("It's 9:20. You have 5 minutes to get to Period 2!")
await asyncio.sleep(60)
continue
elif datetime.datetime.now().hour == 9 and datetime.datetime.now().minute == 25 and datetime.datetime.now().second <= 2:
await channel.send("It's 9:25. Period 2 has started!")
await asyncio.sleep(60)
continue
elif datetime.datetime.now().hour == 10 and datetime.datetime.now().minute == 5 and datetime.datetime.now().second <= 2:
await channel.send("It's 10:05. You have 5 minutes to get to Period 3!")
await asyncio.sleep(60)
continue
elif datetime.datetime.now().hour == 10 and datetime.datetime.now().minute == 10 and datetime.datetime.now().second <= 2:
await channel.send("It's 10:10. Period 3 has started!")
await asyncio.sleep(60)
continue
elif datetime.datetime.now().hour == 10 and datetime.datetime.now().minute == 50 and datetime.datetime.now().second <= 2:
await channel.send("It's 10:50, recess boys.")
for voice_channel in guild.voice_channels:
if voice_channel.id == 469410821294784512:
continue
for user in voice_channel.members:
await user.move_to(green_zone_channel)
await asyncio.sleep(60)
continue
elif datetime.datetime.now().hour == 11 and datetime.datetime.now().minute == 7 and datetime.datetime.now().second <= 2:
await channel.send("It's 11:07. You have 3 minutes to get to Period 4!")
await asyncio.sleep(60)
continue
elif datetime.datetime.now().hour == 11 and datetime.datetime.now().minute == 10 and datetime.datetime.now().second <= 2:
await channel.send("It's 11:10. Period 4 has started!")
await asyncio.sleep(60)
continue
elif datetime.datetime.now().hour == 11 and datetime.datetime.now().minute == 50 and datetime.datetime.now().second <= 2:
await channel.send("It's 11:50. You have 5 minutes to get to Period 5!")
await asyncio.sleep(60)
continue
elif datetime.datetime.now().hour == 11 and datetime.datetime.now().minute == 55 and datetime.datetime.now().second <= 2:
await channel.send("It's 11:55. Period 5 has started!")
await asyncio.sleep(60)
continue
elif datetime.datetime.now().hour == 12 and datetime.datetime.now().minute == 35 and datetime.datetime.now().second <= 2:
await channel.send("It's 12:35, lunch time boys.")
for voice_channel in guild.voice_channels:
if voice_channel.id == 469410821294784512:
continue
for user in voice_channel.members:
try:
await user.move_to(green_zone_channel)
except:
continue
await asyncio.sleep(60)
continue
elif datetime.datetime.now().hour == 13 and datetime.datetime.now().minute == 32 and datetime.datetime.now().second <= 2:
await channel.send("It's 13:32. You have 3 minutes to get to Period 6!")
await asyncio.sleep(60)
continue
elif datetime.datetime.now().hour == 13 and datetime.datetime.now().minute == 35 and datetime.datetime.now().second <= 2:
await channel.send("It's 13:35. Period 6 has started!")
await asyncio.sleep(60)
continue
elif datetime.datetime.now().hour == 14 and datetime.datetime.now().minute == 15 and datetime.datetime.now().second <= 2:
await channel.send("It's 14:15. You have 5 minutes to get to Period 7!")
await asyncio.sleep(60)
continue
elif datetime.datetime.now().hour == 14 and datetime.datetime.now().minute == 20 and datetime.datetime.now().second <= 2:
await channel.send("It's 14:20. Period 7 has started!")
await asyncio.sleep(60)
continue
elif datetime.datetime.now().hour == 15 and datetime.datetime.now().minute == 0 and datetime.datetime.now().second <= 2:
await channel.send(f"It's 15:00 {mention}. School's over!")
for voice_channel in guild.voice_channels:
if voice_channel.id == 469410821294784512:
continue
for user in voice_channel.members:
try:
await user.move_to(green_zone_channel)
except:
continue
await asyncio.sleep(60)
continue
elif datetime.datetime.now().hour == 15 and datetime.datetime.now().minute == 20 and datetime.datetime.now().second <= 2:
await channel.send("It's 3:20. Home time!")
for voice_channel in guild.voice_channels:
for user in voice_channel.members:
try:
if (user.id == 197264395196170240 or user.id == 236682223128936448 or user.id == 192957897192374272 or user.id == 240380481563131905) and (voice_channel.id != bus_channel.id): #rohan james drain jack
await user.move_to(bus_channel)
if (user.id == 203672102509740042 or user.id == 183880246917988353) and (voice_channel.id != t4_channel.id): #me steven
await user.move_to(t4_channel)
if (user.id == 185165742495367168 or user.id == 470086166503489536 or user.id == 183880560454664192 or user.id == 402764753195368448 or user.id == 188800837328306176 or user.id == 226567954551144449 or user.id == 249029217524645889 or user.id == 185285433012387840) and (voice_channel.id != t1_channel.id): #tom calvin grant schmalex maxd josh bryson ryan
await user.move_to(t1_channel)
if (user.id == 195841061531287552) and (voice_channel.id != walk_channel.id): #ciaran
await user.move_to(walk_channel)
if (user.id == 188483813159075840) and (voice_channel.id != boat_channel.id): #jerry
await user.move_to(boat_channel)
except:
continue
await asyncio.sleep(60)
continue
else:
await asyncio.sleep(2)
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# .TXT FILE POPULATOR
# Used to save to any file a json-loadable dictionary of all users of grant's guild, with user IDs as keys, the int 0 as value.
# Checks to see if existing entries for each user exists, otherwise creates a new one
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def txt_populator(txt_file, client, GUILD, roles=False):
inFile = open(f'txt_files/{txt_file}')
member_list_str = inFile.read()
inFile.close()
try:
member_list_dict = json.loads(member_list_str)
except:
member_list_dict = {}
for guild in client.guilds:
if str(guild.id) == GUILD:
break
for member in guild.members:
current_member = member_list_dict.get(str(member.id), False)
if current_member:
continue
else:
if not roles:
member_list_dict[str(member.id)] = 0
else:
role_list = member.roles
role_list_ids = []
for role in role_list:
if role in guild.roles:
role_list_ids.append(str(role.id))
role_list_str = ','.join(role_list_ids)
member_list_dict[str(member.id)] = role_list_str
outFile = open(f'txt_files/{txt_file}', 'w')
member_list_str = json.dumps(member_list_dict, indent=4)
outFile.write(member_list_str)
outFile.close()
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# THE GLORIOUS KPOP KICKER
# Used to kick any user that has triggered the global kpop_pattern regex
# The user to kick, as well as the channel to invite them back to if they apologise, are required.
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
async def kpop_kicker(channel, target_user):
try:
await target_user.create_dm()
await target_user.dm_channel.send(f'kpop is dumb {target_user.name} don\'t mention it again >:(\nI\'ll send you back an invite if you apologise. I don\'t have all day though, so hurry it up.')
await channel.guild.kick(target_user)
def check(m):
return ('sorry' in m.content.lower() or 'apologies' in m.content.lower() or 'soz' in m.content.lower()) and m.channel == target_user.dm_channel and m.author == target_user
try:
msg = await client.wait_for('message', timeout=20.0, check=check)
except:
await target_user.dm_channel.send('ok fine buddy ugh ask andrei for an invite fuckin smh')
else:
await target_user.dm_channel.send('ok cool, i\'ll let you back in, but don\'t do it again buddy.')
channel_invite = await channel.create_invite(max_age = 0, max_uses = 1, unique = True, reason='apologised like a big boy')
await target_user.dm_channel.send(channel_invite.url)
except Exception as e:
print(e)
print(f"User {target_user.name} is not part of Barney's Fun House, must manually receive invite.")
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# LEAGUE OF LEGENDS KICKER
# Used to kick any user that has triggered the global kpop_pattern regex
# The user to kick, as well as the channel to invite them back to if they apologise, are required.
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
async def league_kicker(channel, target_user):
# try:
await target_user.create_dm()
await target_user.dm_channel.send(f'too much league of legends {target_user.name} \ni\'ll send you back an invite if you apologise. i don\'t have all day though, so hurry it up.')
await channel.guild.kick(target_user)
def check(m):
return ('sorry' in m.content.lower() or 'apologies' in m.content.lower() or 'soz' in m.content.lower()) and m.channel == target_user.dm_channel and m.author == target_user
try:
msg = await client.wait_for('message', timeout=20.0, check=check)
except:
await target_user.dm_channel.send('ok fine buddy ask someone else for an invite smh')
else:
await target_user.dm_channel.send('ok cool, i\'ll let you back in, but don\'t do it again buddy.')
channel_invite = await channel.create_invite(max_age = 0, max_uses = 1, unique = True, reason='apologised like a big boy')
await target_user.dm_channel.send(channel_invite.url)
# except Exception as e:
# print(e)
# print(f"User {target_user.name} is not part of Barney's Fun House, must manually receive invite.")
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# BACKUP KPOP CHECK
# Code that runs in case the main kpop regex fails to find a match
# Deeper search involving unicode data/category lookups
# Also uses the confusables module to access unicode's 'confusables.txt'
# Any amount of characters after the first k, and then one character
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
async def backup_kpop_check_phrase_checker(new_index, phrase_list, guild):
global unicode_dict
global k_regex, o_regex, p_regex
k, p1, o, p2 = False, False, False, False
# if guild:
# if guild.id != 210716706501296128:
# print(phrase_list)
index, k_num, p1_num, o_num, p2_num = 0, 0, 0, 0, 0
# print(f'new phrase list: {phrase_list}')
for char in phrase_list:
# if guild:
# if guild.id != 210716706501296128:
# print('\n')
# print(f'k = {k}, p1 = {p1}, o = {o}, p2 = {p2}')
try:
uni_desc = unicode_dict[char]
# if guild:
# if guild.id != 210716706501296128:
# print(char)
# print(' P ' in uni_desc or uni_desc[:2] == 'P ' or uni_desc[-2:] == ' P' or p_regex.search(char))
# print(uni_desc)
# print(unicodedata.category(char))
# print(f'new_index: {new_index}, index: {index} k_num: {k_num}, p1_num: {p1_num}, o_num: {o_num}, p2_num: {p2_num}')
if k == True and p1 == True and o == True and p2 == False and (' P ' in uni_desc or uni_desc[:2] == 'P ' or uni_desc[-2:] == ' P' or p_regex.search(char)):
# if guild:
# if guild.id != 210716706501296128:
# print(index - o_num)
whitespace = True
for x in phrase_list[(o_num - k_num + 1):(index)]:
# if guild:
# if guild.id != 210716706501296128:
# print(unicodedata.category(x))
if 'Z' not in unicodedata.category(x) and 'M' not in unicodedata.category(x) and 'C' not in unicodedata.category(x) and x != '\n':
whitespace = False
if ((new_index - o_num) <= 2) or whitespace is True:
p2_num = new_index
# print('p2')
p2 = True
break
elif k == True and p1 == True and o == False and ((' O ' in uni_desc) or (uni_desc[:2] == 'O ') or (uni_desc[-2:] == ' O') or emoji_regex.search(char) or o_regex.search(char)):
# print(index - p1_num)
whitespace = True
for x in phrase_list[(p1_num - k_num + 1):(index)]:
if 'Z' not in unicodedata.category(x) and 'M' not in unicodedata.category(x) and 'C' not in unicodedata.category(x) and x != '\n':
whitespace = False
if ((new_index - p1_num) <= 2) or whitespace is True:
# print('o')
o_num = new_index
index += 1
new_index += 1
o = True
elif k == True and p1 == False and (' P ' in uni_desc or uni_desc[:2] == 'P ' or uni_desc[-2:] == ' P' or p_regex.search(char)):
# print('p1')
whitespace = True
# print(phrase_list[((k_num - k_num) + 1):(index)])
for x in phrase_list[(k_num - k_num + 1):(index)]:
# print(f'char: {x}, cat: {unicodedata.category(x)}')
if 'Z' not in unicodedata.category(x) and 'M' not in unicodedata.category(x) and 'C' not in unicodedata.category(x) and x != '\n':
# print(f'whitespace false with character{x}')
whitespace = False
# print('\n')
if ((new_index - k_num) <= 2) or whitespace is True:
p1 = True
p1_num = new_index
index += 1
new_index += 1
elif k == False and (' K ' in uni_desc or uni_desc[:2] == 'K ' or uni_desc[-2:] == ' K' or k_regex.search(char)):
# print('k')
k = True
k_num = new_index
index += 1
new_index += 1
else:
new_index += 1
index += 1
continue
except:
index += 1
new_index += 1
continue
if k and p1 and o and p2:
return True, k_num, p1_num, o_num, p2_num
else:
return False, None, None, None, None
async def backup_kpop_check(phrase, user, guild, nick=False, message=False, custom_response=False, kick=True):
# print('backup kpop check')
global unicode_dict
global k_regex, o_regex, p_regex
success = False
phrase_list = list(phrase)
# if guild:
# if guild.id != 210716706501296128:
# print(phrase_list)
index, k_num, p1_num, o_num, p2_num = 0, 0, 0, 0, 0
for char in phrase_list:
try:
uni_desc = unicode_dict[char]
# if guild:
# if guild.id != 210716706501296128:
# print(uni_desc)
# print(unicodedata.category(char))
# print(f'index: {index}, k_num: {k_num}, p1_num: {p1_num}, o_num: {o_num}, p2_num: {p2_num}')
if ' K ' in uni_desc or uni_desc[:2] == 'K ' or uni_desc[-2:] == ' K' or k_regex.search(char):
# print('k')
# print(f'k detected at index {index}')
success, k_num, p1_num, o_num, p2_num = await backup_kpop_check_phrase_checker(index, phrase_list[index:], guild)
# print(success)
if success:
break
index += 1
else:
index += 1
continue
except:
index += 1
continue
if success:
if message:
phrase_list[p2_num] = f' __***{phrase[p2_num].upper()}***__ '
phrase_list[o_num] = f' __***{phrase[o_num].upper()}***__ '
phrase_list[p1_num] = f' __***{phrase[p1_num].upper()}***__ '
phrase_list[k_num] = f' __***{phrase[k_num].upper()}***__ '
response = ''.join(phrase_list)
await message.channel.send(f'you just wrote {response} buddy i see right through you')
target_channel = message.channel
elif nick:
target_channel = guild.text_channels[0]
await target_channel.send(f'come on {user.mention} i can read ur name buddy im not blind')
elif custom_response:
target_channel = guild.text_channels[0]
await target_channel.send(f'{custom_response}')
if kick:
await kpop_kicker(target_channel, user)
else:
return True
else:
return None
# ~~~~~M~A~F~I~A~~~~~C~O~D~E~~~~~
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# T H E M A F I A C O D E
# The following functions are all used for the currently almost-functional-but-not-quite-there-yet-due-to-random-bugs-at-the-very-end-of-the-game-
# that-i-cant-be-assed-to-properly-debug Mafia function.
# CURRENT BUGS INCLUDE: idk add something to this when ur bothered to test it again ok thanks andrei love you xx
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# ~~~~~M~A~F~I~A~~~~~C~O~D~E~~~~~
# ~~~~~M~A~F~I~A~~~~~C~O~D~E~~~~~
# ROLE DECIDER
# used to assign random roles to players.
# 1 detective, 1 medic, one third of the players rounded up are mafia, rest are innocents
# Potential for modularity to add roles based on keywords in mafia game creation???
# ~~~~~M~A~F~I~A~~~~~C~O~D~E~~~~~
def role_decider(players):
player_roles = {}
mafia_list = []
mafia_quantity = math.ceil(len(players)/3)
innocent_quantity = mafia_quantity - 1 - 1
while mafia_quantity > 0:
i = players.pop(random.randint(0, (len(players)-1)))
player_roles[i] = "Mafia"
mafia_list.append(i)
mafia_quantity -= 1
continue
player_roles[players.pop(random.randint(0, (len(players)-1)))] = "Detective"
player_roles[players.pop(random.randint(0, (len(players)-1)))] = "Medic"
for player in players:
player_roles[player] = "Innocent"
return player_roles, mafia_list
# ~~~~~M~A~F~I~A~~~~~C~O~D~E~~~~~
# ROLE DESCRIPTION CREATOR
# Generates descriptions for each role, returned to main mafia code and sent to each user via DM
# ~~~~~M~A~F~I~A~~~~~C~O~D~E~~~~~
def role_description(role):
if role == "Mafia":
response = "Your goal is to kill all players that are not in the mafia. You achieve this by, as a group, voting for someone to kill during the night.\nIf at least one member of the mafia evades capture and is the last to be alive, the entire Mafia team wins.\nYour vote on who to kill each night must be unanimous, or no action will be taken."
elif role == "Detective":
response = "Each night you are able to ask Barney if a single player is part of the mafia, to which Barney will respond yes or no."
elif role == "Medic":
response = "Each night you are able to choose a person to \'heal\'.\nIf the mafia chooses your chosen person to kill, they will not die."
elif role == "Innocent":
response = "You don't get to do anything special, sorry!"
return response
# ~~~~~M~A~F~I~A~~~~~C~O~D~E~~~~~
# MAFIA PERMISSIONS CREATOR
# Gives each player with the Mafia role the necessary permissions to interact with the Mafia text channel
# ~~~~~M~A~F~I~A~~~~~C~O~D~E~~~~~
def mafia_permissions_creator(mafia_list):
mafia_permissions = {}
for mafia in mafia_list:
mafia_permissions[mafia] = discord.PermissionOverwrite(read_messages=True, send_messages=True, add_reactions=True)
return mafia_permissions
# ~~~~~M~A~F~I~A~~~~~C~O~D~E~~~~~
# VOTE MESSAGE CREATOR
# Used to generate and send a message to any text channel in which they can vote for a specific player using an emoji player dictionary
# CURRENT BUGS: Does not always work properly for detective: detective votes for one player but returned another. investigation is correct, but correct player is not investigated
# ~~~~~M~A~F~I~A~~~~~C~O~D~E~~~~~
async def vote_message_creator(player_roles, client, channel, mafia=False, medic=False, detective=False):
emoji_list = ['1️⃣', '2️⃣', '3️⃣', '4️⃣', '5️⃣', '6️⃣', '7️⃣', '8️⃣', '9️⃣', '🔟', '😂', '😍', '🥵', '😱', '🤡']
vote_dict = {}
for player in player_roles.keys():
if player == client.user:
continue
if mafia:
if player_roles[player] == 'Mafia':
continue
if medic:
if player_roles[player] == 'Medic':
continue
if detective:
if player_roles[player] == 'Detective':
continue
vote_dict[emoji_list.pop(0)] = player
player_emoji_string = ''
for emoji in vote_dict.keys():
player_emoji_string = f'{player_emoji_string}{emoji} - {vote_dict[emoji].name}\n'
if mafia:
x = 'Vote unanimously for someone to kill by reacting to this message with the corresponding emoji. You have 20 seconds.'
vote_time = 20
elif medic:
x = 'Vote for somebody to save. If the mafia has chosen that player to die, they will instead survive. You have 15 seconds.'
vote_time = 15
elif detective:
x = 'Vote for somebody to investigate. You will receive a message on whether that player is part of the mafia. You have 15 seconds.'
vote_time = 15
else:
x = 'Vote for somebody to lynch out of the game. If a player has a majority of the votes, they will be lynched. In the event of a tie, there will be a revote with only those players. You have two minutes.'
vote_time = 15
vote_message = await channel.send(f'{x}\n{player_emoji_string}')
for emoji in vote_dict.keys():
await vote_message.add_reaction(emoji)
return vote_message, vote_time, vote_dict
# ~~~~~M~A~F~I~A~~~~~C~O~D~E~~~~~
# Very very very basic wake up message creator.
# Medic response has wayy too much info fix that pls
# ~~~~~M~A~F~I~A~~~~~C~O~D~E~~~~~
def wake_up_message_creator(player_roles, victim, saved_player, medic_player):
if victim:
death_responses = [
f'{victim.name} died. Unlucky.',
f'{victim.name} died. Super unlucky.'
]
saved_responses = [
f'{victim.name} was about to die, but {medic_player.name} saved them. Lucky.',
f'{victim.name} was about to die, but {medic_player.name} saved them. Super lucky.'
]
if not victim:
message = 'No one died.'
killed_player = None
elif victim == saved_player:
message = random.choice(saved_responses)
killed_player = None
else:
message = random.choice(death_responses)
killed_player = victim
return message, player_roles, killed_player
# Used to always run the Period Announcer function in the background
# client.bg_task = client.loop.create_task(period_announcer(client))
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# ON READY (on barney's connection to discord)
# connected stops the period announcer from happening more than once i think??? not 100% sure but i don't think it works
# because connected is changed to false usually while period_announcer is asyncio sleeping so while loop is not broken
# Populates all text files
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@client.event
async def on_ready():
global connected
global current_time
connected = False
print(f'{client.user.name} has connected to Discord.')
await client.change_presence(activity=discord.Activity(type=discord.ActivityType.watching, name="you 👀"))
txt_populator('swear_count.txt', client, GUILD)
txt_populator('im_feeling_lucky.txt', client, GUILD)
txt_populator('roles_list.txt', client, GUILD, roles=True)
txt_populator('val_encrypted_details.txt', client, GUILD)
txt_populator('val_shop_details.txt', client, GUILD)
print(f'It took {time.time()-current_time} seconds to boot up')
connected = True
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# ON MEMBER JOIN (new user joins guild)
# gives default roles = blue, school id
# if user was previously on the server, *eventually* gives them back their roles right before they left (or were kicked for saying the k word)
# might take a while because of rate limiting? either way, if barney is offline when someone rejoins they don't get roles so they're gonna bug you have fun
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@client.event
async def on_member_join(member):
await member.create_dm()
await member.dm_channel.send(
f'Hi {member.name}, welcome loser to the cool kids server'
)
dong_guild = member.guild
role_id_blue = 232788103948009472
role_id_orange = 234552386784329728
role_id_school_id = 691788291250454598
blue_role = discord.utils.get(dong_guild.roles, id=role_id_blue)
school_id_role = discord.utils.get(dong_guild.roles, id=role_id_school_id)
inFile = open('txt_files/roles_list.txt', 'r')
member_list_str = inFile.read()
inFile.close()
member_list_dict = json.loads(member_list_str)
if str(member.id) in member_list_dict.keys():
member_roles_id_str = member_list_dict[str(member.id)]
#print(member_roles_id_str)
member_roles_id_list = member_roles_id_str.split(',')
#print(member_roles_id_list)
member_roles_id_list.pop(0)
guild_roles = dong_guild.roles
guild_roles_id = []
for role in guild_roles:
guild_roles_id.append(role.id)
#print(guild_roles_id)
for role_id in member_roles_id_list:
#print(role_id)
if int(role_id) in guild_roles_id:
role = dong_guild.get_role(int(role_id))
#print(role)
if role:
await member.add_roles(role)
#print('success')
else:
print(f'role "{role.name}" not added')
else:
await member.add_roles(blue_role)
await member.add_roles(school_id_role)
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# ON MEMBER REMOVE (user leaving the guild)
# user's roles are updated to their role dictionary, so that the correct roles are given upon them rejoining
# implemented after gnu abused the system to get roles back that were saved when barney initialised by leaving and rejoining, even if they were stripped away by another user
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@client.event
async def on_member_remove(member):
inFile = open('txt_files/roles_list.txt')
member_list_str = inFile.read()
inFile.close()
member_list_dict = json.loads(member_list_str)
for member_id in member_list_dict.keys():
if int(member_id) == member.id:
role_list = member.roles
role_list_ids = []
dong_guild = member.guild
for role in role_list:
if role in dong_guild.roles:
print(role.name)
role_list_ids.append(str(role.id))
role_list_str = ','.join(role_list_ids)
member_list_dict[str(member.id)] = role_list_str
outFile = open('txt_files/roles_list.txt', 'w')
member_list_str = json.dumps(member_list_dict)
outFile.write(member_list_str)
outFile.close()
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# ON MEMBER UPDATE (if any user literally does anything e.g. status change, nickname update etc.)
# So far, only used to check if a nickname was changed to kpop, and to see who did it
# utilises AUDIT LOGS for this, docs are kinda unepic, use the debug console it's more helpful imo
# Also does a check to make sure nobody's been playing league of legends for too long >:(
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@client.event
async def on_member_update(before, after):
if (before.id == 203672102509740042):
# print("swag")
pass
if after.activity is not None and league_detection:
success = True
if before.activity is None:
pass
elif (before.activity.name == after.activity.name):
success = False
if after.activity.name.lower() == "league of legends" and success and after.id not in league_players:
id = after.id
league_players.append(id)
# await after.create_dm()
await after.send("you\'ve got one hour of league time on the clock buddy, after that you\'re out of the server")
await asyncio.sleep(3600)
print("hi")
new_member = after.guild.get_member(id)
if new_member.activity is None:
league_players.remove(id)
elif new_member.activity.name.lower() != "league of legends":
league_players.remove(id)
else:
# await after.create_dm()
await after.send("five minutes left, tick tock")
await asyncio.sleep(300)
new_member = after.guild.get_member(id)
if new_member.activity is None:
league_players.remove(id)
elif new_member.activity.name.lower() != "league of legends":
league_players.remove(id)
else:
channel = after.guild.text_channels[0]
await league_kicker(channel, after)
n = after.nick
if before.nick == n:
pass
else:
kpop_pattern = regex.compile(r"((k[^ ]*[pP][o0O][pP])|(korean pop)|(([κkk长K<])|(l𡿨)|(\|<)|(/<)|(:regional_indicator_k:)|(\)<))[.,/'\"%^&*?!@’#$()-_+=~`|<> ]*(([م尸ρ卩pمрРP])|(:parking:)|(:regional_indicator_p:))[.,/'\"%^&’*?!@#$()-_+=~`|<> ]*(([םo口õο๐σ〇θôōøоО٥סּ0O])|(:regional_indicator_o:))[.,/'\"%^&*?!@#’$()-_+=~`|<> ]*(([م尸ρ卩pمрРP])|(:parking:)|(:regional_indicator_p:)))")
guild = before.guild
if n:
immune = False
if kpop_pattern.search(n):
print('kpop detected in username change')
async for entry in guild.audit_logs(limit=1):
if entry.target == entry.user:
kpop_coupons_users = json.loads(open('txt_files/kpop_coupons_users.txt').read())
if str(entry.user.id) in kpop_coupons_users.keys():
if kpop_coupons_users[str(entry.user.id)] >= int(time.time()):
immune = True
elif kpop_coupons_users[str(entry.user.id)] < int(time.time()):
del kpop_coupons_users[str(entry.user.id)]
outFile = open('txt_files/kpop_coupons_users.txt', 'w')
outFile.write(json.dumps(kpop_coupons_users))
outFile.close()
response = f'i saw you change your nickname to the k word {entry.user.mention} how dumb do you think i am'
elif entry.target != entry.user:
kpop_coupons_users = json.loads(open('txt_files/kpop_coupons_users.txt').read())
immunity_str = ''
if str(entry.user.id) in kpop_coupons_users.keys():
if kpop_coupons_users[str(entry.user.id)] >= int(time.time()):
immune = True
immunity_str = '. i can\'t kick you bc you have the kpop pass, but don\'t dog someone else out smh.'
elif kpop_coupons_users[str(entry.user.id)] < int(time.time()):
del kpop_coupons_users[str(entry.user.id)]
outFile = open('txt_files/kpop_coupons_users.txt', 'w')
outFile.write(json.dumps(kpop_coupons_users))
outFile.close()
response = f'i saw you {entry.user.mention} change {entry.target.mention}\'s nickname to the k word you really gonna do them like that{immunity_str}'
target_channel = guild.text_channels[0]
await target_channel.send(response)
if not immune:
await kpop_kicker(target_channel, entry.user)
else:
async for entry in guild.audit_logs(limit=1):
if entry.target == entry.user:
kpop_coupons_users = json.loads(open('txt_files/kpop_coupons_users.txt').read())
if str(entry.user.id) in kpop_coupons_users.keys():
if kpop_coupons_users[str(entry.user.id)] >= int(time.time()):
immune = True
elif kpop_coupons_users[str(entry.user.id)] < int(time.time()):
del kpop_coupons_users[str(entry.user.id)]
outFile = open('txt_files/kpop_coupons_users.txt', 'w')
outFile.write(json.dumps(kpop_coupons_users))
outFile.close()
response = f'i saw you change your nickname to the k word {entry.user.mention} how dumb do you think i am'
elif entry.target != entry.user:
kpop_coupons_users = json.loads(open('txt_files/kpop_coupons_users.txt').read())
immunity_str = ''
if str(entry.user.id) in kpop_coupons_users.keys():
if kpop_coupons_users[str(entry.user.id)] >= int(time.time()):
immune = True
immunity_str = '. i can\'t kick you bc you have the kpop pass, but don\'t dog someone else out smh.'
elif kpop_coupons_users[str(entry.user.id)] < int(time.time()):
del kpop_coupons_users[str(entry.user.id)]
outFile = open('txt_files/kpop_coupons_users.txt', 'w')
outFile.write(json.dumps(kpop_coupons_users))
outFile.close()
response = f'i saw you {entry.user.mention} change {entry.target.mention}\'s nickname to the k word you really gonna do them like that{immunity_str}'
success = await backup_kpop_check(n, entry.user, guild, nick=False, message=False, custom_response=False, kick=False)
if success is True:
async for entry in guild.audit_logs(limit=1):
if entry.target == entry.user:
kpop_coupons_users = json.loads(open('txt_files/kpop_coupons_users.txt').read())
if str(entry.user.id) in kpop_coupons_users.keys():
if kpop_coupons_users[str(entry.user.id)] >= int(time.time()):
immune = True
elif kpop_coupons_users[str(entry.user.id)] < int(time.time()):
del kpop_coupons_users[str(entry.user.id)]
outFile = open('txt_files/kpop_coupons_users.txt', 'w')
outFile.write(json.dumps(kpop_coupons_users))
outFile.close()
response = f'i saw you change your nickname to the k word {entry.user.mention} how dumb do you think i am'
elif entry.target != entry.user:
kpop_coupons_users = json.loads(open('txt_files/kpop_coupons_users.txt').read())
immunity_str = ''
if str(entry.user.id) in kpop_coupons_users.keys():
if kpop_coupons_users[str(entry.user.id)] >= int(time.time()):
immune = True
immunity_str = '. i can\'t kick you bc you have the kpop pass, but don\'t dog someone else out smh.'
elif kpop_coupons_users[str(entry.user.id)] < int(time.time()):
del kpop_coupons_users[str(entry.user.id)]
outFile = open('txt_files/kpop_coupons_users.txt', 'w')
outFile.write(json.dumps(kpop_coupons_users))
outFile.close()
response = f'i saw you {entry.user.mention} change {entry.target.mention}\'s nickname to the k word you really gonna do them like that'
target_channel = guild.text_channels[0]
await target_channel.send(response)
await kpop_kicker(target_channel, entry.user)
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# ON VOICE STATE UPDATE
# Currently being used to send an @here notification when Steven starts streaming a game
# Can also potentially be used down the line for Schmalex voice recognition to auto start when he joins?
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# @client.event
# async def on_voice_state_update(member, before, after):
# global steve_stream
# now = datetime.datetime.now()
# if member.id == 183880246917988353: # Steven
# if steve_stream:
# inFile = open('txt_files/steve_stream_time.txt')
# time_str = inFile.read()
# steve_time = float(time_str)
# if time.time() - steve_time >= 18000:
# steve_stream = False
#
# if after.self_stream and (not before.self_stream) and (now.hour >= 22) and (not steve_stream):
# try:
# if 'overwatch' not in member.activity.name.lower():
# steve_stream = True
# current_time = time.time()
# outFile = open('txt_files/steve_stream_time.txt', 'w')
# outFile.write(str(current_time))
# outFile.close()
# text_channel = after.channel.guild.text_channels[0]
# await text_channel.send('@everyone steve stream has just started!')
# if not fb_client.isLoggedIn():
# fb_client.login()
# msg = f'hi guys steve stream has started'
# fb_client.send(fbchat.Message(text=msg), thread_id=2654775107962874, thread_type=fbchat.ThreadType.GROUP)
# except Exception as e:
# print(e)
# return None
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# GENERAL FUCKERY
# Use this for anything relatively simple, where barney just sends a one liner in response to a specific message and no other code should be run
# Barney's humble beginnings, barney_response 1 2 and 3 were his first responses along with greeting_pattern.
# Oh how my boy has grown, brings a tear to my eye ;(
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def general_fuckery(message):
msg = message.content.lower()