forked from yymin1022/Wa_API
-
Notifications
You must be signed in to change notification settings - Fork 0
/
message.py
1178 lines (971 loc) · 37.6 KB
/
message.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 bs4 import BeautifulSoup
from requests.adapters import HTTPAdapter
from requests.packages.urllib3.util.ssl_ import create_urllib3_context
import datetime
import json
import os
import random
import requests
import time
import xmltodict
CIPHERS = (
'ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:ECDH+HIGH:'
'DH+HIGH:ECDH+3DES:DH+3DES:RSA+AESGCM:RSA+AES:RSA+HIGH:RSA+3DES:!aNULL:'
'!eNULL:!MD5'
':HIGH:!DH:!aNULL'
)
class DESAdapter(HTTPAdapter):
def init_poolmanager(self, *args, **kwargs):
context = create_urllib3_context(ciphers=CIPHERS)
kwargs['ssl_context'] = context
return super(DESAdapter, self).init_poolmanager(*args, **kwargs)
def proxy_manager_for(self, *args, **kwargs):
context = create_urllib3_context(ciphers=CIPHERS)
kwargs['ssl_context'] = context
return super(DESAdapter, self).proxy_manager_for(*args, **kwargs)
def getReplyMessage(message, room, sender):
strResult = ""
if "!뉴스" in message:
strResult = messageFakeNews(message)
elif "!기억" in message:
strResult = messageRemember(message, room)
elif "!날짜" in message:
if "더하기" in message:
strResult = messageCalDay(1, message)
elif "빼기" in message:
strResult = messageCalDay(0, message)
elif "!메모" in message:
strResult = messageMemo(message, sender)
elif "아.." in message:
strResult = messageAh()
elif "안사요" in message or "안 사요" in message or "사지말까" in message or "사지 말까" in message or "안살래" in message or "안 살래" in message:
strResult = messageAhnsa()
elif "응애" in message:
strResult = messageBaby()
elif "병희 전역" in message:
strResult = messageBHGraduate()
elif "불편" in message:
strResult = messageBoolpyeon()
elif "사고싶" in message or "사야" in message or "살까" in message or "샀어" in message or "샀다" in message or "샀네" in message or "사버렸" in message:
strResult = messageBuy()
elif "학사일정" in message:
strResult = messageCAUCalendar()
elif "열람실" in message:
if "서울" in message:
strResult = messageCAULibrary("1")
elif "법학" in message:
strResult = messageCAULibrary("2")
elif "안성" in message:
strResult = messageCAULibrary("3")
else:
strResult = messageCAULibrary("")
elif "학식" in message:
if "아침" in message or "조식" in message:
strResult = messageCAUMeal("10")
elif "점심" in message or "중식" in message:
strResult = messageCAUMeal("20")
elif "저녁" in message or "석식" in message:
strResult = messageCAUMeal("40")
elif "대림대" in message:
strResult = messageDaelimMeal()
elif "안양대" in message:
strResult = messageAnyangMeal()
else:
strResult = messageCAUMeal("")
elif "창환 전역" in message:
strResult = messageChalsGraduate()
elif "개발해야" in message or "코딩해야" in message or "과제해야" in message:
strResult = messageCoding()
elif ("ㅠ" in message or "ㅜ" in message) and getCryCount(message) >= 3:
strResult = messageCry()
elif "!디데이" in message or "!day" in message:
strResult = messageDDay(message)
elif "뭐먹" in message or "머먹" in message:
strResult = messageEat()
elif ("제발" in message or "하고 싶다" in message) and "졸업" in message:
strResult = messageGraduate()
elif "하.." in message:
strResult = messageHa()
elif "한수 소해" in message:
strResult = messageHansuGraduate()
elif "호규" in message:
if "전역" in message:
strResult = messageHokyuGraduate()
else:
strResult = messageHokyu()
elif "배고파" in message or "배고프" in message:
strResult = messageHungry()
elif "이런.." in message:
strResult = messageIreon()
elif "재민 소해" in message:
strResult = messageJaeminGraduate()
elif "주형" in message:
strResult = messageJoohyeong()
elif ("ㅋ" in message or "ㅎ" in message) and getLaughCount(message) >= 20:
strResult = messageLaugh()
elif "민식" in message:
strResult = messageMinsik()
elif "과제" in message or "집가고싶다" in message:
strResult = messageMinsikBooreop()
elif "ㅡㅡ" in message:
strResult = messageMM()
elif ("앎" in message or "아는사람" in message) or "알아" in message:
strResult = messageMoloo()
elif "무야호" in message:
strResult = messageMooYaHo()
elif "남샤" in message:
if "1층" in message:
strResult = messageNSUMeal(465, 0)
elif "2층" in message:
strResult = messageNSUMeal(466, 0)
elif "3층" in message:
strResult = messageNSUMeal(467, 0)
elif "카페" in message:
if "조식" in message:
strResult = messageNSUMeal(468, 0)
elif "중식" in message:
strResult = messageNSUMeal(468, 1)
elif "꺼라" in message:
strResult = messageOff()
elif "오호" in message or "호오" in message:
strResult = messageOho(message)
elif "오.." in message:
strResult = messageOh()
elif "오케이" in message:
strResult = messageOkay()
elif "퇴근" in message:
strResult = messageOutwork()
elif "ㄹㅇㅋㅋ" in message:
strResult = messageReal()
elif "^^7" in message:
strResult = messageSalute()
elif "나스" in message:
strResult = messageSaseyo()
elif "승범 졸업" in message:
strResult = messageSeungbeomGraduate()
elif "성민 소해" in message:
strResult = messageSeongminGraduate()
elif "서건1우" in message:
strResult = messageSGW()
elif "슈슉" in message:
strResult = messageShuk()
elif "졸려" in message or "잠와" in message or "피곤해" in message:
strResult = messageSleepy()
elif "멈춰" in message:
strResult = messageStop()
elif ";" in message and getStressCount(message) >= 4:
strResult = messageStress()
elif "어.." in message:
strResult = messageUh()
elif "와.." in message:
strResult = messageWa()
elif "와!" in message:
strResult = messageWaSans()
elif "!날씨" in message:
strResult = messageWeather()
elif "용민" in message:
strResult = messageYongmin()
elif "자라" in message:
strResult = messageZara()
elif "거북이" in message:
strResult = messageGgobugi()
elif "자야" in message or "잘까" in message:
strResult = messageZayazi()
elif "뭐였" in message:
strResult = messageRemreturn(room)
elif "뭐더라" in message:
strResult = messageMemreturn(sender)
return strResult
def getCryCount(message):
count = message.count("ㅠ")
count += message.count("ㅜ")
return count
def getLaughCount(message):
count = message.count("ㅋ")
count += message.count("ㄱ")
count += message.count("ㄲ")
count += message.count("ㄴ")
count += message.count("ㅌ")
count += message.count("ㅎ")
return count
def getStressCount(message):
count = message.count(";")
count += message.count(":")
count += message.count(",")
count += message.count(".")
return count
def messageAh():
randInt = random.randrange(0, 6)
strMessage = ""
if randInt == 0:
strMessage = "글쿤.."
elif randInt == 1:
strMessage = "그래요.."
elif randInt == 2:
strMessage = "그렇군요.."
elif randInt == 3:
strMessage = "안돼.."
elif randInt == 4:
strMessage = "..메리카노"
elif randInt == 5:
strMessage = "..에이오우"
return strMessage
def messageAhnsa():
randInt = random.randrange(0, 5)
strMessage = ""
if randInt == 0:
strMessage = "이걸 안 사?"
elif randInt == 1:
strMessage = "왜요;;"
elif randInt == 2:
strMessage = "그거 사면 진짜 좋을텐데.."
elif randInt == 3:
strMessage = "아.."
elif randInt == 4:
strMessage = "헐.."
return strMessage
def messageAnyangMeal():
todayDate = datetime.date.today()
numDate = todayDate.weekday()
if numDate >= 5:
return "금일은 학식을 운영하지 않습니다"
mealUrl = "https://www.anyang.ac.kr/main/activities/school-cafeteria.do"
requestSession = requests.Session()
requestSession.mount(mealUrl, DESAdapter())
mealResponse = requestSession.get(mealUrl).text
bs = BeautifulSoup(mealResponse, 'html.parser')
mealData = json.loads(bs.find("input", id="mealList").get("value"))
strDate = ["mon", "tue", "wed", "thu", "fri"]
strMessage = f"{todayDate.strftime('%Y.%m.%d.')} 안양대학교 학식메뉴\n"
strMessage += f"{mealData[f'{strDate[numDate]}Main02']}"
for item in mealData[f'{strDate[numDate]}Sub02']:
strMessage += f"\n{item}"
return strMessage
def messageBaby():
randInt = random.randrange(0, 3)
strMessage = ""
if randInt == 0:
strMessage = "귀여운척 하지 마세요;;"
elif randInt == 1:
strMessage = "응애 나 애기"
elif randInt == 2:
strMessage = "응애 나 코린이"
return strMessage
def messageBoolpyeon():
strMessage = "불편해?\\m불편하면 자세를 고쳐앉아!\\m보는 자세가 불편하니깐 그런거아냐!!"
return strMessage
def messageBuy():
randInt = random.randrange(0, 8)
strMessage = ""
if randInt == 0:
strMessage = "축하합니다!!!"
elif randInt == 1:
strMessage = "그걸 샀네;;"
elif randInt == 2:
strMessage = "개부자;;"
elif randInt == 3:
strMessage = "와 샀네"
elif randInt == 4:
strMessage = "이걸 산다고?"
elif randInt == 5:
strMessage = "ㅋㅋ"
elif randInt == 6:
strMessage = "왜요"
elif randInt == 7:
strMessage = "그거 살 돈이면 차라리..\\m........."
return strMessage
def messageBHGraduate():
strMessage = "임병희씨가 입대한지 %d일, 전역한지는 %d일이 됐습니다."%((datetime.date.today() - datetime.date(2020,6,30)).days, (datetime.date.today() - datetime.date(2021,12,29)).days)
return strMessage
def messageCAUCalendar():
strMessage = ""
calData = datetime.date.today()
calMonth = calData.month
calYear = calData.year
calData = {
"active": True,
"month": calMonth,
"title": f"{calMonth}월",
"year": calYear
}
calUrl = "https://mportal.cau.ac.kr/portlet/p014/p014List.ajax"
requestSession = requests.Session()
requestSession.mount(calUrl, DESAdapter())
calResponse = eval(requestSession.post(calUrl, json=calData).json())
calList = calResponse["data"]
strMessage = f"중앙대학교 {calMonth}월 학사일정\n"
for calItem in calList:
strMessage += f"\n{calItem['TITLE']} : {calItem['TDAY']}"
return strMessage
def messageCAULibrary(libTypeID):
strMessage = libTypeID
libData = {
"tabNo": libTypeID
}
libType = ""
libUrl = "https://mportal.cau.ac.kr/portlet/p017/p017.ajax"
if libTypeID == "1":
libType = "서울"
elif libTypeID == "2":
libType = "법학"
elif libTypeID == "3":
libType = "안성"
else:
strMessage = "중앙대학교 열람실 좌석현황\n\n사용법 : 열람실 키워드와 함께 서울 / 안성 / 법학 키워드 언급"
return strMessage
requestSession = requests.Session()
requestSession.mount(libUrl, DESAdapter())
libResponse = requestSession.post(libUrl, json=libData).json()
libList = libResponse["gridData"]
strMessage = f"중앙대학교 열람실 좌석현황({libType})\n"
for libItem in libList:
strMessage += f"\n{libItem['roomName']} : 여석 {libItem['remainCnt']}석 ({libItem['useCnt']}석 사용중)"
return strMessage
def messageCAUMeal(mealTypeID):
strMessage = mealTypeID
mealData = {
"daily": 0,
"tabs": "1",
"tabs2": mealTypeID
}
mealType = ""
mealUrl = "https://mportal.cau.ac.kr/portlet/p005/p005.ajax"
if mealTypeID == "10":
mealType = "조식"
elif mealTypeID == "20":
mealType = "중식"
elif mealTypeID == "40":
mealType = "석식"
else:
strMessage = "중앙대학교 학식메뉴\n\n사용법 : 학식 키워드와 함께 아침 / 점심 / 저녁 / 조식 / 중식 / 석식 키워드 언급"
return strMessage
requestSession = requests.Session()
requestSession.mount(mealUrl, DESAdapter())
mealResponse = requestSession.post(mealUrl, json=mealData).json()
mealList = mealResponse["list"]
strMessage = f"{mealList[0]['date']}. 중앙대학교 학식메뉴({mealType})\n"
for mealItem in mealList:
strMenu = mealItem['menuDetail']
if strMenu == None:
strMenu = "정보가 없습니다."
strMessage += f"\n{mealItem['rest']} : {strMenu}"
return strMessage
def messageCalDay(cal, message):
strMessage = ""
weekly = 0
day = datetime.datetime.now()
try:
if "주" in message:
weekly = 1
message = message.replace("!날짜더하기", "").replace("!날짜빼기", "").replace(" ", "").replace("일", "").replace("주", "")
if message.isdigit() == False:
raise
if cal == 1:
if weekly == 1:
dday = day + datetime.timedelta(days=int(message) * 7)
strMessage = "오늘을 기준으로 %s주 후는 %s년 %s월 %s일입니다." % (message, dday.year, dday.month, dday.day)
else:
dday = day + datetime.timedelta(days=int(message))
strMessage = "오늘을 기준으로 %s일 후는 %s년 %s월 %s일입니다." % (message, dday.year, dday.month, dday.day)
elif cal == 0:
if weekly == 1:
dday = day - datetime.timedelta(days=int(message) * 7)
strMessage = "오늘을 기준으로 %s주 전은 %s년 %s월 %s일입니다." % (message, dday.year, dday.month, dday.day)
else:
dday = day - datetime.timedelta(days=int(message))
strMessage = "오늘을 기준으로 %s일 전은 %s년 %s월 %s일입니다." % (message, dday.year, dday.month, dday.day)
except:
strMessage = "존재하지 않는 날짜이거나 사용 불가능한 형식입니다.\\mex) !날짜더하기 100일 or !날짜빼기 16주"
return strMessage
def messageChalsGraduate():
strMessage = "찰스가 입대한지 %d일, 전역한지는 %d일이 됐습니다."%((datetime.date.today() - datetime.date(2020,12,7)).days, (datetime.date.today() - datetime.date(2022,9,1)).days)
return strMessage
def messageCoding():
randInt = random.randrange(0, 2)
strMessage = ""
if randInt == 0:
strMessage = "구라ㅡㅡ;;"
elif randInt == 1:
strMessage = "ㅋ"
return strMessage
def messageCry():
strMessage = "뭘 울어요;;"
return strMessage
def messageDaelimMeal():
todayDate = datetime.date.today()
mealUrl = "https://www.daelim.ac.kr/ajaxf/FrBistroSvc/BistroCarteInfo.do"
mealInput = f"MENU_ID=1470&BISTRO_SEQ=1&START_DAY={todayDate.strftime('%Y.%m.%d')}&END_DAY={todayDate.strftime('%Y.%m.%d')}"
mealHeader = {"Content-Type": "application/x-www-form-urlencoded"}
requestSession = requests.Session()
requestSession.mount(mealUrl, DESAdapter())
mealResponse = requestSession.post(mealUrl, data=mealInput, headers=mealHeader).json()
strDate = todayDate.weekday() + 1
strMessage = f"{todayDate.strftime('%Y.%m.%d.')} 대림대학교 학식메뉴\n"
if strDate < 6:
for idx in range(1, 10):
try:
strMessage += f">> {mealResponse['data'][f'CNM1{idx}']} <<\n{mealResponse['data'][f'CCT{strDate}{idx}'].strip()}\n"
except:
pass
else:
strMessage += "금일은 학식을 운영하지 않습니다"
return strMessage
def messageDateCalculator(y, m, d):
dateEnd = datetime.date(y,m,d)
dateToday = datetime.date.today()
now = datetime.datetime.now()
leftdays = (dateEnd - dateToday).days
lefthours = 24 - now.hour - 1
leftminutes = 60 - now.minute - 1
leftseconds = 60 - now.second - 1
leftseconds_wa = (leftdays * 24 * 60 * 60 - 1) + (lefthours * 60 * 60) + (leftminutes * 60) + leftseconds
return leftdays, lefthours, leftminutes, leftseconds, leftseconds_wa
def messageDDay(message):
try:
strMessage = ""
message = message.replace("!디데이", "").replace("!day", "").replace(" ", "")
if message.strip()[-1] == '.': message = message[:-1]
if message.count('-') == 2 or message.count('.') == 2:
if "-" in message: message = message.split("-")
elif "." in message: message = message.split(".")
if len(str(message[0])) == 2:
message[0] = "20" + message[0]
y, m, d = int(message[0]), int(message[1]), int(message[2])
messageDateCalculator(y, m, d)
leftdays, lefthours, leftminutes, leftseconds, leftseconds_wa = messageDateCalculator(y, m, d)
if leftdays < 0: strMessage = "%s년 %s월 %s일을 기준으로 오늘은 %s일이 지났으며, 이를 초 단위로 환산하면 %s초입니다."%(message[0], message[1], message[2], format(int(leftdays * -1), ','), format(int(leftseconds_wa * -1), ','))
elif leftdays == 0: strMessage = "D-DAY입니다!"
else: strMessage = "%s년 %s월 %s일까지는 %s일이 남았으며, 이를 초 단위로 환산하면 %s초입니다."%(message[0], message[1], message[2], format(leftdays, ','), format(leftseconds_wa, ','))
else: raise
except:
strMessage = "존재하지 않는 날짜이거나 사용 불가능한 형식입니다.\\mex) !day 2023.9.8 or !디데이 23.12.31"
return strMessage
def messageEat():
randInt = random.randrange(0, 33)
strMessage = ""
if randInt == 0:
strMessage = "돼지"
elif randInt == 1:
strMessage = "또 먹어?"
elif randInt == 2:
strMessage = "살쪄"
elif randInt == 3:
strMessage = "그만 먹어;;"
elif randInt == 4:
strMessage = "된장찌개!!"
elif randInt == 5:
strMessage = "부리또!!"
elif randInt == 6:
strMessage = "김볶밥!!"
elif randInt == 7:
strMessage = "김치찌개!!"
elif randInt == 8:
strMessage = "햄버거!!"
elif randInt == 9:
strMessage = "부찌!!"
elif randInt == 10:
strMessage = "불고기!!"
elif randInt == 11:
strMessage = "삼겹살!!"
elif randInt == 12:
strMessage = "돼지갈비!!"
elif randInt == 13:
strMessage = "황금볶음밥!!"
elif randInt == 14:
strMessage = "미역국!!"
elif randInt == 15:
strMessage = "닭갈비!!"
elif randInt == 16:
strMessage = "떡볶이!!"
elif randInt == 17:
strMessage = "순두부찌개!!"
elif randInt == 18:
strMessage = "돈까스!!"
elif randInt == 19:
strMessage = "곱창!!"
elif randInt == 20:
strMessage = "콩나물국!!"
elif randInt == 21:
strMessage = "짜장면!!"
elif randInt == 22:
strMessage = "감자전!!"
elif randInt == 23:
strMessage = "짬뽕!!"
elif randInt == 24:
strMessage = "해물탕!!"
elif randInt == 25:
strMessage = "감자탕!!"
elif randInt == 26:
strMessage = "치킨!!"
elif randInt == 27:
strMessage = "라면!!"
elif randInt == 28:
strMessage = "샌드위치!!"
elif randInt == 29:
strMessage = "피자!!"
elif randInt == 30:
strMessage = "파스타!!"
elif randInt == 31:
strMessage = "햄버거!!"
elif randInt == 32:
strMessage = "샐러드!!"
elif randInt == 33:
strMessage = "쌈밥!!"
return strMessage
def messageGgobugi():
randInt = random.randrange(0, 3)
strMessage = ""
if randInt == 1 or randInt == 2 :
ggobugiInt = random.randrange(0, 2)
ggobugiMessage = ""
if ggobugiInt == 0:
ggobugiMessage = "효과는 굉장했다!"
elif ggobugiInt == 1:
ggobugiMessage = "효과가 별로인 듯하다..."
if randInt == 0:
strMessage = "자라"
elif randInt == 1:
strMessage = "꼬부기는 몸통박치기를 사용했다.\\m" + ggobugiMessage
elif randInt == 2:
strMessage = "꼬부기는 물대포를 사용했다.\\m" + ggobugiMessage
return strMessage
def messageGraduate():
randInt = random.randrange(0, 4)
strMessage = ""
if randInt == 0:
strMessage = "대학원 가셔야죠 ㅋㅋ"
elif randInt == 1:
strMessage = "졸업은 무슨"
elif randInt == 2:
strMessage = "노예 하셔야죠 ㅋㅋ"
elif randInt == 3:
strMessage = "어림도 없지 ㅋㅋ"
return strMessage
def messageHa():
randInt = random.randrange(0, 2)
strMessage = ""
if randInt == 0:
strMessage = "코딩하기 싫다.."
elif randInt == 1:
strMessage = "과제하기 싫다.."
return strMessage
def messageHokyu():
strMessage = ""
randInt = random.randrange(0, 11)
if randInt == 0:
strMessage = "필승! 전문-38기 하사 김호규입니다!"
elif randInt == 1:
strMessage = "예! 하사 김호규!"
elif randInt == 2:
strMessage = "ㅍ승!"
elif randInt == 3:
strMessage = "안녕하세요? 전역하지 않기로 한 김호규입니다."
elif randInt == 4:
strMessage = "팬택 핥짝"
elif randInt == 5:
strMessage = "베가 핥짝 핥짝"
elif randInt == 6:
strMessage = "호구"
elif randInt == 7:
strMessage = "K2C1 핥짝핥짝"
elif randInt == 8:
strMessage = "감사합니다. 314대대 통신반 김호규 하사입니다. 머슼타드일까요?"
elif randInt == 9:
strMessage = "악! 소위 김호규!"
elif randInt == 10:
strMessage = "아...\\m전역하기 싫다..."
return strMessage
def messageHokyuGraduate():
strMessage = ""
y, m, d = int(2023), int(8), int(27)
messageDateCalculator(y, m, d)
leftdays, lefthours, leftminutes, leftseconds, leftseconds_wa = messageDateCalculator(y, m, d)
if leftdays == 0:
strMessage = "호규의 전역을 축하합니다!!!!"
return strMessage
if leftdays < 0:
randInt = random.randrange(0, 6)
if randInt == 0:
strMessage = "호규의 부사후 249기 지원을 응원합니다!"
elif randInt == 1:
strMessage = "호규의 학사 152기 지원을 응원합니다!"
elif randInt == 2:
strMessage = "호규의 예비군 소집해제일까지 %d일 남았습니다."%((datetime.date(2030,12,31) - datetime.date.today()).days -1)
elif randInt == 3:
strMessage = "호규의 민방위 소집해제일까지 %d일 남았습니다."%((datetime.date(2041,4,28) - datetime.date.today()).days -1)
elif randInt == 4:
strMessage = "예비군 0년차는 좀..."
elif randInt == 5:
strMessage = "하사 김호규의 임기제부사관 만기복무일까지 %d일 남았습니다."%((datetime.date(2027,8,26) - datetime.date.today()).days -1)
return strMessage
randInt = random.randrange(0, 5)
if randInt == 0:
randInt = random.randrange(0, 3)
if randInt == 0:
strMessage = "호규가 전역하기까지 " + format(leftseconds_wa, ',') + "초 남았습니다."
elif randInt == 1:
strMessage = "zz"
elif randInt == 2:
strMessage = "답변하기 적당한 말을 찾지 못했어요."
elif randInt == 1:
strMessage = "호규가 입대한 지 %d일 되었습니다."%((datetime.date.today() - datetime.date(2021,12,6)).days)
elif randInt == 2:
strMessage = "833기가 벌써 전역 따질 짬인가?"
elif randInt == 3:
strMessage = "응 안 돼~"
elif randInt == 4:
strMessage = "하사 김호규의 임기제부사관 만기복무일까지 %d일 남았습니다."%((datetime.date(2027,8,26) - datetime.date.today()).days -1)
return strMessage
def messageHansuGraduate():
randInt = random.randrange(0, 4)
strMessage = ""
y, m, d = int(2024), int(8), int(31)
messageDateCalculator(y, m, d)
leftdays, lefthours, leftminutes, leftseconds, leftseconds_wa = messageDateCalculator(y, m, d)
if randInt == 0:
strMessage = "ㅋㅋ"
elif randInt == 1:
strMessage = "이한수씨의 소집해제일까지 %d일 %d시간 %d분 %d초 남았습니다."%(leftdays - 1, abs(lefthours), leftminutes, leftseconds)
elif randInt == 2:
strMessage = "이한수씨의 소집해제일까지 " + format(leftseconds_wa, ',') + "초 남았습니다."
elif randInt == 3:
strMessage = "답변하기 적당한 말을 찾지 못했어요."
return strMessage
def messageHungry():
strMessage = ""
randInt = random.randrange(0, 4)
if randInt == 0:
strMessage = "돼지"
elif randInt == 1:
strMessage = "또 먹어?"
elif randInt == 2:
strMessage = "살쪄"
elif randInt == 3:
strMessage = "그만 먹어;;"
return strMessage
def messageIreon():
randInt = random.randrange(0, 5)
strMessage = ""
if randInt == 0:
strMessage = "안됐군요.."
elif randInt == 1:
strMessage = "안타깝네요.."
elif randInt == 2:
strMessage = "눈물이 납니다.."
elif randInt == 3:
strMessage = "유감입니다.."
elif randInt == 4:
strMessage = "불쌍하네요.."
return strMessage
def messageJaeminGraduate():
randInt = random.randrange(0, 3)
strMessage = ""
y, m, d = int(2024), int(3), int(4)
messageDateCalculator(y, m, d)
leftdays, lefthours, leftminutes, leftseconds, leftseconds_wa = messageDateCalculator(y, m, d)
if randInt == 0:
strMessage = "404 Not Found"
elif randInt == 1:
strMessage = "재민이가 민간인(진)이 되기까지 %d일 %d시간 %d분 %d초 남았습니다."%(leftdays - 1, abs(lefthours), leftminutes, leftseconds)
elif randInt == 2:
strMessage = "재민이가 사람이 되기까지 " + format(leftseconds_wa, ',') + "초 남았습니다."
return strMessage
def messageJoohyeong():
strMessage = "예! 2025년도 CECOM 회장 이주형!"
return strMessage
def messageLaugh():
randInt = random.randrange(0, 2)
strMessage = ""
if randInt == 0:
strMessage = "뭘 웃어요;;"
elif randInt == 1:
strMessage = "안웃긴데;;"
return strMessage
def messageMemo(message, sender):
message = message.replace("!메모", "").strip()
if len(message) != 0:
if os.path.isfile("mem.json"):
with open('mem.json', 'r', encoding='utf-8') as f:
mem_dict = json.load(f)
else:
mem_dict = {}
mem_dict[sender] = message
json_data = json.dumps(mem_dict, ensure_ascii=False, indent=4)
with open('mem.json', 'w', encoding='utf-8') as f:
f.write(json_data)
else:
pass
strMessage = ""
return strMessage
def messageMemreturn(sender):
strMessage = ""
if os.path.isfile("mem.json"):
with open('mem.json', 'r', encoding='utf-8') as f:
mem_dict = json.load(f)
if sender in mem_dict:
strMessage = mem_dict[sender] + "\\m^^7"
else:
strMessage = ""
else:
strMessage = ""
return strMessage
def messageMinsik():
strMessage = "민식아 그래서 학교는 언제와?"
return strMessage
def messageMinsikBooreop():
strMessage = "2023-1학기 복학한 민식아 이제 안부럽다"
return strMessage
def messageMoloo():
strMessage = "몰?루"
return strMessage
def messageMooYaHo():
strMessage = "그만큼 신나신다는거지~"
return strMessage
def messageMM():
strMessage = "정색하지 마세요;;"
return strMessage
def messageNSUMeal(NSU_BAP, food_list):
strMessage = ""
strUrl = "https://nsu.ac.kr/api/user/board/getBoardContentSummaryList"
requestSession = requests.Session()
requestSession.mount(strUrl, DESAdapter())
mealResponse = requestSession.post(strUrl, headers={'Content-Type': 'application/x-www-form-urlencoded'}, data="boardIdList=%d&includeProperties=1&parentBoardContentId=-1&isAvailable=1&isPrivate=0&isAlwaysOnTop=0&isDeleted=0&orderByCode=4" % NSU_BAP).json()
mealResponse = dict(mealResponse)
mealDate = mealResponse["body"]["list"][0]["title"]
mealList = []
if food_list == 0:
mealList = mealResponse["body"]["list"][0]["properties"]["food_list"][0]
elif food_list == 1:
mealList = mealResponse["body"]["list"][0]["properties"]["food_list"][1]
mealList['// 월요일 //'], mealList['// 화요일 //'], mealList['// 수요일 //'], mealList['// 목요일 //'], mealList['// 금요일 //'], = mealList['field1'], mealList['field2'], mealList['field3'], mealList['field4'], mealList['field5']
del(mealList['corner'], mealList['field1'], mealList['field2'], mealList['field3'], mealList['field4'], mealList['field5'])
for mealData in mealList.items():
strMessage += (f"{mealData[0]}\n{mealData[1]}\n")
strMessage = mealDate + "\n\n" + strMessage
return strMessage
def messageOff():
strMessage = "전기세 아깝다ㅡㅡ;;"
return strMessage
def messageOh():
randInt = random.randrange(0, 2)
strMessage = ""
if randInt == 0:
strMessage = "..레오"
elif randInt == 1:
strMessage = "..렌지쥬스"
return strMessage
def messageOutwork():
randInt = random.randrange(0, 3)
strMessage = ""
if randInt == 0:
strMessage = "출근하세요"
elif randInt == 1:
strMessage = "평생 쉬세요~"
elif randInt == 2:
strMessage = "집가고싶다"
return strMessage
def messageOho(message):
strMessage = message[::-1]
return strMessage
def messageOkay():
strMessage = "땡큐! 4딸라!"
return strMessage
def messageReal():
randInt = random.randrange(0, 2)
strMessage = ""
if randInt == 0:
strMessage = "ㄹㅇㅋㅋ"
elif randInt == 1:
strMessage = "아닌데요"
return strMessage
def messageRemember(message, room):
message = message.replace("!기억해", "").replace("!기억", "").strip()
if len(message) != 0:
if os.path.isfile("rem.json"):
with open('rem.json', 'r', encoding='utf-8') as f:
rem_dict = json.load(f)
else:
rem_dict = {}
rem_dict[room] = message
json_data = json.dumps(rem_dict, ensure_ascii=False, indent=4)
with open('rem.json', 'w', encoding='utf-8') as f:
f.write(json_data)
else:
pass
strMessage = ""
return strMessage
def messageRemreturn(room):
strMessage = ""
if os.path.isfile("rem.json"):
with open('rem.json', 'r', encoding='utf-8') as f:
rem_dict = json.load(f)
if room in rem_dict:
strMessage = rem_dict[room] + "\\m아마 이거일 듯?"
else:
strMessage = ""
else:
strMessage = ""
return strMessage
def messageSalute():
randInt = random.randrange(0, 2)
strMessage = ""
if randInt == 0:
strMessage = "필승! ^^7"
elif randInt == 1:
strMessage = "충성! ^^7"
return strMessage
def messageSaseyo():
randInt = random.randrange(0, 4)
strMessage = ""
if randInt == 0:
strMessage = "사세요"
elif randInt == 1:
strMessage = "안 사도 돼요"
elif randInt == 2:
strMessage = "나스는 역시 시놀로지죠~"
elif randInt == 3:
strMessage = "나스는 역시 큐냅이죠~"
return strMessage
def messageSeungbeomGraduate():
randInt = random.randrange(0, 3)
strMessage = ""
y, m, d = int(2024), int(2), int(15)
messageDateCalculator(y, m, d)
leftdays, lefthours, leftminutes, leftseconds, leftseconds_wa = messageDateCalculator(y, m, d)