Repository navigation
Expand file tree
/
Copy pathmain.py
More file actions
983 lines (850 loc) · 48.4 KB
/
Copy pathmain.py
File metadata and controls
983 lines (850 loc) · 48.4 KB
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
import telebot
from telebot import types
from telebot.types import InlineKeyboardMarkup, InlineKeyboardButton
import time
import re
from datetime import timedelta, datetime
import sqlite3
API_TOKEN = '7392955526:AAGavuQbNQlpKV3CsPZAJzApZVIpMoqh-Fk'
bot = telebot.TeleBot(API_TOKEN, parse_mode='HTML')
user_join_status = {}
user_states = {}
started_users = set()
banned_users = set()
broad_users = []
def has_joined_required_groups(user_id):
try:
auction_status = bot.get_chat_member(chat_id="@AVSAUCTION", user_id=user_id).status
trade_status = bot.get_chat_member(chat_id="@Avstradegc", user_id=user_id).status
has_joined_auction = auction_status in ['member', 'administrator', 'creator']
has_joined_trade = trade_status in ['member', 'administrator', 'creator']
except:
has_joined_auction = False
has_joined_trade = False
return has_joined_auction and has_joined_trade
def send_welcome_message(chat_id, username, first_name):
markup = types.InlineKeyboardMarkup()
join_auction_btn = types.InlineKeyboardButton("Join Auction", url="https://t.me/AVSAUCTION")
join_trade_btn = types.InlineKeyboardButton("Join Trade", url="https://t.me/Avstradegc")
joined_btn = types.InlineKeyboardButton("Joined", callback_data="joined")
markup.add(join_auction_btn, join_trade_btn)
markup.add(joined_btn)
caption = (
f"<b>🔸Welcome, {first_name} To VA Auction Bot</b>\n\n"
"<b>🔸You Can Submit Your Pokemon Through This Bot For Auction</b>\n\n"
"<b>🔻But Before Using You Have To Join Our Auction Group By Clicking Below Two Buttons And Then Click 'Joined' Button</b>"
)
bot.send_photo(
chat_id,
photo="https://wallpapers.com/images/hd/legendary-pokemon-pictures-7yo7x0f1l2b2tu0r.jpg",
caption=caption,
reply_markup=markup,
parse_mode='HTML',
)
@bot.message_handler(commands=['start'])
def handle_start(message):
if str(message.from_user.id) in banned_users:
bot.reply_to(message, "<b>You Are Banned By an Administrator</b>")
else:
if message.chat.type == 'private':
user_id = message.chat.id
if user_id not in broad_users:
broad_users.append(user_id)
if not has_joined_required_groups(user_id):
send_welcome_message(message.chat.id, message.from_user.username, message.from_user.first_name)
started_users.add(user_id)
else:
bot.reply_to(message, "<b>You have already joined the required groups. Feel free to use the bot.(build by idk but repaired by :- @R3AP3Redit )</b>")
started_users.add(user_id)
else:
markup = types.InlineKeyboardMarkup()
button = types.InlineKeyboardButton("Go to Bot PM", url=f"t.me/{bot.get_me().username}")
markup.add(button)
bot.reply_to(message, "<b>This command can only be used in private messages.</b>", reply_markup=markup)
@bot.callback_query_handler(func=lambda call: call.data == "joined")
def handle_joined(call):
user_id = call.from_user.id
if has_joined_required_groups(user_id):
bot.edit_message_caption(
chat_id=call.message.chat.id,
message_id=call.message.message_id,
caption="<b>Thanks for joining our groups 😊</b>"
)
else:
bot.answer_callback_query(callback_query_id=call.id, text="You must join all required groups to proceed.", show_alert=True)
@bot.message_handler(commands=['cancel'])
def handle_cancel(message):
if str(message.from_user.id) in banned_users:
bot.reply_to(message, "<b>You Are Banned By an Administrator</b>", parse_mode='HTML')
else:
if message.chat.type == 'private':
user_id = message.from_user.id
if user_id in user_states:
del user_states[user_id]
bot.send_message(message.chat.id, "<b>All Running Command Has Been Cancelled ✅</b>", parse_mode='HTML')
else:
markup = types.InlineKeyboardMarkup()
button = types.InlineKeyboardButton("Go to Bot PM", url=f"t.me/{bot.get_me().username}")
markup.add(button)
bot.reply_to(message, "<b>This command can only be used in private messages.</b>", parse_mode='HTML', reply_markup=markup)
def is_admin(user_id):
admin_ids = [5257885057, 5690812882, 6694887060, 7387719195, 6541873974, 6717221647]
return user_id in admin_ids
#owner shit
def is_owner(user_id):
owner_ids = [6694887060]
return user_id in owner_ids
@bot.message_handler(commands=['natures'])
def handle_natures(message):
if str(message.from_user.id) in banned_users:
bot.reply_to(message, "<b>You Are Banned By an Administrator</b>")
else:
photo_url = "https://t.me/AcnHexaAuctionTrade/4880771"
caption = "<b>Here Is The List Of All Natures</b>"
bot.send_photo(message.chat.id, photo=photo_url, caption=caption)
nature_info = {
"adamant": {"increase": "Attack", "decrease": "Special Attack"},
"bashful": {"increase": "none", "decrease": "none"},
"bold": {"increase": "Defense", "decrease": "Attack"},
"brave": {"increase": "Attack", "decrease": "Speed"},
"calm": {"increase": "Special Defense", "decrease": "Attack"},
"careful": {"increase": "Special Defense", "decrease": "Special Attack"},
"docile": {"increase": "none", "decrease": "none"},
"gentle": {"increase": "Special Defense", "decrease": "Defense"},
"hardy": {"increase": "none", "decrease": "none"},
"hasty": {"increase": "Speed", "decrease": "Defense"},
"impish": {"increase": "Defense", "decrease": "Special Attack"},
"jolly": {"increase": "Speed", "decrease": "Special Attack"},
"lax": {"increase": "Defense", "decrease": "Special Defense"},
"lonely": {"increase": "Attack", "decrease": "Defense"},
"mild": {"increase": "Special Attack", "decrease": "Defense"},
"modest": {"increase": "Special Attack", "decrease": "Attack"},
"naive": {"increase": "Speed", "decrease": "Special Defense"},
"naughty": {"increase": "Attack", "decrease": "Special Defense"},
"quiet": {"increase": "Special Attack", "decrease": "Speed"},
"quirky": {"increase": "none", "decrease": "none"},
"rash": {"increase": "Special Attack", "decrease": "Special Defense"},
"relaxed": {"increase": "Defense", "decrease": "Speed"},
"sassy": {"increase": "Special Defense", "decrease": "Speed"},
"serious": {"increase": "none", "decrease": "none"},
"timid": {"increase": "Speed", "decrease": "Attack"}
}
@bot.message_handler(func=lambda message: message.text.lower() in nature_info)
def handle_nature(message):
nature_name = message.text.lower()
info = nature_info[nature_name]
response = f"<b>Nature : {nature_name.capitalize()}\n\n▪️ Effects :-\n</b>"
response += f"<b>🔺 Stats Increase + : {info['increase']}\n</b>"
response += f"<b>🔻 Stats Decrease - : {info['decrease']}\n</b>"
bot.reply_to(message, response)
@bot.message_handler(commands=['sellerinfo'])
def handle_seller_info(message):
if str(message.from_user.id) in banned_users:
bot.reply_to(message, "<b>You Are Banned By an Administrator</b>")
else:
if message.chat.type == 'private':
info_message = (
"<b>To Find a Seller :</b>\n\n"
"<b>🔹 /seller (name) (nature) (level)</b>"
)
bot.send_message(message.chat.id, info_message, parse_mode='HTML')
else:
markup = types.InlineKeyboardMarkup()
button = types.InlineKeyboardButton("Go to Bot PM", url=f"t.me/{bot.get_me().username}")
markup.add(button)
bot.reply_to(message, "<b>This command can only be used in private messages.</b>", reply_markup=markup)
@bot.message_handler(commands=['admin'])
def handle_admin(message):
if str(message.from_user.id) in banned_users:
bot.reply_to(message, "<b>You Are Banned By an Administrator</b>")
else:
if message.chat.type == 'private':
admin_list = ["@" + "SoulReaperCommercial"]
admin_message = "<b>All Admin of Bot Are :</b>\n\n"
for i, admin_username in enumerate(admin_list, start=1):
admin_message += f"{i}. <b>{admin_username}</b>\n"
bot.send_message(message.chat.id, admin_message, parse_mode='HTML')
else:
markup = types.InlineKeyboardMarkup()
button = types.InlineKeyboardButton("Go to Bot PM", url=f"t.me/{bot.get_me().username}")
markup.add(button)
bot.reply_to(message, "<b>This command can only be used in private messages.</b>", reply_markup=markup)
@bot.message_handler(commands=['help'])
def handle_cmds(message):
if message.chat.type == 'private':
if str(message.from_user.id) in banned_users:
bot.reply_to(message, "<b>You Are Banned By an Administrator</b>", parse_mode='HTML')
else:
user_id = message.from_user.id
bot.reply_to(message, '''
<b>Users Commands :</b>
—————————————————————————
• <b>/start</b> - Start the Bot
• <b>/add</b> - Add Pokes / Items in Auction
• <b>/cancel</b> - Cancel All commands
• <b>/item</b> - Get items In Auction
• <b>/natures</b> - Get Nature Info
• <b>/seller</b> - Get Seller username for a Item
• <b>/sellerinfo</b> - Get Seller Info
• <b>/sellers</b> - All sellers In auction
• <b>/profile</b> - Get your profile or Reply to Someone to Get His Profile
• <b>/admin</b> - Get All admins in Bot
• <b>/help</b> - Get This Message
• <b>/users</b> - Get Total Users in bot
• <b>/host</b> - Create Auction Bot
<b>Admin commands :</b>
—————————————————————————
• <b>/list</b> - Get List of Pokemon / TMs In Auction (Admin)
• <b>/sold</b> - Sold Messenger (Admin)
• <b>/unsold</b> - Unsold Messenger (Admin)
• <b>/ban</b> - Ban Someone (Admin)
• <b>/unban</b> - Unban Someone (Admin)
• <b>/msg</b> - Message a User (Admin)
• <b>/current</b> - Get current Slot For Auction (Admin)
• <b>/broad</b> - Broadcast A Message (Admin)
• <b>/forward</b> - Forward a Message (Admin)
• <b>/buyers</b> - Get all buyers in auction (Admin)
• <b>/next</b> - Send next item in Auction (Admin)
<b>Owner commands :</b>
—————————————————————————
• <b>/clear</b> - Clear all Slots (Owner)
• <b>/approve</b> - Approve Someone (Owner)
''', parse_mode='HTML')
else:
markup = types.InlineKeyboardMarkup()
button = types.InlineKeyboardButton("Go to Bot PM", url=f"t.me/{bot.get_me().username}")
markup.add(button)
bot.reply_to(message, "<b>This command can only be used in private messages.</b>", reply_markup=markup)
@bot.message_handler(commands=['users'])
def handle_users(message):
if message.chat.type == 'private':
if str(message.from_user.id) in banned_users:
bot.reply_to(message, "<b>You Are Banned By an Administrator</b>", parse_mode='HTML')
else:
num_users = len(started_users)
bot.reply_to(message, f"<b>All users in Bot are : {num_users}</b>", parse_mode='HTML')
else:
markup = types.InlineKeyboardMarkup()
button = types.InlineKeyboardButton("Go to Bot PM", url=f"t.me/{bot.get_me().username}")
markup.add(button)
bot.reply_to(message, "<b>This command can only be used in private messages.</b>", parse_mode='HTML', reply_markup=markup)
@bot.message_handler(commands=['host'])
def send_host(message):
if str(message.from_user.id) in banned_users:
bot.reply_to(message, "<b>You Are Banned By an Administrator</b>")
else:
if message.chat.type == 'private':
host_message = "<b>Want To Create Auction Bot Like This?</b>"
markup = InlineKeyboardMarkup()
btn = InlineKeyboardButton(text='Contact', url='https://t.me/SoulReaperCommercial')
markup.add(btn)
bot.reply_to(message, host_message, reply_markup=markup)
else:
markup = types.InlineKeyboardMarkup()
button = types.InlineKeyboardButton("Go to Bot PM", url=f"t.me/{bot.get_me().username}")
markup.add(button)
bot.reply_to(message, "</b>This command can only be used in private messages.</b>", reply_markup=markup)
sold_items = []
message_store = {}
previous_dot_message = {}
current_index = 0
confirmed_messages = set()
admin_ids = [5257885057, 5690812882, 6694887060, 7387719195, 6541873974]
@bot.message_handler(func=lambda message: message.text == "." and message.from_user.id in admin_ids)
def handle_dot(message):
chat_id = message.chat.id
if chat_id in previous_dot_message:
prev_msg_id = previous_dot_message[chat_id]
if prev_msg_id not in confirmed_messages:
try:
bot.delete_message(chat_id, prev_msg_id)
except Exception as e:
print(f"Failed to delete message: {e}")
msg = bot.reply_to(message, "<b>•</b>", parse_mode='HTML')
previous_dot_message[chat_id] = msg.message_id
time.sleep(1.5)
bot.edit_message_text("<b>• •</b>", chat_id, msg.message_id, parse_mode='HTML')
time.sleep(1.5)
bot.edit_message_text("<b>• • •</b>", chat_id, msg.message_id, parse_mode='HTML')
time.sleep(1.5)
reply_username = message.reply_to_message.from_user.username if message.reply_to_message else "Unknown"
reply_text = message.reply_to_message.text if message.reply_to_message else "Unknown"
if not re.match(r'^\d+(k|pd)?$', reply_text):
bot.reply_to(message, "<b>Invalid format. Please enter a valid integer value (e.g., 1, 2, 1k, 2pd).</b>", parse_mode='HTML')
return
confirmation_text = f"<b>Sure Sell To @{reply_username} For {reply_text}?</b>"
keyboard = types.InlineKeyboardMarkup()
yes_button = types.InlineKeyboardButton(text="yes", callback_data=f"sell_pokemon_{chat_id}_{msg.message_id}")
keyboard.add(yes_button)
bot.edit_message_text(confirmation_text, chat_id, msg.message_id, reply_markup=keyboard, parse_mode='HTML')
message_store[f"{chat_id}_{msg.message_id}"] = message
@bot.callback_query_handler(func=lambda call: call.data.startswith("sell_pokemon_"))
def handle_sell_pokemon(call):
if call.from_user.id not in admin_ids:
bot.answer_callback_query(call.id, text="🖕", parse_mode='HTML')
return
data = call.data.split("_")
chat_id = int(data[2])
message_id = int(data[3])
confirmed_messages.add(message_id)
original_message = message_store.get(f"{chat_id}_{message_id}")
if not original_message:
bot.answer_callback_query(call.id, text="<b>Original message not found.</b>", parse_mode='HTML')
return
reply_username = original_message.reply_to_message.from_user.username if original_message.reply_to_message else "Unknown"
reply_text = original_message.reply_to_message.text if original_message.reply_to_message else "Unknown"
sold_items.append((reply_username, reply_text))
@bot.message_handler(commands=['sold'])
def handle_sold(message):
if message.from_user.id not in admin_ids:
bot.reply_to(message, "<b>You are not authorized to use this command.</b>", parse_mode='HTML')
return
try:
command, item_name = message.text.split(' ', 1)
username = message.reply_to_message.from_user.username if message.reply_to_message else None
amount = message.reply_to_message.text if message.reply_to_message else None
if not username or not amount:
bot.reply_to(message, "<b>Please reply to a message with the username and amount.</b>", parse_mode='HTML')
return
sold_items.append((item_name, username, amount))
reply_message = (f"<b>🔊 {item_name} Has Been Sold</b>\n\n"
f"<b>🔸 Sold to - @{username}</b>\n"
f"<b>🔸 Sold for - {amount}</b>\n\n"
"❗ <b>Join <a href='@VA_HEXA_TRADE'>Trade Group</a> To Get Seller Username After Auction</b>")
sent_message = bot.reply_to(message, reply_message, parse_mode='HTML', disable_web_page_preview=True)
bot.pin_chat_message(message.chat.id, sent_message.message_id)
except ValueError:
bot.reply_to(message, "<b>Please provide the command in the format /sold item_name</b>", parse_mode='HTML')
@bot.message_handler(commands=['buyers'])
def handle_buyers(message):
if not sold_items:
bot.reply_to(message, "No buyers yet.", parse_mode='HTML')
return
buyers_list = "<b>Here are the Buyers:</b>\n\n"
for i, (item_name, username, amount) in enumerate(sold_items, start=1):
buyers_list += f"🔹 {item_name} - Sold to @{username} - Sold for {amount}\n"
bot.reply_to(message, buyers_list, parse_mode='HTML')
@bot.message_handler(commands=['unsold'])
def handle_unsold(message):
if is_admin(message.from_user.id):
try:
pokemon_name = message.text.split(' ', 1)[1]
reply_message = f"<b>❌ {pokemon_name} Has Been Unsold</b>"
sent_message = bot.reply_to(message, reply_message, parse_mode='HTML')
bot.pin_chat_message(message.chat.id, sent_message.id)
except IndexError:
bot.reply_to(message, "<b>Please provide the name of the Pokemon to mark as unsold.</b>")
else:
bot.reply_to(message, "<b>You are not authorized to use this command.</b>")
@bot.message_handler(commands=['ban'])
def handle_ban(message):
if str(message.from_user.id) in banned_users:
bot.reply_to(message, "<b>You Are Banned By an Administrator</b>", parse_mode='HTML')
else:
if str(message.from_user.id) not in str(admin_ids):
bot.reply_to(message, "<b>You are not authorized to use this command.</b>", parse_mode='HTML')
return
try:
_, user_id = message.text.split(maxsplit=1)
banned_users.add(user_id)
bot.reply_to(message, f"<b>User with ID {user_id} has been banned.</b>", parse_mode='HTML')
except ValueError:
bot.reply_to(message, "<b>Invalid syntax. Use /ban <user_id></b>", parse_mode='HTML')
@bot.message_handler(commands=['unban'])
def handle_unban(message):
if str(message.from_user.id) in banned_users:
bot.reply_to(message, "<b>You Are Banned By an Administrator</b>", parse_mode='HTML')
else:
if str(message.from_user.id) not in str(admin_ids):
bot.reply_to(message, "<b>You are not authorized to use this command.</b>", parse_mode='HTML')
return
try:
_, user_id = message.text.split(maxsplit=1)
if user_id in banned_users:
banned_users.remove(user_id)
bot.reply_to(message, f"<b>User with ID {user_id} has been unbanned.</b>", parse_mode='HTML')
else:
bot.reply_to(message, f"<b>User with ID {user_id} is not banned.</b>", parse_mode='HTML')
except ValueError:
bot.reply_to(message, "<b>Invalid syntax. Use /unban <user_id></b>", parse_mode='HTML')
@bot.message_handler(commands=['msg'])
def handle_msg(message):
if str(message.from_user.id) in banned_users:
bot.reply_to(message, "<b>You Are Banned By an Administrator</b>", parse_mode='HTML')
else:
if message.from_user.id not in admin_ids:
bot.reply_to(message, "<b>You are not authorized to use this command.</b>", parse_mode='HTML')
return
try:
_, user_id, user_message = message.text.split(maxsplit=2)
user_id = int(user_id)
except ValueError:
bot.reply_to(message, "<b>Invalid syntax. Use /msg (user_id) (message)</b>", parse_mode='HTML')
return
try:
bot.send_message(user_id, user_message)
bot.reply_to(message, f"<b>Message sent to user {user_id}</b>", parse_mode='HTML')
except Exception as e:
bot.reply_to(message, f"<b>Failed to send message to user {user_id}: {e}</b>", parse_mode='HTML')
admin_ids_broad = ["5257885057", "5690812882", "6694887060", "7387719195", "6541873974"]
@bot.message_handler(commands=['broad'])
def broadcast(message):
if str(message.from_user.id) in banned_users:
bot.reply_to(message, "<b>You Are Banned By an Administrator</b>", parse_mode='HTML')
else:
user_id = message.chat.id
if str(user_id) in admin_ids_broad:
if len(message.text.split()) >= 2:
broadcast_message = ' '.join(message.text.split()[1:])
for user_id in broad_users:
bot.send_message(user_id, broadcast_message)
bot.reply_to(message, f"<b>Broadcast sent to all {len(broad_users)} users.</b>", parse_mode='HTML')
else:
bot.reply_to(message, "<b>Please provide a message to broadcast using the syntax /broad (message).</b>", parse_mode='HTML')
else:
bot.reply_to(message, "<b>You're not authorized to perform this action.</b>", parse_mode='HTML')
group_id = -1002194151018
@bot.message_handler(commands=['forward'])
def send_message_prompt(message):
if str(message.from_user.id) in banned_users:
bot.reply_to(message, "<b>You Are Banned By an Administrator</b>", parse_mode='HTML')
else:
if is_admin(message.from_user.id):
bot.reply_to(message, "<b>Type the message to send in the group</b>", parse_mode='HTML')
bot.register_next_step_handler(message, send_message)
else:
bot.reply_to(message, "<b>Only admins can perform this action.</b>", parse_mode='HTML')
def send_message(message):
if str(message.from_user.id) in banned_users:
bot.reply_to(message, "You Are Banned By an Administrator")
else:
if message.forward_from or message.forward_from_chat:
forwarded_message = message
else:
forwarded_message = message.text
try:
bot.forward_message(group_id, message.chat.id, message.id)
bot.send_message(message.chat.id, "<b>Message sent successfully.</b>")
except Exception as e:
bot.send_message(message.chat.id, f"</b>Failed to send message: {e}</b>")
owner_id = 7387719195
@bot.message_handler(commands=['approve'])
def handle_approve(message):
if str(message.from_user.id) in banned_users:
bot.reply_to(message, "<b>You Are Banned By an Administrator</b>", parse_mode='HTML')
return
if message.reply_to_message:
if str(message.from_user.id) == str(owner_id):
user_id = message.reply_to_message.from_user.id
if user_id not in admin_ids:
admin_ids.append(user_id)
admin_ids_broad.append(str(user_id))
bot.reply_to(message, f"<b>User with ID {user_id} has been approved as admin.</b>", parse_mode='HTML')
else:
bot.reply_to(message, f"<b>User with ID {user_id} is already an admin.</b>", parse_mode='HTML')
else:
bot.reply_to(message, "<b>Only the bot owner can perform this action.</b>", parse_mode='HTML')
else:
bot.reply_to(message, "<b>Please reply to a user's message to approve them as an admin.</b>", parse_mode='HTML')
group_id_mute = -1002194151018
mute_duration = 2 * 60
def mute_user(chat_id, user_id, duration_seconds):
until_date = datetime.now() + timedelta(seconds=duration_seconds)
bot.restrict_chat_member(chat_id, user_id, can_send_messages=False, until_date=until_date)
admin_id_mute = []
def is_member_of_group(user_id, group_id):
try:
group_id = 'https://t.me/VA_HEXA_TRADE'
chat_member = bot.get_chat_member(group_id, user_id)
if chat_member.status in ['member', 'administrator', 'creator']:
return True
else:
return False
except telebot.apihelper.ApiException:
return False
@bot.message_handler(content_types=['new_chat_members'])
def handle_new_members(message):
new_members = message.new_chat_members
for member in new_members:
user_id = member.id
if user_id in admin_id_mute:
continue
if not is_member_of_group(user_id, group_id_mute):
mute_user(message.chat.id, user_id, mute_duration)
bot.reply_to(message, f"<b>Muted {member.first_name} for 2 minutes.</b>\n"
f"<b>Reason: Not Found In <a href='https://t.me/VA_HEXA_TRADE'> Trade Group</a> </b>", disable_web_page_preview=True)
tm_data = {
2: {"name": "Dragon Claw", "power": 80, "accuracy": 100, "category": "P"},
3: {"name": "Psyshock", "power": 80, "accuracy": 100, "category": "S"},
9: {"name": "Venoshock", "power": 65, "accuracy": 100, "category": "S"},
10: {"name": "Hidden Power", "power": 60, "accuracy": 100, "category": "S"},
13: {"name": "Ice Beam", "power": 90, "accuracy": 100, "category": "S"},
14: {"name": "Blizzard", "power": 110, "accuracy": 70, "category": "S"},
15: {"name": "Hyper Beam", "power": 150, "accuracy": 90, "category": "S"},
22: {"name": "Solar Beam", "power": 120, "accuracy": 100, "category": "S"},
23: {"name": "Smack Down", "power": 50, "accuracy": 100, "category": "P"},
24: {"name": "Thunderbolt", "power": 90, "accuracy": 100, "category": "S"},
25: {"name": "Thunder", "power": 110, "accuracy": 70, "category": "P"},
26: {"name": "Earthquake", "power": 100, "accuracy": 100, "category": "P"},
28: {"name": "Leech Life", "power": 80, "accuracy": 100, "category": "P"},
29: {"name": "Psychic", "power": 90, "accuracy": 100, "category": "S"},
30: {"name": "Shadow Ball", "power": 80, "accuracy": 100, "category": "S"},
31: {"name": "Brick Break", "power": 75, "accuracy": 100, "category": "P"},
34: {"name": "Sludge Wave", "power": 95, "accuracy": 100, "category": "S"},
35: {"name": "Flamethrower", "power": 90, "accuracy": 100, "category": "S"},
36: {"name": "Sludge Bomb", "power": 90, "accuracy": 100, "category": "S"},
38: {"name": "Fire Blast", "power": 110, "accuracy": 85, "category": "S"},
39: {"name": "Rock Tomb", "power": 60, "accuracy": 95, "category": "P"},
40: {"name": "Aerial Ace", "power": 60, "accuracy": 100, "category": "P"},
42: {"name": "Facade", "power": 70, "accuracy": 100, "category": "P"},
43: {"name": "Flame Charge", "power": 50, "accuracy": 100, "category": "P"},
46: {"name": "Thief", "power": 60, "accuracy": 100, "category": "P"},
47: {"name": "Low Sweep", "power": 65, "accuracy": 100, "category": "P"},
48: {"name": "Round", "power": 60, "accuracy": 100, "category": "S"},
49: {"name": "Echoed Voice", "power": 40, "accuracy": 100, "category": "S"},
50: {"name": "Overheat", "power": 130, "accuracy": 90, "category": "S"},
51: {"name": "Steel Wing", "power": 70, "accuracy": 90, "category": "P"},
52: {"name": "Focus Blast", "power": 120, "accuracy": 70, "category": "S"},
53: {"name": "Energy Ball", "power": 90, "accuracy": 100, "category": "S"},
54: {"name": "False Swipe", "power": 40, "accuracy": 100, "category": "P"},
55: {"name": "Scald", "power": 80, "accuracy": 100, "category": "S"},
57: {"name": "Charge Beam", "power": 50, "accuracy": 90, "category": "S"},
58: {"name": "Sky Drop", "power": 60, "accuracy": 100, "category": "P"},
59: {"name": "Brutal Swing", "power": 60, "accuracy": 100, "category": "P"},
62: {"name": "Acrobatics", "power": 55, "accuracy": 100, "category": "P"},
65: {"name": "Shadow Claw", "power": 70, "accuracy": 100, "category": "P"},
66: {"name": "Payback", "power": 50, "accuracy": 100, "category": "P"},
67: {"name": "Smart Strike", "power": 70, "accuracy": 100, "category": "P"},
68: {"name": "Giga Impact", "power": 150, "accuracy": 90, "category": "P"},
71: {"name": "Stone Edge", "power": 100, "accuracy": 80, "category": "P"},
72: {"name": "Volt Switch", "power": 70, "accuracy": 100, "category": "S"},
76: {"name": "Fly", "power": 90, "accuracy": 95, "category": "P"},
78: {"name": "Bulldoze", "power": 60, "accuracy": 100, "category": "P"},
79: {"name": "Frost Breath", "power": 60, "accuracy": 90, "category": "S"},
80: {"name": "Rock Slide", "power": 75, "accuracy": 90, "category": "P"},
81: {"name": "X-Scissor", "power": 80, "accuracy": 100, "category": "P"},
82: {"name": "Dragon Tail", "power": 60, "accuracy": 90, "category": "P"},
83: {"name": "Infestation", "power": 70, "accuracy": 100, "category": "S"},
84: {"name": "Poison Jab", "power": 80, "accuracy": 100, "category": "P"},
85: {"name": "Dream Eater", "power": 100, "accuracy": 100, "category": "S"},
89: {"name": "U-Turn", "power": 70, "accuracy": 100, "category": "P"},
91: {"name": "Flash Cannon", "power": 80, "accuracy": 100, "category": "S"},
93: {"name": "Wild Charge", "power": 90, "accuracy": 100, "category": "P"},
94: {"name": "Surf", "power": 90, "accuracy": 100, "category": "S"},
95: {"name": "Snarl", "power": 55, "accuracy": 95, "category": "S"},
97: {"name": "Dark Pulse", "power": 80, "accuracy": 100, "category": "S"},
98: {"name": "Waterfall", "power": 80, "accuracy": 100, "category": "P"},
99: {"name": "Dazzling Gleam", "power": 80, "accuracy": 100, "category": "S"},
}
@bot.message_handler(func=lambda message: re.match(r'/tm\d{2}', message.text.lower()))
def handle_tm_input(message):
match = re.match(r'/tm(\d{2})', message.text.lower())
tm_number = int(match.group(1))
if tm_number not in tm_data:
bot.reply_to(message, "<b>TM not found. Please check the TM number and try again.</b>", parse_mode='HTML')
return
tm_info = tm_data[tm_number]
category = "Physical" if tm_info["category"] == "P" else "Special"
response_message = (
f"<b>TM{tm_number} 💿 :\n\n</b>"
f"<b>{tm_info['name']} [{category}]\n</b>"
f"<b>Power: {tm_info['power']}, Accuracy: {tm_info['accuracy']}\n\n</b>"
f"<b>You can sell this TM for PDs 💵 in hexa</b>"
)
bot.reply_to(message, response_message, parse_mode='HTML')
@bot.message_handler(commands=['tms'])
def show_tms(message):
tms_list = "<b>List of TMs:</b>\n\n"
for tm_number, tm_info in tm_data.items():
category = "Physical" if tm_info["category"] == "P" else "Special"
tm_info_str = f"<b>TM{tm_number} - {tm_info['name']} [{category}]</b>\n"
tms_list += tm_info_str
bot.reply_to(message, tms_list, parse_mode='HTML')
@bot.message_handler(commands=['profile'])
def send_profile(message):
if str(message.from_user.id) in banned_users:
bot.reply_to(message, "<b>You Are Banned By an Administrator</b>", parse_mode='HTML')
else:
user_id = message.from_user.id
user_name = message.from_user.first_name
is_verified = user_id in admin_ids or user_id in admin_ids_broad
profile_message = f"<b>👤 Here's Profile Of {user_name}🫧\n\n</b>"
profile_message += f"<b>• 👉 Name: {user_name}\n</b>"
profile_message += f"<b>• 🆔 ID: {user_id}\n\n</b>"
profile_message += "<b>★➖➖➖➖➖➖➖➖➖➖☆\n</b>"
profile_message += f"<b>┃╸ ©️ Verified? - {'✅' if is_verified else '❌'}\n</b>"
profile_message += "<b>★➖➖➖➖➖➖➖➖➖➖☆</b>"
bot.reply_to(message, profile_message, parse_mode='HTML')
import pymongo
MONGO_URI = "mongodb+srv://omnikingzeno2000:PrinceJindal@cluster0.a35bmwi.mongodb.net"
DATABASE_NAME = "auction_items"
COLLECTION_NAME = "items"
GROUP_CHAT_ID = -1002073133163
ADMIN_CHAT_ID = [7387719195, 6541873974]
client = pymongo.MongoClient(MONGO_URI)
db = client[DATABASE_NAME]
collection = db[COLLECTION_NAME]
@bot.message_handler(commands=['add'], func=lambda message: message.chat.type == 'private')
def send_add_options(message):
if is_admin(message.from_user.id) or is_owner(message.from_user.id):
markup = telebot.types.InlineKeyboardMarkup(row_width=2)
markup.add(telebot.types.InlineKeyboardButton("Pokemon", callback_data="add_pokemon"),
telebot.types.InlineKeyboardButton("TMs", callback_data="add_tms"),
telebot.types.InlineKeyboardButton("Teams", callback_data="add_teams"))
bot.reply_to(message, "<b>What do you want to add?</b>", parse_mode="HTML", reply_markup=markup)
else:
bot.reply_to(message, "<b>You are not authorized to use this command.</b>", parse_mode="HTML")
@bot.callback_query_handler(func=lambda call: call.data.startswith("add_"))
def handle_add_options(call):
option = call.data.split("_")[1]
if option == "pokemon":
bot.edit_message_text(chat_id=call.message.chat.id, message_id=call.message.message_id, text="<b>Tell the name of the Pokemon:</b>", parse_mode="HTML")
bot.register_next_step_handler(call.message, get_pokemon_name)
elif option == "tms":
bot.edit_message_text(chat_id=call.message.chat.id, message_id=call.message.message_id, text="<b>Provide the name of the TMs:</b>", parse_mode="HTML")
bot.register_next_step_handler(call.message, get_tms_name)
elif option == "teams":
bot.edit_message_text(chat_id=call.message.chat.id, message_id=call.message.message_id, text="<b>Tell the name of the Team:</b>", parse_mode="HTML")
bot.register_next_step_handler(call.message, get_team_name)
def get_pokemon_name(message):
name = message.text
if not name:
message.reply_text("<b>Please send text only.</b>", parse_mode="HTML")
return get_pokemon_name(message)
bot.send_message(message.chat.id, "<b>Send a picture of the Pokemon:</b>", parse_mode="HTML")
bot.register_next_step_handler(message, get_pokemon_picture, name)
def get_pokemon_picture(message, name):
if not message.photo:
message.reply_text("<b>Please send only a photo.</b>", parse_mode="HTML")
return get_pokemon_picture(message, name)
picture = message.photo[-1].file_id
bot.send_message(message.chat.id, "<b>Provide the Pokemon's info (include Lv, Nature, Types):</b>", parse_mode="HTML")
bot.register_next_step_handler(message, get_pokemon_info, name, picture)
def get_pokemon_info(message, name, picture):
info = message.text
if not info:
message.reply_text("<b>Please send text only.</b>", parse_mode="HTML")
return get_pokemon_info(message, name, picture)
bot.send_message(message.chat.id, "<b>Provide the Pokemon's IV/EV stats:</b>", parse_mode="HTML")
bot.register_next_step_handler(message, get_pokemon_ivev, name, picture, info)
def get_pokemon_ivev(message, name, picture, info):
ivev = message.text
if not ivev:
message.reply_text("<b>Please send text only.</b>", parse_mode="HTML")
return get_pokemon_ivev(message, name, picture, info)
bot.send_message(message.chat.id, "<b>Provide the Pokemon's moveset:</b>", parse_mode="HTML")
bot.register_next_step_handler(message, get_pokemon_moveset, name, picture, info, ivev)
def get_pokemon_moveset(message, name, picture, info, ivev):
moveset = message.text
if not moveset:
message.reply_text("<b>Please send text only.</b>", parse_mode="HTML")
return get_pokemon_moveset(message, name, picture, info, ivev)
bot.send_message(message.chat.id, "<b>Is It Boosted ?:</b>", parse_mode="HTML")
bot.register_next_step_handler(message, get_pokemon_boosted, name, picture, info, ivev, moveset)
def get_pokemon_boosted(message, name, picture, info, ivev, moveset):
boosted = message.text
if not boosted:
message.reply_text("<b>Please send text only.</b>", parse_mode="HTML")
return get_pokemon_boosted(message, name, picture, info, ivev, moveset)
bot.send_message(message.chat.id, "<b>Provide the Pokemon's base :</b>", parse_mode="HTML")
bot.register_next_step_handler(message, get_pokemon_base, name, picture, info, ivev, moveset, boosted)
def get_pokemon_base(message, name, picture, info, ivev, moveset, boosted):
base = message.text
if not base:
message.reply_text("<b>Please send text only.</b>", parse_mode="HTML")
return get_pokemon_base(message, name, picture, info, ivev, moveset, boosted)
user_id = message.from_user.id
user_name = message.from_user.username
caption = (f"<b>Name: {name} </b> \n\n<b>Info: \n\n {info}</b>\n\n<b>IV/EV:\n\n {ivev} </b> \n\n<b>Moveset: \n\n{moveset}</b> \n\n"
f"<b>Boosted: {boosted}</b>\n\n<b>Base: {base} </b> \n\n<b>UserID : {user_id}</b>")
markup = telebot.types.InlineKeyboardMarkup()
markup.add(telebot.types.InlineKeyboardButton("Approve", callback_data=f"approve_pokemon_{user_id}_{name}_{user_name}"),
telebot.types.InlineKeyboardButton("Reject", callback_data=f"reject_pokemon_{user_id}_{name}"))
auction_message = bot.send_photo(ADMIN_CHAT_ID, picture, caption=caption, parse_mode="HTML", reply_markup=markup)
def get_tms_name(message):
name = message.text
if not name:
message.reply_text("<b>Please send text only.</b>", parse_mode="HTML")
return get_tms_name(message)
bot.send_message(message.chat.id, "<b>Provide the info for the TMs:</b>", parse_mode="HTML")
bot.register_next_step_handler(message, get_tms_info, name)
def get_tms_info(message, name):
info = message.text
if not info:
message.reply_text("<b>Please send text only.</b>", parse_mode="HTML")
return get_tms_info(message, name)
bot.send_message(message.chat.id, "<b>Provide the base stats for the TMs:</b>", parse_mode="HTML")
bot.register_next_step_handler(message, get_tms_base, name, info)
def get_tms_base(message, name, info):
base = message.text
if not base:
message.reply_text("<b>Please send text only.</b>", parse_mode="HTML")
return get_tms_base(message, name, info)
user_id = message.from_user.id
user_name = message.from_user.username
caption = f"<b>TMs Name:</b> {name}\n<b>TMs Info:</b> {info}\n<b>Base:</b> {base}\n<b>UserID:</b> {user_id}"
markup = telebot.types.InlineKeyboardMarkup()
markup.add(telebot.types.InlineKeyboardButton("Approve", callback_data=f"approve_tms_{user_id}_{user_name}"),
telebot.types.InlineKeyboardButton("Reject", callback_data=f"reject_tms_{user_id}"))
auction_message = bot.send_message(ADMIN_CHAT_ID, caption, parse_mode="HTML", reply_markup=markup)
@bot.callback_query_handler(func=lambda call: call.data.startswith(("approve_tms_", "reject_tms_")))
def handle_tms_approval_rejection(call):
data_parts = call.data.split("_")
action = data_parts[0]
item_type = data_parts[1]
user_id = data_parts[2]
user_name = data_parts[3] if len(data_parts) == 4 else None
if action == "approve":
bot.send_message(user_id, "<b>Your TMs submission has been approved!</b>", parse_mode="HTML")
bot.send_message(GROUP_CHAT_ID, f"<b>New TMs added:</b>\n{call.message.text}", parse_mode="HTML")
collection.insert_one({"type": "tms", "name": user_name})
else:
bot.send_message(user_id, "<b>Your TMs submission has been rejected.</b>", parse_mode="HTML")
bot.edit_message_reply_markup(call.message.chat.id, call.message.message_id, reply_markup=None)
def get_team_name(message):
name = message.text
if not name:
message.reply_text("<b>Please send text only.</b>", parse_mode="HTML")
return get_team_name(message)
bot.send_message(message.chat.id, "<b>Provide the members of the team:</b>", parse_mode="HTML")
bot.register_next_step_handler(message, get_team_members, name)
def get_team_members(message, name):
members = message.text
if not members:
message.reply_text("<b>Please send text only.</b>", parse_mode="HTML")
return get_team_members(message, name)
bot.send_message(message.chat.id, "<b>Provide the base stats for the team:</b>", parse_mode="HTML")
bot.register_next_step_handler(message, get_team_base, name, members)
def get_team_base(message, name, members):
base = message.text
if not base:
message.reply_text("<b>Please send text only.</b>", parse_mode="HTML")
return get_team_base(message, name, members)
user_id = message.from_user.id
user_name = message.from_user.username
caption = f"<b>Team Name : </b> {name}\n\n<b>Members : \n\n</b> {members}\n\n<b>Base : </b> {base}\n\n<b>UserID : </b> {user_id}"
markup = telebot.types.InlineKeyboardMarkup()
markup.add(telebot.types.InlineKeyboardButton("Approve", callback_data=f"approve_team_{user_id}_{name}_{user_name}"),
telebot.types.InlineKeyboardButton("Reject", callback_data=f"reject_team_{user_id}_{name}"))
auction_message = bot.send_message(ADMIN_CHAT_ID, caption, parse_mode="HTML", reply_markup=markup)
@bot.callback_query_handler(func=lambda call: call.data.startswith(("approve_", "reject_")))
def handle_approval_rejection(call):
data_parts = call.data.split("_")
action = data_parts[0]
item_type = data_parts[1]
user_id = data_parts[2]
item_name = data_parts[3]
user_name = data_parts[4] if len(data_parts) == 5 else None
user_id = int(user_id)
if item_type == "pokemon":
if action == "approve":
bot.send_message(user_id, f"<b>Your Pokemon '{item_name}' has been approved!</b>", parse_mode="HTML")
bot.send_photo(GROUP_CHAT_ID, call.message.photo[-1].file_id, caption=call.message.caption, parse_mode="HTML")
collection.insert_one({"type": "pokemon", "name": item_name})
else:
bot.send_message(user_id, f"<b>Your Pokemon '{item_name}' has been rejected.</b>", parse_mode="HTML")
elif item_type == "tms":
if action == "approve":
bot.send_message(user_id, "<b>Your TMs submission has been approved!</b>", parse_mode="HTML")
bot.send_message(GROUP_CHAT_ID, f"<b>New TMs added:</b>\n{call.message.text}", parse_mode="HTML")
collection.insert_one({"type": "tms", "name": item_name})
else:
bot.send_message(user_id, "<b>Your TMs submission has been rejected.</b>", parse_mode="HTML")
elif item_type == "team":
if action == "approve":
bot.send_message(user_id, f"<b>Your Team '{item_name}' has been approved!</b>", parse_mode="HTML")
bot.send_message(GROUP_CHAT_ID, f"<b>New Team added:</b>\n{call.message.text}", parse_mode="HTML")
collection.insert_one({"type": "team", "name": item_name})
else:
bot.send_message(user_id, f"<b>Your Team '{item_name}' has been rejected.</b>", parse_mode="HTML")
bot.edit_message_reply_markup(call.message.chat.id, call.message.message_id, reply_markup=None)
@bot.message_handler(commands=['current'], func=lambda message: message.chat.type == 'private')
def current_items(message):
if is_admin(message.from_user.id) or is_owner(message.from_user.id):
pokemon_count = collection.count_documents({"type": "pokemon"})
tms_count = collection.count_documents({"type": "tms"})
teams_count = collection.count_documents({"type": "team"})
total_count = pokemon_count + tms_count + teams_count
current_message = (
f"🔹<b>Currently Items In Auction</b> - \n\n"
f"🔺<b>Pokemon</b> : {pokemon_count} \n"
f"🔺<b>TMs</b> : {tms_count} \n"
f"🔺<b>Teams</b> : {teams_count} \n\n"
f"🔹<b>Total Items</b> :- {total_count} "
)
bot.reply_to(message, current_message, parse_mode="HTML")
else:
bot.reply_to(message, "<b>You are not authorized to use this command.</b>", parse_mode="HTML")
@bot.message_handler(commands=['item'], func=lambda message: message.chat.type == 'private')
def show_item_options(message):
if is_admin(message.from_user.id) or is_owner(message.from_user.id):
markup = telebot.types.InlineKeyboardMarkup(row_width=3)
markup.add(telebot.types.InlineKeyboardButton("Pokemon", callback_data="show_pokemon"),
telebot.types.InlineKeyboardButton("TMs", callback_data="show_tms"),
telebot.types.InlineKeyboardButton("Teams", callback_data="show_teams"))
bot.reply_to(message, "<b>Please Select What you want to see:</b>", parse_mode="HTML", reply_markup=markup)
else:
bot.reply_to(message, "<b>You are not authorized to use this command.</b>", parse_mode="HTML")
@bot.callback_query_handler(func=lambda call: call.data.startswith("show_"))
def handle_show_items(call):
if is_admin(call.from_user.id) or is_owner(call.from_user.id):
item_type = call.data.split("_")[1].capitalize()
items_list = list(collection.find({"type": item_type.lower()}))
if items_list:
items_message = f"<b>Here is the list of {item_type} approved for the next auction:</b>\n\n"
items_message += "\n".join([f"{i + 1}. {item['name']}" for i, item in enumerate(items_list)])
else:
items_message = f"<b>No {item_type} available.</b>"
bot.edit_message_text(chat_id=call.message.chat.id, message_id=call.message.message_id, text=items_message, parse_mode="HTML")
else:
bot.reply_to(call.message, "<b>You are not authorized to use this command.</b>", parse_mode="HTML")
@bot.message_handler(commands=['list'], func=lambda message: message.chat.type == 'private')
def list_all_items(message):
if is_admin(message.from_user.id) or is_owner(message.from_user.id):
items_list = list(collection.find({}))
if items_list:
items_message = "<b>Here are the items approved for the next auction:</b>\n\n"
for i, item in enumerate(items_list):
items_message += f"{i + 1}. {item['type'].capitalize()}: {item['name']}\n"
else:
items_message = "<b>No items available.</b>"
bot.reply_to(message, items_message, parse_mode="HTML")
else:
bot.reply_to(message, "<b>You are not authorized to use this command.</b>", parse_mode="HTML")
@bot.message_handler(commands=['clear'], func=lambda message: message.chat.type == 'private')
def clear_database(message):
if is_owner(message.from_user.id):
collection.delete_many({})
bot.reply_to(message, "<b>Database cleared successfully.</b>", parse_mode="HTML")
else:
bot.reply_to(message, "<b>You are not authorized to use this command.</b>", parse_mode="HTML")
stored_messages = {}
@bot.message_handler(commands=['store'])
def store_message_prompt(message):
if str(message.from_user.id) in banned_users:
bot.reply_to(message, "You Are Banned By an Administrator")
else:
if is_admin(message.from_user.id):
bot.reply_to(message, "Type the message you want to store:")
bot.register_next_step_handler(message, store_message)
else:
bot.reply_to(message, "Only admins can perform this action.")
def store_message(message):
stored_messages[message.message_id] = {"message": message.text, "chat_id": message.chat.id}
bot.reply_to(message, "Message stored successfully.")
@bot.message_handler(commands=['next'])
def next_message(message):
if str(message.from_user.id) in banned_users:
bot.reply_to(message, "You Are Banned By an Administrator")
else:
if is_admin(message.from_user.id):
if stored_messages:
next_message_id = next(iter(stored_messages))
next_message_data = stored_messages.pop(next_message_id)
bot.forward_message(message.chat.id, next_message_data["chat_id"], next_message_id)
else:
bot.reply_to(message, "No more Posts To Forward")
else:
bot.reply_to(message, "Only admins can perform this action.")
bot.polling(non_stop=True)
app.run()