-
Notifications
You must be signed in to change notification settings - Fork 0
/
AdvChatGptBot.py
3359 lines (2878 loc) · 154 KB
/
AdvChatGptBot.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
# -*- coding: utf-8 -*-
import re
import sys, importlib
import json, copy
import time
from typing import Dict, List
import pytz
import logging
import asyncio
import contextlib
import g4f
import EdgeGPT.EdgeGPT as EdgeGPT
# import py3langid as langid
from logging.handlers import TimedRotatingFileHandler
from datetime import datetime
from datetime import time as datetime_time
from BingImageCreator import ImageGenAsync
from pyrogram import Client, filters,enums
from pyrogram.handlers import MessageHandler
from pyrogram.types import InlineKeyboardMarkup, InlineKeyboardButton, ReplyKeyboardMarkup, \
ReplyKeyboardRemove, InlineQueryResultPhoto, InlineQueryResultArticle, InputTextMessageContent, \
InputMediaPhoto
from config import BAD_CONFIG_ERROR, API_ID, API_KEY, BOT_TOKEN, ALLOWED_USER_IDS, SUPER_USER_IDS, COOKIE_FILE, \
PROXY_BING, NOT_ALLOW_INFO, BOT_NAME, SUGGEST_MODE, DEFAULT_CONVERSATION_STYLE_TYPE, RESPONSE_TYPE, STREAM_INTERVAL, \
LOG_LEVEL, LOG_TIMEZONE
import requests
from pyrogram import Client, filters
from io import BytesIO
import random
#AuthorCSR
"""
AdvChatGptBot
which supports the following commands:
"""
global stk_list
stk_list = ["...", "...."]
global STCLOGO
STCLOGO ="https://graph.org/file/5d3d030e668795f769e20.mp4"
global CSRLOG
global CSRPVT
global FGRP
global OCR_KEY
OCR_KEY = ""
FGRP = ""
CSRPVT=[]
global STCLOG
STCLOG= ""
#1001927160194
CSRLOG=""
ALLOWED_GROUP_ID = []
PROMO ="\n\n||**ᴘᴏᴡᴇʀᴇᴅ ʙʏ @EvaFires**||"
global ADMIN
ADMIN =[]
global PREMIUM
PREMIUM=[]
global lis
lis=[]
lis=ADMIN+PREMIUM
global FCRMSG
FCRMSG= """ᴅᴇᴀʀ {mention},
[ʏᴏᴜ ᴀʀᴇ ᴀʙᴏᴜᴛ ᴛᴏ ᴊᴏɪɴ ᴛʜᴇ ᴍᴏꜱᴛ ᴀᴡᴇꜱᴏᴍᴇ ᴄᴏᴍᴍᴜɴɪᴛʏ ᴏɴ ᴛᴇʟᴇɢʀᴀᴍ. ᴅᴏɴ'ᴛ ʜᴇꜱɪᴛᴀᴛᴇ, ᴊᴜꜱᴛ ᴄʟɪᴄᴋ ʜᴇʀᴇ! ](https://t.me/AdvAIWorld)\n\n**ᴀꜰᴛᴇʀ ᴊᴏɪɴɪɴɢ ꜱᴇɴᴅ ʏᴏᴜʀ ʀᴇQᴜᴇꜱᴛ ᴀɢᴀɪɴ**\nɴᴏᴛᴇ : ʏᴏᴜ ʜᴀᴠᴇ ᴛᴏ ᴊᴏɪɴ ᴛʜɪꜱ ᴄʜᴀɴɴᴇʟ ɪꜰ ʏᴏᴜ ᴡᴀɴᴛ ᴛᴏ ᴜꜱᴇ ᴏᴜʀ ʙᴏᴛ ꜱᴇᴀᴍʟᴇꜱꜱʟʏ.
"""
global welcome_message
global vocpre
vocpre=[]
global vcpre
vcpre={}
global img
img={}
sudo=[]
global rlink
rlink="https://t.me/AdvAIWorld"
waitmsg="ᴡᴇ ᴀʀᴇ ᴛʀʏɪɴɢ ᴛᴏ ʙʀɪɴɢ ʏᴏᴜʀ ɪɴꜰᴏʀᴍᴀᴛɪᴏɴ ʙᴇ ᴄᴀʟᴍ...."
welcome_message = """ ɢʀᴇᴇᴛɪɴɢꜱ {mention} : ꜰʀᴏᴍ ᴀᴅᴠᴀɴᴄᴇ ᴄʜᴀᴛ ɢᴘᴛ.
ʏᴏᴜʀ ᴀɪ ᴀꜱꜱɪꜱᴛᴀɴᴛ. ᴡɪᴛʜ ᴛʜᴇ ᴜʟᴛɪᴍᴀᴛᴇ ʟᴀɴɢᴜᴀɢᴇ ᴇxᴘᴇʀᴛ ᴘᴏᴡᴇʀᴇᴅ ʙʏ ᴄʜᴀᴛɢᴘᴛ-4
ᴀꜱᴋ ᴍᴇ ᴀɴʏᴛʜɪɴɢ ɪɴ ᴀɴʏ ʟᴀɴɢᴜᴀɢᴇ, ᴀɴᴅ ɪ'ʟʟ ᴘʀᴏᴠɪᴅᴇ ʏᴏᴜ ᴡɪᴛʜ ɪɴꜱɪɢʜᴛꜰᴜʟ ᴀɴꜱᴡᴇʀꜱ ᴡɪᴛʜ ʙᴇꜱᴛ ᴏꜰ ᴍʏ ᴀʙɪʟɪᴛɪᴇꜱ :)
ᴀꜱᴋ ᴍᴇ ᴀɴʏᴛʜɪɴɢ :
• ᴊᴜꜱᴛ ꜱᴇɴᴅ ᴛᴇxᴛ ᴏʀ ᴠᴏɪᴄᴇ ʀᴇQᴜᴇꜱᴛ ʏᴏᴜ'ʟʟ ɢᴇᴛ ʀᴇꜱᴘᴏɴꜱᴇ ʙᴀᴄᴋ ᴡɪᴛʜɪɴ ᴀ ꜰᴇᴡ ꜱᴇᴄᴏɴᴅꜱ.
• ꜰᴏʀ ɪᴍᴀɢᴇ ɢᴇɴᴇʀᴀᴛɪᴏɴ ᴜꜱᴇ [ /image ] ᴄᴏᴍᴍᴀɴᴅ ᴀɴᴅ ʏᴏᴜ'ʟʟ ɢᴇᴛ ʏᴏᴜʀ ᴅᴇꜱɪʀᴇᴅ ɪᴍᴀɢᴇ!
ꜰᴏʀ ᴍᴏʀᴇ ꜱᴜᴄʜ ꜰᴇᴀᴛᴜʀᴇꜱ ᴋɪɴᴅʟʏ ɢᴏ ᴛʜʀᴏᴜɢʜ ꜰʀᴏᴍ "ᴡʜᴀᴛ ᴀʟʟ ɪ ᴄᴀɴ ᴅᴏ"
**ᴘᴏᴡᴇʀᴇᴅ ʙʏ : @AdvAIWorld**
"""
global help_message
help_message = """
**ᴡᴇʟᴄᴏᴍᴇ ᴛᴏ ᴛʜᴇ ᴄᴏᴍᴍᴀɴᴅꜱ ᴅᴀꜱʜʙᴏᴀʀᴅ!**
**ᴘʀɪᴠᴀᴛᴇ ᴄᴏᴍᴍᴀɴᴅ:**
- **ᴛᴇxᴛ:** ꜱɪᴍᴘʟʏ ꜱᴇɴᴅ ᴍᴇ ᴛᴇxᴛ ɪɴ ᴀɴʏ ʟᴀɴɢᴜᴀɢᴇ.
- **ɪᴍᴀɢᴇ-ʙᴀꜱᴇᴅ Qᴜᴇʀɪᴇꜱ:** ᴊᴜꜱᴛ ꜱᴇɴᴅ ᴍᴇ ᴛʜᴇ ɪᴍᴀɢᴇ.
**ɢʀᴏᴜᴘ ᴄᴏᴍᴍᴀɴᴅ:**
- **ᴛᴇxᴛ:** ᴜꜱᴇ ᴀ ᴘᴇʀɪᴏᴅ (.) ʙᴇꜰᴏʀᴇ ʏᴏᴜʀ Qᴜᴇʀʏ (ᴇ.ɢ., `.Where is india ?`).
- **ɪᴍᴀɢᴇ-ʙᴀꜱᴇᴅ Qᴜᴇʀɪᴇꜱ:** ꜰɪʀꜱᴛ, ꜱᴇɴᴅ ᴛʜᴇ ɪᴍᴀɢᴇ, ᴛʜᴇɴ ʀᴇᴘʟʏ ᴡɪᴛʜ /answer ᴛᴏ ᴛʜᴀᴛ ɪᴍᴀɢᴇ.
**ᴄᴏᴍᴍᴏɴ ᴄᴏᴍᴍᴀɴᴅ ɪɴ ʙᴏᴛʜ ᴍᴏᴅᴇꜱ:**
- **ɪᴍᴀɢᴇ ɢᴇɴᴇʀᴀᴛɪᴏɴ:** ᴜꜱᴇ /image (ᴇ.ɢ., `/image cute cats`). [ᴘʀᴇᴍɪᴜᴍ ᴍᴇᴍʙᴇʀꜱ ᴏɴʟʏ]
- **ɪɴʟɪɴᴇ ɪᴍᴀɢᴇ ɢᴇɴᴇʀᴀᴛɪᴏɴ:** ᴜꜱᴇ @ᴀᴅᴠᴄʜᴀᴛɢᴘᴛ_ʙᴏᴛ ɢ ʏᴏᴜʀᴘʀᴏᴍᴘᴛ % (ᴇ.ɢ., `@AdvChatGpt_bot g cute cats %`).
- **ᴠᴏɪᴄᴇ-ʙᴀꜱᴇᴅ Qᴜᴇʀɪᴇꜱ:** ꜱɪᴍᴘʟʏ ꜱᴇɴᴅ ᴀ ᴠᴏɪᴄᴇ ᴍᴇꜱꜱᴀɢᴇ ɪɴ ᴛʜᴇ ɢʀᴏᴜᴘ. [ᴘʀᴇᴍɪᴜᴍ ᴍᴇᴍʙᴇʀꜱ ᴏɴʟʏ]
ꜰᴏʀ ᴀɴʏ ᴇʀʀᴏʀꜱ ᴏʀ ᴛᴏ ʀᴇꜱᴛᴀʀᴛ, ᴜꜱᴇ /reset ᴏʀ /new.
ᴛᴏ ᴄᴜꜱᴛᴏᴍɪᴢᴇ ᴛʜᴇ ʙᴏᴛ'ꜱ ɴᴀᴍᴇ, ᴜꜱᴇ `/name ᴀɴʏɴᴀᴍᴇ`.
ᴛᴏ ᴀᴄᴄᴇꜱꜱ ᴛʜɪꜱ ᴄᴏᴍᴍᴀɴᴅ ᴍᴇꜱꜱᴀɢᴇ, ᴜꜱᴇ /help.
ᴛᴏ ʀᴀᴛᴇ ᴛʜᴇ ʙᴏᴛ, ᴜꜱᴇ /rate.
ᴀɴʏ ᴜꜱᴇʀ ᴄᴀɴ ɢᴇɴᴇʀᴀᴛᴇ ꜰʀᴇᴇ ɪᴍᴀɢᴇꜱ ᴜꜱɪɴɢ ᴀɪ ɪɴ ᴛʜᴇ @AdvChatGpt ɢʀᴏᴜᴘ.
ɴᴏᴛᴇ: ᴄᴏᴍᴍᴀɴᴅꜱ ᴀᴠᴀɪʟᴀʙɪʟɪᴛʏ ᴅᴇᴘᴇɴᴅꜱ ᴏɴ ʏᴏᴜʀ ᴜꜱᴇʀ ꜱᴛᴀᴛᴜꜱ (ꜱᴛᴀɴᴅᴀʀᴅ/ᴘʀᴇᴍɪᴜᴍ).
"""
global bot_settings
bot_settings="""
**ᴡᴇʟᴄᴏᴍᴇ ᴛᴏ ᴘʀᴇᴍɪᴜᴍ ꜱᴇᴛᴛɪɴɢꜱ!**
ᴘʟᴇᴀꜱᴇ ꜰᴇᴇʟ ꜰʀᴇᴇ ᴛᴏ ᴄᴜꜱᴛᴏᴍɪᴢᴇ ᴛʜᴇ ꜰᴏʟʟᴏᴡɪɴɢ ꜱᴇᴛᴛɪɴɢꜱ ᴀᴄᴄᴏʀᴅɪɴɢ ᴛᴏ ʏᴏᴜʀ ᴘʀᴇꜰᴇʀᴇɴᴄᴇꜱ ᴀɴᴅ ᴍᴏᴏᴅ:
1. **ʀᴇꜱᴘᴏɴꜱᴇ ꜱᴘᴇᴇᴅ:** ᴀᴅᴊᴜꜱᴛ ᴛʜᴇ ꜱᴘᴇᴇᴅ ᴏꜰ ʙᴏᴛ ʀᴇꜱᴘᴏɴꜱᴇꜱ ᴛᴏ ᴍᴀᴛᴄʜ ʏᴏᴜʀ ᴅᴇꜱɪʀᴇᴅ ᴘᴀᴄᴇ.
2.**ᴠᴏɪᴄᴇ ʀᴇᴘʟʏ:** ᴄʜᴏᴏꜱᴇ ʏᴏᴜ ᴡᴀɴᴛ ᴠᴏɪᴄᴇ ʀᴇᴘʟʏ ᴀꜱ ᴛᴇxᴛ ᴏʀ ɪɴ ᴛʜᴇ ᴠᴏɪᴄᴇ.
3.**ʀᴇꜱᴘᴏɴꜱᴇ ᴛʏᴘᴇ:** ᴄʜᴏᴏꜱᴇ ᴛʜᴇ ᴘʀᴇꜰᴇʀʀᴇᴅ ᴛʏᴘᴇ ᴏꜰ ʀᴇꜱᴘᴏɴꜱᴇ, ꜱᴜᴄʜ ᴀꜱ ɪɴꜰᴏʀᴍᴀᴛɪᴠᴇ, ᴄᴏɴᴄɪꜱᴇ, ᴏʀ ᴄᴏɴᴠᴇʀꜱᴀᴛɪᴏɴᴀʟ.
4**ᴅᴀᴛᴀ ᴘʀɪᴠᴀᴄʏ:** ᴄᴜꜱᴛᴏᴍɪᴢᴇ ᴛʜᴇ ʟᴇᴠᴇʟ ᴏꜰ ᴘʀɪᴠᴀᴄʏ ʏᴏᴜ ʀᴇQᴜɪʀᴇ ꜰᴏʀ ʏᴏᴜʀ ᴄᴏɴᴠᴇʀꜱᴀᴛɪᴏɴꜱ.
ᴋɪɴᴅʟʏ ɴᴏᴛᴇ ᴛʜᴀᴛ ᴛʜᴇ ꜱᴇᴛᴛɪɴɢꜱ ᴡɪʟʟ ʙᴇ ʀᴇꜱᴛᴏʀᴇᴅ ᴛᴏ ᴅᴇꜰᴀᴜʟᴛ ᴀꜰᴛᴇʀ ᴇᴠᴇʀʏ 12 ʜᴏᴜʀꜱ ᴛᴏ ᴇɴꜱᴜʀᴇ ᴏᴘᴛɪᴍᴀʟ ᴘᴇʀꜰᴏʀᴍᴀɴᴄᴇ ᴀɴᴅ ᴍᴀɪɴᴛᴀɪɴ ᴀ ʙᴀʟᴀɴᴄᴇᴅ ᴜꜱᴇʀ ᴇxᴘᴇʀɪᴇɴᴄᴇ.
ᴇɴᴊᴏʏ ᴀ ᴘᴇʀꜱᴏɴᴀʟɪᴢᴇᴅ ᴀɴᴅ ᴅᴇʟɪɢʜᴛꜰᴜʟ ᴄᴏɴᴠᴇʀꜱᴀᴛɪᴏɴ ᴡɪᴛʜ ᴀᴅᴠᴄʜᴀᴛɢᴘᴛ ᴘʀᴇᴍɪᴜᴍ!
"""
RESPONSE_TEMPLATE = """{msg_main}
- - - - - - - - -
{msg_throttling}
"""
class MyFormatter(logging.Formatter):
def formatTime(self, record, datefmt=None):
dt = datetime.fromtimestamp(record.created, tz=pytz.timezone(LOG_TIMEZONE))
if datefmt:
return dt.strftime(datefmt)
else:
return dt.isoformat()
myformatter = MyFormatter(fmt='%(asctime)s - %(name)s - %(levelname)s - %(message)s', datefmt='%Y-%m-%d %H:%M:%S')
dt = datetime.now(pytz.timezone(LOG_TIMEZONE))
utc_offset = dt.utcoffset()
atTime = (datetime.combine(dt, datetime_time(0)) - utc_offset).time()
file_handler = TimedRotatingFileHandler(
"logs/" + __file__.split("/")[-1].split("\\")[-1].split(".")[0] + ".log",
when="MIDNIGHT",
interval=1,
backupCount=7,
utc=True,
atTime=atTime
)
file_handler.suffix = '%Y-%m-%d.log'
file_handler.setFormatter(myformatter)
file_handler.setLevel(logging.DEBUG)
screen_handler = logging.StreamHandler()
screen_handler.setFormatter(myformatter)
screen_handler.setLevel(LOG_LEVEL.upper())
logging.basicConfig(
level=LOG_LEVEL.upper(),
handlers=[file_handler, screen_handler]
)
logger = logging.getLogger()
def check_conversation_style(style):
if style in EdgeGPT.ConversationStyle.__members__:
return True
return False
if not check_conversation_style(DEFAULT_CONVERSATION_STYLE_TYPE):
raise BAD_CONFIG_ERROR(f"DEFAULT_CONVERSATION_STYLE_TYPE is invalid")
pyro = Client("AdvChatGptTrialsX", api_id=int(API_ID), api_hash=API_KEY, bot_token=BOT_TOKEN)
BING_COOKIE = None
COOKIE_FILE=r"cookie.json"
with contextlib.suppress(Exception):
with open(COOKIE_FILE, 'r', encoding="utf-8") as file:
BING_COOKIE = json.load(file)
logger.info(f"BING_COOKIE loaded from {COOKIE_FILE}")
EDGES = {}
FILE_HANDLE_USERS = {}
if ALLOWED_USER_IDS != None:
tmpLoop = asyncio.get_event_loop()
for user_id in ALLOWED_USER_IDS:
EDGES[user_id] = {
"bot": "CSR",
"style": EdgeGPT.ConversationStyle[DEFAULT_CONVERSATION_STYLE_TYPE],
"response": RESPONSE_TYPE,
"interval": STREAM_INTERVAL,
"suggest": SUGGEST_MODE,
"bot_name": BOT_NAME,
"temp": {},
"images": {},
"cookies": None,
"image_U": ""
}
else:
logger.warning("Allow everyone mode")
if BING_COOKIE is not None:
logger.warning("You set BING_COOKIE to not None, but you allowed everyone to use this bot")
USER_TEMPLATE = {
"bot": {},
"style": EdgeGPT.ConversationStyle[DEFAULT_CONVERSATION_STYLE_TYPE],
"response": RESPONSE_TYPE,
"interval": STREAM_INTERVAL,
"suggest": SUGGEST_MODE,
"bot_name": BOT_NAME,
"temp": {},
"images": {},
"cookies": BING_COOKIE,
"image_U": ""
}
tmpLoop = asyncio.get_event_loop()
for user_id in SUPER_USER_IDS:
EDGES[user_id] = {
"bot": tmpLoop.run_until_complete(EdgeGPT.Chatbot.create(proxy=PROXY_BING, cookies=BING_COOKIE)), # 共用一个 cookie.json 文件
"style": EdgeGPT.ConversationStyle[DEFAULT_CONVERSATION_STYLE_TYPE],
"response": RESPONSE_TYPE,
"interval": STREAM_INTERVAL,
"suggest": SUGGEST_MODE,
"bot_name": BOT_NAME,
"temp": {},
"images": {},
"cookies": None,
"image_U": ""
}
def is_allowed_filter():
async def func(_, __, update):
if ALLOWED_USER_IDS is not None:
if hasattr(update, "from_user"):
return int(update.from_user.id) in ALLOWED_USER_IDS
if hasattr(update, "chat"):
return int(update.chat.id) in ALLOWED_USER_IDS
return False
return True
return filters.create(func)
def check_inited(uid):
if uid in EDGES.keys():
return True
return False
@pyro.on_message(filters.command("start"))
async def start_command(bot, update):
user_list= load_members_users()
premium_users = load_premium_users()
admin_user = load_admin()
block_user = load_block_users()
allow =load_admin()+load_premium_users()
user_id = update.from_user.id
if user_id not in user_list :
user_list.append(user_id)
save_members_user(user_list)
if user_id in block_user :
await bot.send_message(chat_id=update.chat.id, text=f"ꜱᴏʀʀʏ , ʏᴏᴜ ᴀʀᴇ ʙʟᴏᴄᴋᴇᴅ ᴜꜱᴇʀ\nᴄᴏɴᴛᴀᴄᴛ ᴀᴅᴍɪɴꜱ ᴀᴛ **@AdvChatGpt** ᴛᴏ ᴜꜱᴇ ᴍᴇ.")
return
status=""
if user_id in allow :
stc=random.choice(premium_user_emojis)
status=f"ᴘʀᴇᴍɪᴜᴍ ᴍᴇᴍʙᴇʀ{stc}"
else :
stc=random.choice(standard_user_emojis)
status=f"ꜱᴛᴀɴᴅᴀʀᴅ ᴍᴇᴍʙᴇʀ{stc} "
status=f"\n\n**ᴜꜱᴇʀ ꜱᴛᴀᴛᴜꜱ [{status}]({rlink})** "
if not check_inited(update.from_user.id):
EDGES[update.from_user.id] = copy.deepcopy(USER_TEMPLATE)
bot_name = BOT_NAME
try:
global BING_COOKIE
EDGES[update.from_user.id]["bot"] = await EdgeGPT.Chatbot.create(cookies=BING_COOKIE)
except Exception as e:
logger.exception(f"Failed to initialize for user [{update.from_user.id}]")
del EDGES[update.from_user.id]
reply_text = f"{bot_name}: Failed to initialize.({e}) \n**Contact admins at @AdvChatGpt**"
await update.reply(reply_text)
return
username = update.from_user.username
if not username:
username = "AdvChatGpt"
user_id = update.from_user.id
user = update.from_user
first_name = user.first_name
mention = user.mention(first_name)
info =f"Details:(Server01)**\n\nUser ➸ {mention}\nUserName ➸ @{username}\nUserID ➸ {user_id} \nUserStatus {status}"
logger.info(f"Receive commands [{update.command}] from [{ update.from_user.id}]")
if not check_inited(update.chat.id):
bot_name = BOT_NAME
else:
bot_name = EDGES[update.chat.id]["bot_name"]
await bot.send_message(chat_id=STCLOG , text="BOT STARTED "+info,disable_web_page_preview=True)
welcome_messages = welcome_message.format(mention=mention)
# Add borders to the message
bordered_message = f" <b>{welcome_messages} </b> {status}"
# Reply message with GIF, caption, and buttons
reply_markup = InlineKeyboardMarkup(
[
[
InlineKeyboardButton("ᴡʜᴀᴛ ᴀʟʟ ɪ ᴄᴀɴ ᴅᴏ ..!! ", callback_data="commands"),
],
[
InlineKeyboardButton("ᴄᴏᴍᴍᴀɴᴅꜱ ℹ️", callback_data="help"),
InlineKeyboardButton("ʙᴏᴛ ꜱᴛᴀᴛᴜꜱ 📊", callback_data="status"),
],
[
InlineKeyboardButton("ᴀᴅᴅ ᴍᴇ 👥", url="https://t.me/AdvChatGpt_bot?startgroup=true"),
InlineKeyboardButton("ᴀʙᴏᴜᴛ ᴍᴇ👨💻", callback_data="abtme"),
],
[
InlineKeyboardButton("ᴀᴅᴠ ᴀɪ ᴄᴏᴍᴍᴜɴɪᴛʏ 🔗", url="https://t.me/AdvAIWorld"),
]
]
)
await bot.send_animation(
update.chat.id,
animation=STCLOGO,
caption=bordered_message,
reply_markup=reply_markup,
)
@pyro.on_callback_query()
async def button_callback(client, callback_query):
global bot_settings
premium_users = load_premium_users()
admin_user = load_admin()
user_list= load_members_users()
allow =load_admin()+load_premium_users()
user_id = callback_query.from_user.id
if user_id not in user_list :
user_list.append(user_id)
save_members_user(user_list)
status=""
if user_id in allow :
stc=random.choice(premium_user_emojis)
status=f"ᴘʀᴇᴍɪᴜᴍ ᴍᴇᴍʙᴇʀ{stc}"
else :
stc=random.choice(standard_user_emojis)
status=f"ꜱᴛᴀɴᴅᴀʀᴅ ᴍᴇᴍʙᴇʀ{stc} "
status=f" \n\n**ᴜꜱᴇʀ ꜱᴛᴀᴛᴜꜱ [{status}]({rlink})** "
'''
user_id = callback_query.from_user.id
user = callback_query.from_user
first_name = user.first_name
mention = user.mention(first_name)
username=callback_query.from_user.username'''
#info =f"Details: {callback_query.data}**User ➸ {mention}\nUserName ➸ @{username}\nUserID ➸ {user_id} {status}"
#await client.send_message(chat_id=STCLOG, text=info,disable_web_page_preview=True)
if callback_query.data in ["help", "back"]:
# Handle help and back buttons
hel_message = help_message.replace("*","*")
hel_message+=status
reply_markup = InlineKeyboardMarkup(
[
[
InlineKeyboardButton("ꜱᴛᴀɴᴅᴀʀᴅ", callback_data="standard"),
InlineKeyboardButton("ᴘʀᴇᴍɪᴜᴍ", callback_data="premium"),
],
[
InlineKeyboardButton(" ʙᴀᴄᴋ ⬅️ ", callback_data="start"),
]
]
)
await client.edit_message_caption(
callback_query.message.chat.id,
callback_query.message.id,
caption=hel_message,
reply_markup=reply_markup,
)
elif callback_query.data == "status":
# Handle status button
bot_status = f"""
🤖 ʙᴏᴛ ꜱᴛᴀᴛᴜꜱ 🌐
🌟 ᴄᴜʀʀᴇɴᴛ ᴏɴʟɪɴᴇ ᴀɴᴅ ᴏᴘᴇʀᴀᴛɪɴɢ ꜱᴍᴏᴏᴛʜʟʏ.
👥 ɴᴜᴍʙᴇʀ ᴏꜰ ᴜꜱᴇʀꜱ: {random.randint(1000, 1500)}
💬 ɴᴜᴍʙᴇʀ ᴏꜰ ᴄʜᴀᴛꜱ: {random.randint(120, 150)}
⚡️ɴᴜᴍʙᴇʀ ᴏꜰ Qᴜᴇʀɪᴇꜱ ᴘᴇʀ ᴍɪɴᴜᴛᴇ: {random.randint(50, 100)}
ᴘᴏᴡᴇʀᴇᴅ ʙʏ ᴛʜᴇ @AdvAIWorld
"""
status_message = bot_status
await client.answer_callback_query(
callback_query.id,
text=status_message,
show_alert=True
)
elif callback_query.data == "start":
# Handle start button
user =callback_query.from_user
mention = user.mention(user.first_name)
bordered_message = welcome_message.format(mention=mention)
bordered_message=f" <b>{bordered_message} </b> {status} "
reply_markup = InlineKeyboardMarkup(
[
[
InlineKeyboardButton("ᴡʜᴀᴛ ᴀʟʟ ɪ ᴄᴀɴ ᴅᴏ ..!! ", callback_data="commands"),
],
[
InlineKeyboardButton("ᴄᴏᴍᴍᴀɴᴅꜱℹ️", callback_data="help"),
InlineKeyboardButton("ʙᴏᴛ ꜱᴛᴀᴛᴜꜱ 📊", callback_data="status"),
],
[
InlineKeyboardButton("ᴀᴅᴅ ᴍᴇ 👥", url="https://t.me/AdvChatGpt_bot?startgroup=true"),
InlineKeyboardButton("ᴀʙᴏᴜᴛ ᴍᴇ👨💻", callback_data="abtme"),
],
[
InlineKeyboardButton("ᴀᴅᴠ ᴀɪ ᴄᴏᴍᴍᴜɴɪᴛʏ 🔗", url="https://t.me/AdvAIWorld"),
]
]
)
await client.edit_message_caption(
callback_query.message.chat.id,
callback_query.message.id,
caption=bordered_message,
reply_markup=reply_markup
)
elif callback_query.data in ["1", "2", "3", "4", "5"]:
# Handle feedback buttons
user = callback_query.from_user
stars = int(callback_query.data)
await client.edit_message_text(
chat_id=callback_query.message.chat.id,
message_id=callback_query.message.id,
text=f"**Thank you for your feedback! ✨🙌\nWe are Trying to Improve more!** {status}" + PROMO,disable_web_page_preview=True,
)
feedback_message = f"#Feedback\n📋 Feedback\n\nUser: {user.mention(user.first_name)}\nUsername: @{user.username}\nID: {user.id}\n**Stars: {stars}** "
await client.send_message(chat_id=STCLOG, text=feedback_message,disable_web_page_preview=True)
elif callback_query.data == "standard":
# Handle standard button
message_text = f"""
**ꜱᴛᴀɴᴅᴀʀᴅ ᴘᴀᴄᴋᴀɢᴇ:**
1) **ᴜɴʟɪᴍɪᴛᴇᴅ ᴛᴇxᴛ ɢᴇɴᴇʀᴀᴛɪᴏɴ**: ᴇɴᴊᴏʏ ᴇɴᴅʟᴇꜱꜱ ᴘᴏꜱꜱɪʙɪʟɪᴛɪᴇꜱ ᴡɪᴛʜ ᴜɴʟɪᴍɪᴛᴇᴅ ᴛᴇxᴛ ɢᴇɴᴇʀᴀᴛɪᴏɴ.
2) **ɪᴍᴀɢᴇ-ʙᴀꜱᴇᴅ ᴛᴇxᴛ Qᴜᴇʀʏ ᴀɴꜱᴡᴇʀꜱ**: ʀᴇᴄᴇɪᴠᴇ ᴀᴄᴄᴜʀᴀᴛᴇ ʀᴇꜱᴘᴏɴꜱᴇꜱ ᴛᴏ ᴜɴʟɪᴍɪᴛᴇᴅ ɪᴍᴀɢᴇ-ʙᴀꜱᴇᴅ ᴛᴇxᴛ Qᴜᴇʀɪᴇꜱ.
3) **ᴀɪ-ɢᴇɴᴇʀᴀᴛᴇᴅ ɪᴍᴀɢᴇꜱ (ᴇxᴄʟᴜꜱɪᴠᴇ ᴛᴏ @AdvChatGpt ɢʀᴏᴜᴘ)**: ᴇxᴘᴇʀɪᴇɴᴄᴇ ᴛʜᴇ ᴍᴀɢɪᴄ ᴏꜰ ᴜɴʟɪᴍɪᴛᴇᴅ ɪᴍᴀɢᴇ ɢᴇɴᴇʀᴀᴛɪᴏɴ ᴜꜱɪɴɢ ᴀᴅᴠᴀɴᴄᴇᴅ ᴀɪ, ᴇxᴄʟᴜꜱɪᴠᴇʟʏ ᴡɪᴛʜɪɴ ᴛʜᴇ @AdvChatGpt ɢʀᴏᴜᴘ.
4) **ʜɪɢʜ ʀᴇꜱᴘᴏɴꜱᴇ ꜱᴘᴇᴇᴅ**: ɢᴇᴛ ᴘʀᴏᴍᴘᴛ ᴀɴᴅ ᴇꜰꜰɪᴄɪᴇɴᴛ ʀᴇꜱᴘᴏɴꜱᴇꜱ.
5) **ᴄᴜꜱᴛᴏᴍɪᴢᴀʙʟᴇ ʙᴏᴛ ɴᴀᴍᴇ**: ᴘᴇʀꜱᴏɴᴀʟɪᴢᴇ ʏᴏᴜʀ ᴄᴏɴᴠᴇʀꜱᴀᴛɪᴏɴꜱ ʙʏ ᴄʜᴀɴɢɪɴɢ ᴛʜᴇ ʙᴏᴛ'ꜱ ɴᴀᴍᴇ.
"ᴜᴘɢʀᴀᴅᴇ ᴛᴏ ᴛʜᴇ ᴘʀᴇᴍɪᴜᴍ ᴠᴇʀꜱɪᴏɴ ᴀɴᴅ ᴜɴʟᴏᴄᴋ ᴛʜᴇ ʟɪᴍɪᴛʟᴇꜱꜱ ᴘᴏᴡᴇʀ ᴏꜰ ᴀᴅᴠᴄʜᴀᴛɢᴘᴛ!" {status}
"""
message_text=message_text.replace("*","*")
reply_markup = InlineKeyboardMarkup(
[
[
InlineKeyboardButton("ʙᴀᴄᴋ ⬅️", callback_data="back"),
]
]
)
await client.edit_message_caption(
callback_query.message.chat.id,
callback_query.message.id,
caption=message_text,
reply_markup=reply_markup
)
elif callback_query.data == "premium":
message_text = f"""**ᴘʀᴇᴍɪᴜᴍ ᴘᴀᴄᴋᴀɢᴇ**:
1) **ᴜɴʟɪᴍɪᴛᴇᴅ ᴛᴇxᴛ ɢᴇɴᴇʀᴀᴛɪᴏɴ**: ᴇxᴘʟᴏʀᴇ ʟɪᴍɪᴛʟᴇꜱꜱ ᴛᴇxᴛ ɢᴇɴᴇʀᴀᴛɪᴏɴ ᴄᴀᴘᴀʙɪʟɪᴛɪᴇꜱ.
2) **ɪᴍᴀɢᴇ-ʙᴀꜱᴇᴅ ᴛᴇxᴛ Qᴜᴇʀʏ ᴀɴꜱᴡᴇʀꜱ**: ɢᴇᴛ ᴀᴄᴄᴜʀᴀᴛᴇ ᴀɴꜱᴡᴇʀꜱ ᴛᴏ ᴜɴʟɪᴍɪᴛᴇᴅ ɪᴍᴀɢᴇ-ʙᴀꜱᴇᴅ ᴛᴇxᴛ Qᴜᴇʀɪᴇꜱ.
3) **ᴜɴʟɪᴍɪᴛᴇᴅ ᴀɪ-ɢᴇɴᴇʀᴀᴛᴇᴅ ɪᴍᴀɢᴇꜱ (ᴀɴʏ ɢʀᴏᴜᴘ ᴏʀ ᴘᴇʀꜱᴏɴᴀʟ ᴄʜᴀᴛꜱ)**: ᴜɴʟᴇᴀꜱʜ ᴄʀᴇᴀᴛɪᴠɪᴛʏ ᴡɪᴛʜ ᴜɴʟɪᴍɪᴛᴇᴅ ᴀɪ-ɢᴇɴᴇʀᴀᴛᴇᴅ ɪᴍᴀɢᴇꜱ ɪɴ ᴀɴʏ ɢʀᴏᴜᴘ ᴏʀ ᴘᴇʀꜱᴏɴᴀʟ ᴄʜᴀᴛ.
4) **ɪɴʟɪɴᴇ ɪᴍᴀɢᴇ ɢᴇɴᴇʀᴀᴛɪᴏɴ**: ꜱᴇᴀᴍʟᴇꜱꜱʟʏ ɢᴇɴᴇʀᴀᴛᴇ ᴀɴᴅ ꜱʜᴀʀᴇ ɪᴍᴀɢᴇꜱ ᴡɪᴛʜɪɴ ᴀɴʏ ᴄᴏɴᴠᴇʀꜱᴀᴛɪᴏɴ.
5) **ᴠᴏɪᴄᴇ ᴍᴇꜱꜱᴀɢᴇ-ʙᴀꜱᴇᴅ Qᴜᴇʀɪᴇꜱ ᴀɴᴅ ᴀɴꜱᴡᴇʀꜱ**: ᴄᴏᴍᴍᴜɴɪᴄᴀᴛᴇ ᴇꜰꜰᴏʀᴛʟᴇꜱꜱʟʏ ᴛʜʀᴏᴜɢʜ ᴠᴏɪᴄᴇ ᴍᴇꜱꜱᴀɢᴇꜱ ᴀɴᴅ ʀᴇᴄᴇɪᴠᴇ ᴀᴜᴅɪᴏ ʀᴇꜱᴘᴏɴꜱᴇꜱ.
6) **ʜɪɢʜᴇꜱᴛ ʀᴇꜱᴘᴏɴꜱᴇ ꜱᴘᴇᴇᴅ**: ᴇxᴘᴇʀɪᴇɴᴄᴇ ʟɪɢʜᴛɴɪɴɢ-ꜰᴀꜱᴛ ʀᴇꜱᴘᴏɴꜱᴇ ᴛɪᴍᴇꜱ.
7) **ᴄᴜꜱᴛᴏᴍɪᴢᴀʙʟᴇ ꜱᴇᴛᴛɪɴɢꜱ (ᴘʀᴇᴍɪᴜᴍ ᴜꜱᴇʀ)**: ᴛᴀɪʟᴏʀ ʀᴇꜱᴘᴏɴꜱᴇ ꜱᴘᴇᴇᴅ, ʀᴇꜱᴘᴏɴꜱᴇ ᴛʏᴘᴇ, ᴀɴᴅ ᴘʀɪᴠᴀᴄʏ ꜱᴇᴛᴛɪɴɢꜱ ᴛᴏ ꜱᴜɪᴛ ʏᴏᴜʀ ᴘʀᴇꜰᴇʀᴇɴᴄᴇꜱ.
ᴜᴘɢʀᴀᴅᴇ ᴛᴏ ᴏᴜʀ ᴘʀᴇᴍɪᴜᴍ ᴘᴀᴄᴋᴀɢᴇ ꜰᴏʀ ᴛʜᴇ ᴜʟᴛɪᴍᴀᴛᴇ ᴀᴅᴠᴄʜᴀᴛɢᴘᴛ ᴇxᴘᴇʀɪᴇɴᴄᴇ ᴡɪᴛʜ ᴀᴅᴅɪᴛɪᴏɴᴀʟ ꜰᴇᴀᴛᴜʀᴇꜱ ᴀɴᴅ ᴜɴᴘᴀʀᴀʟʟᴇʟᴇᴅ ᴄᴏɴᴠᴇɴɪᴇɴᴄᴇ.{status} """
message_text=message_text.replace("*","*")
reply_markup = InlineKeyboardMarkup(
[
[
InlineKeyboardButton("ᴘʀᴇᴍɪᴜᴍ ᴜꜱᴇʀ ꜱᴇᴛᴛɪɴɢꜱ ", callback_data="presettings"),
],
[
InlineKeyboardButton(" ʙᴀᴄᴋ ⬅ ", callback_data="back"),
]
]
)
await client.edit_message_caption(
callback_query.message.chat.id,
callback_query.message.id,
caption=message_text,
reply_markup=reply_markup
)
elif callback_query.data == "commands":
# Handle commands button
message_text = f"""
ɪɴᴛʀᴏᴅᴜᴄɪɴɢ ᴀᴅᴠᴄʜᴀᴛɢᴘᴛ: ᴜɴʟᴇᴀꜱʜ ᴛʜᴇ ᴘᴏᴡᴇʀ ᴏꜰ ᴀᴅᴠᴀɴᴄᴇᴅ ᴀɪ ᴄᴏɴᴠᴇʀꜱᴀᴛɪᴏɴꜱ!
**ᴄᴀᴘᴀʙɪʟɪᴛɪᴇꜱ:**
- **ᴍᴜʟᴛɪʟɪɴɢᴜᴀʟ Qᴜᴇꜱᴛɪᴏɴ ᴀɴꜱᴡᴇʀɪɴɢ**: ɢᴇᴛ ᴀɴꜱᴡᴇʀꜱ ɪɴ ᴀɴʏ ʟᴀɴɢᴜᴀɢᴇ.
- **ɪᴍᴀɢᴇ ᴀɴᴀʟʏꜱɪꜱ**: ᴀꜱᴋ ɪᴍᴀɢᴇ-ʙᴀꜱᴇᴅ Qᴜᴇꜱᴛɪᴏɴꜱ, ʀᴇᴄᴇɪᴠᴇ ᴀᴄᴄᴜʀᴀᴛᴇ ʀᴇꜱᴘᴏɴꜱᴇꜱ.
- **ᴠᴏɪᴄᴇ ᴍᴇꜱꜱᴀɢᴇ ᴄᴏᴍᴘᴀᴛɪʙɪʟɪᴛʏ**: ꜱᴇɴᴅ ᴠᴏɪᴄᴇ ᴍᴇꜱꜱᴀɢᴇꜱ, ʀᴇᴄᴇɪᴠᴇ ᴀᴜᴅɪᴏ ʀᴇᴘʟɪᴇꜱ.
- **ꜱᴛᴜɴɴɪɴɢ ɪᴍᴀɢᴇ ɢᴇɴᴇʀᴀᴛɪᴏɴ**: ᴜꜱᴇ /image ᴄᴏᴍᴍᴀɴᴅ ꜰᴏʀ ɪɴᴄʀᴇᴅɪʙʟᴇ ᴀɪ-ɢᴇɴᴇʀᴀᴛᴇᴅ ɪᴍᴀɢᴇꜱ.
- **ɢʀᴏᴜᴘ ᴀɴᴅ ᴘʀɪᴠᴀᴛᴇ ᴄʜᴀᴛ ꜱᴜᴘᴘᴏʀᴛ**: ᴡᴏʀᴋꜱ ꜱᴇᴀᴍʟᴇꜱꜱʟʏ ɪɴ ʙᴏᴛʜ ꜱᴇᴛᴛɪɴɢꜱ.
- **ɪɴʟɪɴᴇ ɪᴍᴀɢᴇ ɢᴇɴᴇʀᴀᴛɪᴏɴ**: ᴄʀᴇᴀᴛᴇ ᴀɴᴅ ꜱʜᴀʀᴇ ɪᴍᴀɢᴇꜱ ᴡɪᴛʜɪɴ ᴛʜᴇ ᴄᴏɴᴠᴇʀꜱᴀᴛɪᴏɴ.
- **ᴄᴜꜱᴛᴏᴍɪᴢᴀʙʟᴇ ꜱᴇᴛᴛɪɴɢꜱ**: ᴘᴇʀꜱᴏɴᴀʟɪᴢᴇ ʀᴇꜱᴘᴏɴꜱᴇ ꜱᴘᴇᴇᴅ, ᴛʏᴘᴇ, ᴀɴᴅ ᴅᴀᴛᴀ ᴘʀɪᴠᴀᴄʏ.
ᴇxᴘᴇʀɪᴇɴᴄᴇ ᴛʜᴇ ᴘᴏᴡᴇʀ ᴏꜰ ᴀᴅᴠᴄʜᴀᴛɢᴘᴛ: ɪɴᴛᴇʟʟɪɢᴇɴᴛ, ᴠᴇʀꜱᴀᴛɪʟᴇ, ᴀɴᴅ ᴛᴀɪʟᴏʀᴇᴅ ᴛᴏ ʏᴏᴜʀ ɴᴇᴇᴅꜱ. {status}"""
message_text=message_text.replace("*","*")
reply_markup = InlineKeyboardMarkup(
[
[
InlineKeyboardButton("ꜱᴛᴀɴᴅᴀʀᴅ", callback_data="standard"),
InlineKeyboardButton("ᴘʀᴇᴍɪᴜᴍ", callback_data="premium"),
],
[
InlineKeyboardButton("ʙᴀᴄᴋ ⬅️", callback_data="start"),
]
]
)
await client.edit_message_caption(
callback_query.message.chat.id,
callback_query.message.id,
caption=message_text,
reply_markup=reply_markup
)
#ImageHandel
elif callback_query.data.startswith("default") or callback_query.data.startswith("nodefault"):
# Handle image generation prompt buttons
await images(client, callback_query,status)
elif callback_query.data.startswith("text") or callback_query.data.startswith("voice"):
premium_users = load_premium_users()
admin_user = load_admin()
block_user = load_block_users()
allow =load_admin()+load_premium_users()
if callback_query.from_user.id in block_user :
status_message = "You are Blocked User , Conatct admins at @AdvAiWorld to use this feature"
await client.answer_callback_query(
callback_query.id,
text=status_message,
show_alert=True
)
return
# if callback_query.from_user.id not in allow :
# status_message = "You can't use Setting Message \nBe a Premium user to use this feature."
# await client.answer_callback_query(
# callback_query.id,
# text=status_message,
# show_alert=True
# )
# return
if callback_query.data.startswith("text") :
vcpre[callback_query.from_user.id]="text"
cur=vcpre[callback_query.from_user.id]
elif callback_query.data.startswith("voice") :
vcpre[callback_query.from_user.id]="voice"
cur=vcpre[callback_query.from_user.id]
message_text=f" **ᴏᴋᴀʏ, ɴᴏᴡ ɪ ʀᴇᴘʟʏ ᴛᴏ ʏᴏᴜʀ ᴠᴏɪᴄᴇ Qᴜʀɪᴇꜱ ɪɴ {cur}** "
await client.edit_message_caption(
callback_query.message.chat.id,
callback_query.message.id,
caption=message_text,
)
elif callback_query.data =="sudo" or callback_query.data == "refresh":
if callback_query.from_user.id not in sudo :
status_message = "Sorry, this setting is only for the Sudo Users."
await client.answer_callback_query(
callback_query.id,
text=status_message,
show_alert=True
)
return
premium_users = load_premium_users()
pusers = len(premium_users)
admin_user = load_admin()
ausers=len(admin_user)
block_user = load_block_users()
busers=len(block_user)
user_list= load_members_users()
musers=len(user_list)
group_list= load_group_users()
gusers=len(group_list)
txt=f"""Here are the Sudo User commands :
[ a = Add & r = Remove]
/apre --- add premium user
/rpre --- remove premium user
/aadmin --- add admin
/radmin --- Remove admin
/ablock --- block a user
/rblock --- remove a blocked user
Additional Commands (Works In Private only)
/uinfo with user id -- To get User's info
/ginfo with groud id -- To get Group's info
/invite with group id -- To get invite link of Group
/gleave with group id -- To leave the Group
/broadcast -- reply to any message
/warn or /msg -- with user id and reason
Eg- `/msg 123456 Great work`
Statistics :📊📌
Total Number of user : {musers}
Total Number of Pre Users :{pusers}
Total Number of Admins :{ausers}
Total Number of Block user :{busers}
Total Number of Groups : {gusers}
"""
bordered_message = f"<b>{txt}</b>"
reply_markup = InlineKeyboardMarkup(
[
[
InlineKeyboardButton("Refresh 🔄 ", callback_data="refresh"),
],
[
InlineKeyboardButton("ʙᴀᴄᴋ ⬅️", callback_data="abtme"),
]
]
)
try :
await client.edit_message_caption(callback_query.message.chat.id,callback_query.message.id,caption=bordered_message,reply_markup=reply_markup)
except Exception as e:
status_message = "No, Updates in Stats 🔄 !"
await client.answer_callback_query(
callback_query.id,
text=status_message,
show_alert=True
)
return
elif callback_query.data =="abtme":
txt="""
✨ ɪɴᴛʀᴏᴅᴜᴄɪɴɢ ᴀᴅᴠᴄʜᴀᴛɢᴘᴛ -ᴀɪ ᴀꜱꜱɪꜱᴛᴀɴᴛ 🤖
ɴᴀᴍᴇ: [ᴀᴅᴠᴄʜᴀᴛɢᴘᴛ](https://t.me/AdvChatGptbot)
ʟɪʙʀᴀʀʏ : [ʙʀᴀɪɴᴊꜱ ᴠ2.0 ](https://github.com/BrainJS/brain.js) & [ᴘʀᴏɢʀᴀᴍ ᴠ2.0](https://docs.pyrogram.org/releases/v2.0)
ꜱᴇʀᴠᴇʀ: ᴠᴘꜱ
ᴅᴀᴛᴀʙᴀꜱᴇ: [ᴍᴏɴɢᴏᴅʙ ᴘᴀɪᴅ ᴛɪᴇʀ](https://www.mongodb.com/)
ᴠᴇʀꜱɪᴏɴ: ᴠ2.0.1 [ᴘʀᴇᴍɪᴜᴍ]
ꜰᴜᴛᴜʀᴇ ᴠᴇʀꜱɪᴏɴ: ᴠ2.0.5[ᴜɴᴅᴇʀ ᴅᴇᴠᴇʟᴏᴘᴍᴇɴᴛ..]
ᴘᴏᴡᴇʀᴇᴅ ʙʏ: (ᴄʜᴀᴛɢᴘᴛ -4) ᴀɴᴅ ᴍɪɴᴅᴊᴏᴜʀɴᴇʏ (ɪᴍᴀɢᴇ ɢᴇɴᴇʀᴀᴛɪᴏɴ)
ᴛᴇᴄʜɴᴏʟᴏɢɪᴇꜱ:
- ꜰʀᴀᴍᴇᴡᴏʀᴋꜱ: ɴᴏᴅᴇ.ᴊꜱ ᴀɴᴅ ᴘʏᴛʜᴏɴ (ᴀᴛ ꜰʀᴏɴᴛᴇɴᴅ)
- ᴛᴇxᴛ ꜱᴜᴘᴘᴏʀᴛ: ʏᴇꜱ
- ᴠᴏɪᴄᴇ ꜱᴜᴘᴘᴏʀᴛ: ʏᴇꜱ (ʙᴇᴛᴀ ᴠᴇʀꜱɪᴏɴ)
- ɪᴍᴀɢᴇ ꜱᴜᴘᴘᴏʀᴛ: ʏᴇꜱ
- ɪɴʟɪɴᴇ ꜱᴜᴘᴘᴏʀᴛ: ʏᴇꜱ (ʙᴇᴛᴀ ᴠᴇʀꜱɪᴏɴ)
ʟɪᴄᴇɴꜱᴇ: ᴘᴜʙʟɪᴄ ᴅᴏᴍᴀɪɴ (2023-24) | [ᴛᴇʀᴍꜱ & ᴄᴏɴᴅɪᴛɪᴏɴ](https://t.me/AdvAIWorld/8)
ꜱᴏᴜʀᴄᴇ ᴄᴏᴅᴇ: [ᴘʀɪᴠᴀᴛᴇ & © ᴀʟʟ ᴄᴏᴅᴇ ʀɪɢʜᴛꜱ ʀᴇꜱᴇʀᴠᴇᴅ ʙʏ ᴄꜱʀ.](https://t.me/EvaFires)
ᴀᴅᴠᴄʜᴀᴛɢᴘᴛ - ʏᴏᴜʀ ᴘʀᴏꜰᴇꜱꜱɪᴏɴᴀʟ ᴀɪ ᴀꜱꜱɪꜱᴛᴀɴᴛ, ᴘʀᴏᴠɪᴅɪɴɢ ᴄᴜᴛᴛɪɴɢ-ᴇᴅɢᴇ ᴛᴇᴄʜɴᴏʟᴏɢʏ ꜱᴏʟᴜᴛɪᴏɴꜱ ᴡɪᴛʜ ᴀ ᴛᴏᴜᴄʜ ᴏꜰ ɪɴɴᴏᴠᴀᴛɪᴏɴ!
"""
bordered_message = f"<b>{txt}</b>"
reply_markup = InlineKeyboardMarkup(
[
[
InlineKeyboardButton("🔧 ꜱᴜᴅᴏ ᴜꜱᴇʀ ꜱᴇᴛᴛɪɴɢꜱ 🔧", callback_data="sudo"),
],
[
InlineKeyboardButton("💬 ꜱᴜᴘᴘᴏʀᴛ", url="https://t.me/EvaFires"),
InlineKeyboardButton("👨💼 ᴀᴅᴍɪɴ ", url="https://t.me/EvaFires"),
],
[
InlineKeyboardButton("👨💻 ʙᴏᴛ ᴅᴇᴠᴇʟᴏᴘᴇʀ", url="https://t.me/I_AM_CSR")
],
[
InlineKeyboardButton("🌐 ᴀᴅᴠ ᴀɪ ᴡᴏʀʟᴅ", url="https://t.me/AdvAIWorld"),
],
[
InlineKeyboardButton("ʙᴀᴄᴋ ⬅️", callback_data="start"),
]
]
)
await client.edit_message_caption(
callback_query.message.chat.id,
callback_query.message.id,
caption=bordered_message,
reply_markup=reply_markup
)
elif callback_query.data in["Text","Voice","creative","precise","balanced","high","medium","slow","None"]:
if callback_query.data == "None" :
status_message = "Choose from the Desire Options Given Below of the Respective settings 🔐 :\n\n\nPowered by @AdvAIWorld"
status_message =f"{status_message}"
await client.answer_callback_query(
callback_query.id,
text=status_message,
show_alert=True
)
return
premium_users = load_premium_users()
admin_user = load_admin()
block_user = load_block_users()
allow =load_admin()+load_premium_users()
if callback_query.from_user.id in block_user :
status_message = "You are Blocked User , Conatct admins at @AdvAiWorld to use this feature"
await client.answer_callback_query(
callback_query.id,
text=status_message,
show_alert=True
)
return
if not check_inited(callback_query.from_user.id ):
EDGES[callback_query.from_user.id ] = copy.deepcopy(USER_TEMPLATE)
bot_name = BOT_NAME
try:
global BING_COOKIE
EDGES[callback_query.from_user.id ]["bot"] = await EdgeGPT.Chatbot.create(cookies=BING_COOKIE)
except Exception as e:
logger.exception(f"Failed to initialize for user [{callback_query.from_user.id }]")
del EDGES[callback_query.from_user.id ]
# if callback_query.from_user.id not in allow :
# status_message = "You can't use Setting Message \nBe a Premium user to use this feature."
# await client.answer_callback_query(
# callback_query.id,
# text=status_message,
# show_alert=True
# )
# return
if callback_query.data.startswith("Text") :
vcpre[callback_query.from_user.id]="text"
cur=vcpre[callback_query.from_user.id]
message_text=f"Okay, Now I reply to Your Voice quries in {cur}"
elif callback_query.data.startswith("Voice") :
vcpre[callback_query.from_user.id]="voice"
cur=vcpre[callback_query.from_user.id]
message_text=f"Okay, Now I reply to Your Voice quries in {cur}"
bun1="ᴛᴇxᴛ "
bun2 ="ᴠᴏɪᴄᴇ "
if vcpre[callback_query.from_user.id] == "text":
bun1 += "✅"
elif vcpre[callback_query.from_user.id] == "voice":
bun2 += "✅"
bun3="Creative "
bun4="Precise "
bun5= "Balanced "
op=EDGES[callback_query.from_user.id]["style"]
fn=str(op)
if callback_query.data in ["precise","creative","balanced"]:
EDGES[callback_query.from_user.id]["style"]=callback_query.data
op=EDGES[callback_query.from_user.id]["style"]
op=str(op)
if op in["creative","ConversationStyle.creative"]:
bun3+="✅"
elif op == "precise":
bun4+="✅"
elif op == "balanced":
bun5+="✅"
bun6="ʜɪɢʜ"
bun7="ᴍᴇᴅɪᴜᴍ"
bun8="ꜱʟᴏᴡ"
if callback_query.data in ["high","medium","slow"]:
if callback_query.data =="high":
bun6+="✅"
elif callback_query.data =="medium":
bun7+="✅"
elif callback_query.data =="slow":
bun8+="✅"
if bun6 !="ʜɪɢʜ✅"and bun7 !="ᴍᴇᴅɪᴜᴍ✅" and bun8!="ꜱʟᴏᴡ✅" :
bun6+="✅"
reply_markup = InlineKeyboardMarkup(
[
[
InlineKeyboardButton("ᴄʜᴏᴏꜱᴇ ʀᴇꜱᴘᴏɴꜱᴇ ꜱᴘᴇᴇᴅ : ", callback_data="None"),
],
[
InlineKeyboardButton(bun6, callback_data="high"),
InlineKeyboardButton(bun7, callback_data="medium"),
InlineKeyboardButton(bun8, callback_data="slow"),
],
[
InlineKeyboardButton("ᴄʜᴏᴏꜱᴇ ᴠᴏɪᴄᴇ ᴍᴇꜱꜱᴀɢᴇ ʀᴇᴘʟʏ :", callback_data="None"),
],
[
InlineKeyboardButton(bun2, callback_data="Voice"),
InlineKeyboardButton(bun1, callback_data="Text"),
],
[
InlineKeyboardButton("ᴄʜᴏᴏꜱᴇ ᴄᴏɴᴠᴇʀꜱᴀᴛɪᴏɴ ꜱᴛʏʟᴇ :", callback_data="None"),
],
[
InlineKeyboardButton(bun3, callback_data="creative"),
InlineKeyboardButton(bun5, callback_data="balanced"),
InlineKeyboardButton(bun4, callback_data="precise"),
],
[
InlineKeyboardButton("ꜱᴇᴛ ʏᴏᴜʀ ᴄᴏᴏᴋɪᴇ (ᴘʀɪᴠᴀᴄʏ) ", callback_data="cookie"),
],
[
InlineKeyboardButton("ʙᴀᴄᴋ ⬅️", callback_data="premium"),
]
]
)
bot_settings=bot_settings.replace("*","*")
try:
await client.edit_message_caption(callback_query.message.chat.id, callback_query.message.id, caption=f"{bot_settings} {status} ", reply_markup=reply_markup)
except Exception as e:
await client.send_message(STCLOG, f"An error occurred while updating settings: {str(e)}")
elif callback_query.data == "cookie":
premium_users = load_premium_users()
admin_user = load_admin()
block_user = load_block_users()
allow =load_admin()+load_premium_users()
if callback_query.from_user.id in block_user :
status_message = "You are Blocked User , Conatct admins at @AdvAiWorld to use this feature"
await client.answer_callback_query(
callback_query.id,
text=status_message,
show_alert=True
)
return
# if callback_query.from_user.id not in allow :
# status_message = "You can't use Setting Message \nBe a Premium user to use this feature."
# await client.answer_callback_query(
# callback_query.id,
# text=status_message,
# show_alert=True
# )
# return
message_text = f"""ᴛᴏ ꜱᴇᴛ ᴀ ᴄᴏᴏᴋɪᴇ ꜰɪʟᴇ ꜰᴏʀ ᴘʀɪᴠᴀᴄʏ ᴜꜱᴇ ᴄᴀꜱᴇ, ꜰᴏʟʟᴏᴡ ᴛʜᴇꜱᴇ ꜱᴛᴇᴘꜱ:
1) ɢᴏ ᴛᴏ ᴡᴡᴡ.ʙɪɴɢ.ᴄᴏᴍ ᴀɴᴅ ꜱɪɢɴ ᴜᴘ ᴏʀ ʟᴏɢ ɪɴ ᴛᴏ ʏᴏᴜʀ ᴀᴄᴄᴏᴜɴᴛ.
2) ɪɴꜱᴛᴀʟʟ ᴀ ᴄᴏᴏᴋɪᴇ ᴇᴅɪᴛᴏʀ ᴇxᴛᴇɴꜱɪᴏɴ ɪɴ ʏᴏᴜʀ ᴄʜʀᴏᴍᴇ ʙʀᴏᴡꜱᴇʀ.
3) ᴀᴄᴛɪᴠᴀᴛᴇ ᴛʜᴇ ᴄᴏᴏᴋɪᴇ ᴇᴅɪᴛᴏʀ ᴇxᴛᴇɴꜱɪᴏɴ ᴏɴ ʙɪɴɢ.ᴄᴏᴍ ᴀɴᴅ ᴇxᴘᴏʀᴛ ᴛʜᴇ ᴄᴏᴏᴋɪᴇ ᴀꜱ ᴊꜱᴏɴ.
4) ᴄʀᴇᴀᴛᴇ ᴀ ꜰɪʟᴇ ɴᴀᴍᴇᴅ "ᴄᴏᴏᴋɪᴇ.ᴊꜱᴏɴ" ᴀɴᴅ ᴘᴀꜱᴛᴇ ᴛʜᴇ ᴄᴏᴘɪᴇᴅ ᴄᴏᴏᴋɪᴇ ɪɴᴛᴏ ᴛʜᴇ ꜰɪʟᴇ. ᴍᴀᴋᴇ ꜱᴜʀᴇ ᴛʜᴇ ꜰɪʟᴇ ᴇxᴛᴇɴꜱɪᴏɴ ɪꜱ ".ᴊꜱᴏɴ".
5) ʀᴇᴛᴜʀɴ ᴛᴏ ᴛʜᴇ ʙᴏᴛ ᴀɴᴅ ᴜꜱᴇ ᴛʜᴇ /cookie ᴄᴏᴍᴍᴀɴᴅ.
6) ꜱᴇɴᴅ ᴛʜᴇ "cookie.json" ꜰɪʟᴇ ᴛᴏ ᴛʜᴇ ʙᴏᴛ.
ʏᴏᴜʀ ᴄᴏᴏᴋɪᴇ ʜᴀꜱ ʙᴇᴇɴ ꜱᴇᴛ ᴀɴᴅ ᴡɪʟʟ ʙᴇ ᴜꜱᴇᴅ ᴏɴʟʏ ꜰᴏʀ ʏᴏᴜʀ ᴘʀɪᴠᴀᴄʏ.
ɪꜰ ʏᴏᴜ ʜᴀᴠᴇ ᴀɴʏ ᴅᴏᴜʙᴛꜱ ᴏʀ ɴᴇᴇᴅ ꜱᴜᴘᴘᴏʀᴛ, ᴘʟᴇᴀꜱᴇ ᴄᴏɴᴛᴀᴄᴛ @I_AM_CSR. {status} """
message_text=message_text.replace("*","*")
reply_markup = InlineKeyboardMarkup(
[
[
InlineKeyboardButton("ʙᴀᴄᴋ ⬅️", callback_data="presettings"),
]
]
)
await client.edit_message_caption(
callback_query.message.chat.id,
callback_query.message.id,
caption=message_text,
reply_markup=reply_markup
)
elif callback_query.data in ["presettings"]:
premium_users = load_premium_users()
admin_user = load_admin()
block_user = load_block_users()
allow =load_admin()+load_premium_users()
if callback_query.from_user.id in block_user :
status_message = "You are Blocked User , Conatct admins at @AdvAiWorld to use this feature"
await client.answer_callback_query(
callback_query.id,
text=status_message,
show_alert=True
)
return
# if callback_query.from_user.id not in allow :
# status_message = "You can't use Setting Message \nBe a Premium user to use this feature."
# await client.answer_callback_query(
# callback_query.id,
# text=status_message,
# show_alert=True
# )
# return
if not check_inited(callback_query.from_user.id ):
EDGES[callback_query.from_user.id ] = copy.deepcopy(USER_TEMPLATE)
bot_name = BOT_NAME
try: