-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtrans.py
57 lines (42 loc) · 1.79 KB
/
trans.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
import telethon
from telethon import events
from googletrans import Translator, constants
from config import *
from help import *
tran = Translator()
@sedthon.on(events.NewMessage(pattern=r"\.ترجمة الى العربية", outgoing=True))
async def _(event):
reply_message = await event.get_reply_message()
mes = reply_message.text
res = tran.translate(str(mes), dest="ar")
await event.edit(res.text)
@sedthon.on(events.NewMessage(pattern=r"\.ترجمة الى الانجليزية", outgoing=True))
async def _(event):
reply_message = await event.get_reply_message()
mes = reply_message.text
res = tran.translate(str(mes), dest="en")
await event.edit(res.text)
@sedthon.on(events.NewMessage(pattern=r"\.ترجمة الى الفرنسية", outgoing=True))
async def _(event):
reply_message = await event.get_reply_message()
mes = reply_message.text
res = tran.translate(str(mes), dest="fr")
await event.edit(res.text)
@sedthon.on(events.NewMessage(pattern=r"\.ترجمة الى الروسية", outgoing=True))
async def _(event):
reply_message = await event.get_reply_message()
mes = reply_message.text
res = tran.translate(str(mes), dest="ru")
await event.edit(res.text)
@sedthon.on(events.NewMessage(pattern=r"\.ترجمة الى الاسبانية", outgoing=True))
async def _(event):
reply_message = await event.get_reply_message()
mes = reply_message.text
res = tran.translate(str(mes), dest="es")
await event.edit(res.text)
@sedthon.on(events.NewMessage(pattern=r"\.الترجمة", outgoing=True))
async def _(event):
await event.edit(trans)
@sedthon.on(events.NewMessage(pattern=r"\.اللغات", outgoing=True))
async def _(event):
await event.edit(langs)