Source code for slidcord
import discord.utils
from slidge import entrypoint
from slidge.util.util import get_version # noqa: F401
from . import commands, config, contact, gateway, group, session # noqa: F401
[docs]async def _get_build_number(sess) -> int:
"""Fetches client build number"""
default_build_number = 9999
try:
login_page_request = await sess.get("https://discord.com/login", timeout=7)
login_page = await login_page_request.text()
build_url = (
"https://discord.com/assets/"
+ discord.utils.re.compile(r"assets/+([a-z0-9.]+)\.js").findall(login_page)[
-2
]
+ ".js"
)
build_request = await sess.get(build_url, timeout=7)
build_file = await build_request.text()
build_find = discord.utils.re.findall(r'Build Number:\D+"(\d+)"', build_file)
return int(build_find[0]) if build_find else default_build_number
except Exception:
discord.utils._log.critical(
"Could not fetch client build number. Falling back to hardcoded value..."
)
return default_build_number
discord.utils._get_build_number = _get_build_number # type: ignore