-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathswitch.py
More file actions
25 lines (24 loc) · 1.18 KB
/
switch.py
File metadata and controls
25 lines (24 loc) · 1.18 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
import asyncio
from pyrogram import Client, filters
from command import fox_command, fox_sudo, who_message
import os
@Client.on_message(fox_command("sw", "Switch", os.path.basename(__file__), "[reply|text]") & fox_sudo())
async def switch(client, message):
message = await who_message(client, message)
text = " ".join(message.command[1:])
ru_keys = """ёйцукенгшщзхъфывапролджэячсмитьбю.Ё"№;%:?ЙЦУКЕНГШЩЗХЪФЫВАПРОЛДЖЭ/ЯЧСМИТЬБЮ,"""
en_keys = """`qwertyuiop[]asdfghjkl;'zxcvbnm,./~@#$%^&QWERTYUIOP{}ASDFGHJKL:"|ZXCVBNM<>?"""
if text == "":
if message.reply_to_message:
reply_text = message.reply_to_message.text
change = str.maketrans(ru_keys + en_keys, en_keys + ru_keys)
reply_text = str.translate(reply_text, change)
await message.edit(reply_text)
else:
await message.edit("Text not found")
await asyncio.sleep(3)
await message.delete()
else:
change = str.maketrans(ru_keys + en_keys, en_keys + ru_keys)
text = str.translate(text, change)
await message.edit(text)