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:
2026-06-19 12:19:01 +02:00
parent 95cec59263
commit 7ba6bc44f2
104 changed files with 4338 additions and 5319 deletions
+42 -36
View File
@@ -14,17 +14,17 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
import datetime
import random
from pyrogram import Client, filters
from pyrogram.types import Message
import random
import datetime
from utils.misc import modules_help, prefix, userbot_version, python_version, gitrepo
from utils.misc import gitrepo, modules_help, prefix, python_version, userbot_version
@Client.on_message(filters.command(["support", "repo"], prefix) & filters.me)
@Client.on_message(filters.command(['support', 'repo'], prefix) & filters.me)
async def support(_, message: Message):
devs = ["@Qbtaumai", "@H4T3H46K3R"]
devs = ['@Qbtaumai', '@H4T3H46K3R']
random.shuffle(devs)
commands_count = 0.0
@@ -33,27 +33,27 @@ async def support(_, message: Message):
commands_count += 1
await message.edit(
f"<b>Moon-Userbot\n\n"
"GitHub: <a href=https://github.com/The-MoonTg-project/Moon-Userbot>Moon-Userbot</a>\n"
"Custom modules repository: <a href=https://github.com/The-MoonTg-project/custom_modules>"
"custom_modules</a>\n"
"License: <a href=https://github.com/The-MoonTg-project/Moon-Userbot/blob/master/LICENSE>GNU GPL v3</a>\n\n"
"Channel: @moonuserbot\n"
"Custom modules: @moonub_modules\n"
"Chat [EN]: @moonub_chat\n"
f"Main developers: {', '.join(devs)}\n\n"
f"Python version: {python_version}\n"
f"Modules count: {len(modules_help) / 1}\n"
f"Commands count: {commands_count}</b>",
f'<b>Moon-Userbot\n\n'
'GitHub: <a href=https://github.com/The-MoonTg-project/Moon-Userbot>Moon-Userbot</a>\n'
'Custom modules repository: <a href=https://github.com/The-MoonTg-project/custom_modules>'
'custom_modules</a>\n'
'License: <a href=https://github.com/The-MoonTg-project/Moon-Userbot/blob/master/LICENSE>GNU GPL v3</a>\n\n'
'Channel: @moonuserbot\n'
'Custom modules: @moonub_modules\n'
'Chat [EN]: @moonub_chat\n'
f'Main developers: {", ".join(devs)}\n\n'
f'Python version: {python_version}\n'
f'Modules count: {len(modules_help) / 1}\n'
f'Commands count: {commands_count}</b>',
disable_web_page_preview=True,
)
@Client.on_message(filters.command(["version", "ver"], prefix) & filters.me)
@Client.on_message(filters.command(['version', 'ver'], prefix) & filters.me)
async def version(client: Client, message: Message):
changelog = ""
ub_version = ".".join(userbot_version.split(".")[:2])
async for m in client.search_messages("moonuserbot", query=f"{userbot_version}."):
changelog = ''
ub_version = '.'.join(userbot_version.split('.')[:2])
async for m in client.search_messages('moonuserbot', query=f'{userbot_version}.'):
if ub_version in m.text:
changelog = m.message_id
@@ -63,26 +63,32 @@ async def version(client: Client, message: Message):
remote_url = list(gitrepo.remote().urls)[0]
commit_time = (
datetime.datetime.fromtimestamp(gitrepo.head.commit.committed_date)
.astimezone(datetime.timezone.utc)
.strftime("%Y-%m-%d %H:%M:%S %Z")
.astimezone(datetime.UTC)
.strftime('%Y-%m-%d %H:%M:%S %Z')
)
git_info = (
f"\n<b>Branch: <a href={remote_url}/tree/{gitrepo.active_branch}>{gitrepo.active_branch}</a>\n"
if gitrepo.active_branch != "master" else "\n"
) + f"Commit: <a href={remote_url}/commit/{gitrepo.head.commit.hexsha}>" f"{gitrepo.head.commit.hexsha[:7]}</a> by {gitrepo.head.commit.author.name}\n" f"Commit time: {commit_time}</b>"
(
f'\n<b>Branch: <a href={remote_url}/tree/{gitrepo.active_branch}>{gitrepo.active_branch}</a>\n'
if gitrepo.active_branch != 'master'
else '\n'
)
+ f'Commit: <a href={remote_url}/commit/{gitrepo.head.commit.hexsha}>'
f'{gitrepo.head.commit.hexsha[:7]}</a> by {gitrepo.head.commit.author.name}\n'
f'Commit time: {commit_time}</b>'
)
else:
git_info = ""
git_info = ''
await message.reply(
f"<b>Moon Userbot version: {userbot_version}\n"
f"Changelog </b><i><a href=https://t.me/moonuserbot/{changelog}>in channel</a></i>.<b>\n"
f"Changelog written by </b><i>"
f"<a href=https://t.me/Qbtaumai>Abhi</a></i>\n\n"
f"{git_info}",
f'<b>Moon Userbot version: {userbot_version}\n'
f'Changelog </b><i><a href=https://t.me/moonuserbot/{changelog}>in channel</a></i>.<b>\n'
f'Changelog written by </b><i>'
f'<a href=https://t.me/Qbtaumai>Abhi</a></i>\n\n'
f'{git_info}',
)
modules_help["support"] = {
"support": "Information about userbot",
"version": "Check userbot version",
modules_help['support'] = {
'support': 'Information about userbot',
'version': 'Check userbot version',
}