mirror of
https://github.com/yasirarism/MissKatyPyro.git
synced 2025-12-29 09:44:50 +00:00
Update tools.py
Signed-off-by: Yasir Aris M <git@yasir.id>
This commit is contained in:
parent
9d282eb721
commit
0b1777b916
1 changed files with 7 additions and 0 deletions
|
|
@ -6,6 +6,7 @@ import string
|
|||
import time
|
||||
from http.cookies import SimpleCookie
|
||||
from re import match as re_match
|
||||
from googletrans import Translator
|
||||
from typing import Union
|
||||
from urllib.parse import urlparse
|
||||
|
||||
|
|
@ -47,6 +48,12 @@ GENRES_EMOJI = {
|
|||
}
|
||||
|
||||
|
||||
async def gtranslate(text, source="auto", target="id"):
|
||||
async with Translator() as translator:
|
||||
result = await translator.translate(text, source, target)
|
||||
return result
|
||||
|
||||
|
||||
def is_url(url):
|
||||
url = re_match(URL_REGEX, url)
|
||||
return bool(url)
|
||||
|
|
|
|||
Loading…
Reference in a new issue