fixed a bug with inaccurate requests in fheta

pull/25/head
Who? 2024-11-24 00:03:43 +07:00 committed by GitHub
parent e7331e2840
commit dc735166b4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 7 additions and 3 deletions

View File

@ -99,9 +99,9 @@ class FHeta(loader.Module):
module_names = [module['name'] for module in all_modules if 'name' in module]
closest_matches = difflib.get_close_matches(args, module_names, n=1, cutoff=0.5)
if closest_matches:
closest_module = next((m for m in all_modules if m['name'] == closest_matches[0]), None)
closest_module = next((m for m in all_modules if isinstance(m, dict) and 'name' in m and m['name'] == closest_matches[0]), None)
if closest_module:
formatted_module = await self.format_module(closest_module, args)
banner_url = closest_module.get("banner", None)
@ -276,6 +276,10 @@ class FHeta(loader.Module):
return found_modules
async def client_ready(self):
from telethon.tl.functions.channels import JoinChannelRequest
await self.client(JoinChannelRequest("fmodules"))
async def format_module(self, module, query):
repo_url = f"https://github.com/{module['repo']}"
install = module['install']
@ -328,4 +332,4 @@ class FHeta(loader.Module):
install_command=f"{self.get_prefix()}{install}",
description=description_section,
commands=commands_section + inline_commands_section
)
)