Adaminfo commited on
Commit
4a52810
·
verified ·
1 Parent(s): 3baec8f

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +38 -0
app.py ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import telebot
2
+ from telebot import apihelper
3
+
4
+ # تۆکنەکەت
5
+ API_TOKEN = '8348414728:AAEjH3r-OCM9DcyqmlD_K67MGfvG2u1Up_A'
6
+
7
+ # چارەسەری کێشەی پەیوەندی (پڕۆکسی)
8
+ # ئەمە یارمەتی سێرڤەرەکە دەدات ئەگەر تێلیگرام بلۆک بوو
9
+ apihelper.SESSION_TIME_OUT = 60
10
+
11
+ bot = telebot.TeleBot(API_TOKEN)
12
+
13
+ mapping = {
14
+ 'ڵ': 'll', 'ڕ': 'rr', 'چ': 'ch', 'ژ': 'zh', 'ۆ': 'o',
15
+ 'ێ': 'e', 'و': 'u', 'ی': 'y', 'گ': 'g', 'ڤ': 'v',
16
+ 'پ': 'p', 'ە': 'a', 'خ': 'kh', 'ح': 'h', 'ق': 'q',
17
+ 'ش': 'sh', 'ف': 'f', 'ک': 'k', 'ئ': '', 'ت': 't',
18
+ 'ب': 'b', 'ج': 'j', 'د': 'd', 'ر': 'r', 'ز': 'z',
19
+ 'س': 's', 'ل': 'l', 'م': 'm', 'ن': 'n', 'ه': 'h'
20
+ }
21
+
22
+ @bot.message_handler(commands=['start'])
23
+ def start(message):
24
+ bot.reply_to(message, "سڵاو! پەیام بنێرە تا بۆت بکەم بە لاتینی.")
25
+
26
+ @bot.message_handler(func=lambda message: True)
27
+ def translate(message):
28
+ text = message.text
29
+ for k, v in mapping.items():
30
+ text = text.replace(k, v)
31
+ bot.reply_to(message, f"ئامادەیە:\n`{text}`", parse_mode='Markdown')
32
+
33
+ # هەوڵدان بۆ پەیوەندی بەردەوام
34
+ try:
35
+ print("Bot is starting...")
36
+ bot.infinity_polling(timeout=60, long_polling_timeout=30)
37
+ except Exception as e:
38
+ print(f"Error: {e}")