Browse Source

Remove deprecated setting field

pull/10109/head
dolfies 5 months ago
parent
commit
a7554ba7d4
  1. 5
      discord/client.py
  2. 8
      discord/settings.py
  3. 19
      discord/utils.py
  4. 2
      discord/voice_client.py

5
discord/client.py

@ -2984,11 +2984,6 @@ class Client:
if friend_discovery_flags:
payload['friend_discovery_flags'] = friend_discovery_flags.value
guild_positions = kwargs.pop('guild_positions', None)
if guild_positions:
guild_positions = [str(x.id) for x in guild_positions]
payload['guild_positions'] = guild_positions
restricted_guilds = kwargs.pop('restricted_guilds', None)
if restricted_guilds:
restricted_guilds = [str(x.id) for x in restricted_guilds]

8
discord/settings.py

@ -1794,9 +1794,6 @@ class LegacyUserSettings:
How you get recommended friends.
gif_auto_play: :class:`bool`
Whether to automatically play GIFs that are in the chat.
guild_positions: List[:class:`~discord.abc.Snowflake`]
A list of guilds in order of the guild/guild icons that are on
the left hand side of the UI.
inline_attachment_media: :class:`bool`
Whether to display attachments when they are uploaded in chat.
inline_embed_media: :class:`bool`
@ -1891,11 +1888,6 @@ class LegacyUserSettings:
GuildFolder._from_legacy_settings(data=folder, state=state) for folder in getattr(self, '_guild_folders', [])
]
@property
def guild_positions(self) -> List[Guild]:
"""List[:class:`Guild`]: A list of guilds in order of the guild/guild icons that are on the left hand side of the UI."""
return list(map(self._get_guild, getattr(self, '_guild_positions', [])))
@property
def locale(self) -> Locale:
""":class:`Locale`: The :rfc:`3066` language identifier

19
discord/utils.py

@ -1453,9 +1453,13 @@ _CLIENT_ASSET_REGEX = re.compile(r'assets/([a-z0-9.]+)\.js')
_BUILD_NUMBER_REGEX = re.compile(r'build_number:"(\d+)"')
async def _get_info(session: ClientSession, proxy: Optional[str] = None, proxy_auth: Optional[aiohttp.BasicAuth] = None) -> Tuple[Dict[str, Any], str]:
async def _get_info(
session: ClientSession, proxy: Optional[str] = None, proxy_auth: Optional[aiohttp.BasicAuth] = None
) -> Tuple[Dict[str, Any], str]:
try:
async with session.post('https://cordapi.dolfi.es/api/v2/properties/web', timeout=5, proxy=proxy, proxy_auth=proxy_auth) as resp:
async with session.post(
'https://cordapi.dolfi.es/api/v2/properties/web', timeout=5, proxy=proxy, proxy_auth=proxy_auth
) as resp:
json = await resp.json()
return json['properties'], json['encoded']
except Exception:
@ -1493,7 +1497,9 @@ async def _get_info(session: ClientSession, proxy: Optional[str] = None, proxy_a
return properties, b64encode(_to_json(properties).encode()).decode('utf-8')
async def _get_build_number(session: ClientSession, proxy: Optional[str] = None, proxy_auth: Optional[aiohttp.BasicAuth] = None) -> int:
async def _get_build_number(
session: ClientSession, proxy: Optional[str] = None, proxy_auth: Optional[aiohttp.BasicAuth] = None
) -> int:
"""Fetches client build number"""
async with session.get('https://discord.com/login', proxy=proxy, proxy_auth=proxy_auth) as resp:
app = await resp.text()
@ -1512,11 +1518,14 @@ async def _get_build_number(session: ClientSession, proxy: Optional[str] = None,
raise RuntimeError('Could not find client build number')
async def _get_browser_version(session: ClientSession, proxy: Optional[str] = None, proxy_auth: Optional[aiohttp.BasicAuth] = None) -> str:
async def _get_browser_version(
session: ClientSession, proxy: Optional[str] = None, proxy_auth: Optional[aiohttp.BasicAuth] = None
) -> str:
"""Fetches the latest Windows 10/Chrome major browser version."""
async with session.get(
'https://versionhistory.googleapis.com/v1/chrome/platforms/win/channels/stable/versions',
proxy=proxy, proxy_auth=proxy_auth
proxy=proxy,
proxy_auth=proxy_auth,
) as response:
data = await response.json()
major = data['versions'][0]['version'].split('.')[0]

2
discord/voice_client.py

@ -268,7 +268,7 @@ class VoiceClient(VoiceProtocol):
'xsalsa20_poly1305_lite',
'xsalsa20_poly1305_suffix',
'xsalsa20_poly1305',
'aead_xchacha20_poly1305_rtpsize'
'aead_xchacha20_poly1305_rtpsize',
)
@property

Loading…
Cancel
Save