mirror of
https://github.com/Mayuri-Chan/pyrofork.git
synced 2025-12-29 12:04:51 +00:00
Update upgraded gift regex
Signed-off-by: wulan17 <wulan17@komodos.id>
This commit is contained in:
parent
9ff40dc90b
commit
b65279046e
3 changed files with 4 additions and 3 deletions
|
|
@ -231,6 +231,7 @@ class Client(Methods):
|
||||||
PARENT_DIR = Path(sys.argv[0]).parent
|
PARENT_DIR = Path(sys.argv[0]).parent
|
||||||
|
|
||||||
INVITE_LINK_RE = re.compile(r"^(?:https?://)?(?:www\.)?(?:t(?:elegram)?\.(?:org|me|dog)/(?:joinchat/|\+))([\w-]+)$")
|
INVITE_LINK_RE = re.compile(r"^(?:https?://)?(?:www\.)?(?:t(?:elegram)?\.(?:org|me|dog)/(?:joinchat/|\+))([\w-]+)$")
|
||||||
|
UPGRADED_GIFT_RE = re.compile(r"^(?:https?://)?(?:www\.)?(?:t(?:elegram)?\.(?:org|me|dog)/(?:nft/|\+))([\w-]+)$")
|
||||||
WORKERS = min(32, (os.cpu_count() or 0) + 4) # os.cpu_count() can be None
|
WORKERS = min(32, (os.cpu_count() or 0) + 4) # os.cpu_count() can be None
|
||||||
WORKDIR = PARENT_DIR
|
WORKDIR = PARENT_DIR
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ class GetUpgradedGift:
|
||||||
# Get information about upgraded gift by slug
|
# Get information about upgraded gift by slug
|
||||||
gift = await client.get_upgraded_gift("SignetRing-903")
|
gift = await client.get_upgraded_gift("SignetRing-903")
|
||||||
"""
|
"""
|
||||||
match = re.match(r"^(?:https?://)?(?:www\.)?(?:t(?:elegram)?\.(?:org|me|dog)/(?:nft/|\+))([\w-]+)$", link)
|
match = self.UPGRADED_GIFT_RE.match(link)
|
||||||
|
|
||||||
if match:
|
if match:
|
||||||
slug = match.group(1)
|
slug = match.group(1)
|
||||||
|
|
|
||||||
|
|
@ -62,8 +62,8 @@ class SetPinnedGifts:
|
||||||
if not isinstance(gift, str):
|
if not isinstance(gift, str):
|
||||||
raise ValueError(f"gift id has to be str, but {type(gift)} was provided")
|
raise ValueError(f"gift id has to be str, but {type(gift)} was provided")
|
||||||
|
|
||||||
saved_gift_match = re.match(r"^(-\d+)_(\d+)$", gift)
|
saved_gift_match = re.match(r"^(\d+)_(\d+)$", str(gift))
|
||||||
slug_match = self.UPGRADED_GIFT_RE.match(gift)
|
slug_match = self.UPGRADED_GIFT_RE.match(str(gift))
|
||||||
|
|
||||||
if saved_gift_match:
|
if saved_gift_match:
|
||||||
stargifts.append(
|
stargifts.append(
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue