chore(userbot): apply ruff check --fix and ruff format
- ruff check --fix: 210 auto-fixed errors (import sorting, trailing whitespace, unused imports, f-string fixups, deprecated annotations) - ruff format: 104 files reformatted to consistent style - 268 non-auto-fixable issues remain (S113 requests timeout, etc.)
This commit is contained in:
+7
-14
@@ -14,21 +14,16 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
from pyrogram import Client, filters, enums
|
||||
from pyrogram import Client, enums, filters
|
||||
from pyrogram.types import Message
|
||||
|
||||
from utils.misc import modules_help, prefix
|
||||
|
||||
ru_keys = (
|
||||
"""ёйцукенгшщзхъфывапролджэячсмитьбю.Ё"№;%:?ЙЦУКЕНГШЩЗХЪФЫВАПРОЛДЖЭ/ЯЧСМИТЬБЮ,"""
|
||||
)
|
||||
en_keys = (
|
||||
"""`qwertyuiop[]asdfghjkl;'zxcvbnm,./~@#$%^&QWERTYUIOP{}ASDFGHJKL:"|ZXCVBNM<>?"""
|
||||
)
|
||||
ru_keys = """ёйцукенгшщзхъфывапролджэячсмитьбю.Ё"№;%:?ЙЦУКЕНГШЩЗХЪФЫВАПРОЛДЖЭ/ЯЧСМИТЬБЮ,"""
|
||||
en_keys = """`qwertyuiop[]asdfghjkl;'zxcvbnm,./~@#$%^&QWERTYUIOP{}ASDFGHJKL:"|ZXCVBNM<>?"""
|
||||
table = str.maketrans(ru_keys + en_keys, en_keys + ru_keys)
|
||||
|
||||
|
||||
@Client.on_message(filters.command(["switch", "sw"], prefix) & filters.me)
|
||||
@Client.on_message(filters.command(['switch', 'sw'], prefix) & filters.me)
|
||||
async def switch(client: Client, message: Message):
|
||||
if len(message.command) == 1:
|
||||
if message.reply_to_message:
|
||||
@@ -38,9 +33,7 @@ async def switch(client: Client, message: Message):
|
||||
if history and history[1].from_user.is_self and history[1].text:
|
||||
text = history[1].text
|
||||
else:
|
||||
await message.edit(
|
||||
"<b>Text to switch not found</b>", parse_mode=enums.ParseMode.HTML
|
||||
)
|
||||
await message.edit('<b>Text to switch not found</b>', parse_mode=enums.ParseMode.HTML)
|
||||
return
|
||||
else:
|
||||
text = message.text.split(maxsplit=1)[1]
|
||||
@@ -48,6 +41,6 @@ async def switch(client: Client, message: Message):
|
||||
await message.edit(str.translate(text, table), parse_mode=enums.ParseMode.HTML)
|
||||
|
||||
|
||||
modules_help["switch"] = {
|
||||
"sw [reply/text for switch]*": "Useful when you forgot to change the keyboard layout[RU]",
|
||||
modules_help['switch'] = {
|
||||
'sw [reply/text for switch]*': 'Useful when you forgot to change the keyboard layout[RU]',
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user