mirror of
https://github.com/Fluffy-Bean/Lynxie.git
synced 2025-05-14 08:02:17 +00:00
Merge pull request #7 from Fluffy-Bean/deepsource-autofix-49797130
refactor unnecessary `else` / `elif` when `if` block has a `raise` statement
This commit is contained in:
commit
c9fdd818bf
1 changed files with 25 additions and 23 deletions
|
@ -8,40 +8,42 @@ from discord.gateway import _log
|
||||||
|
|
||||||
async def mobile_status(self):
|
async def mobile_status(self):
|
||||||
payload = {
|
payload = {
|
||||||
'op': self.IDENTIFY,
|
"op": self.IDENTIFY,
|
||||||
'd': {
|
"d": {
|
||||||
'token': self.token,
|
"token": self.token,
|
||||||
'properties': {
|
"properties": {
|
||||||
'$os': sys.platform,
|
"$os": sys.platform,
|
||||||
'$browser': 'Discord Android',
|
"$browser": "Discord Android",
|
||||||
'$device': 'Discord Android',
|
"$device": "Discord Android",
|
||||||
'$referrer': '',
|
"$referrer": "",
|
||||||
'$referring_domain': ''
|
"$referring_domain": "",
|
||||||
},
|
},
|
||||||
'compress': True,
|
"compress": True,
|
||||||
'large_threshold': 250,
|
"large_threshold": 250,
|
||||||
'v': 3
|
"v": 3,
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
if self.shard_id is not None and self.shard_count is not None:
|
if self.shard_id is not None and self.shard_count is not None:
|
||||||
payload['d']['shard'] = [self.shard_id, self.shard_count]
|
payload["d"]["shard"] = [self.shard_id, self.shard_count]
|
||||||
|
|
||||||
state = self._connection
|
state = self._connection
|
||||||
if state._activity is not None or state._status is not None:
|
if state._activity is not None or state._status is not None:
|
||||||
payload['d']['presence'] = {
|
payload["d"]["presence"] = {
|
||||||
'status': state._status,
|
"status": state._status,
|
||||||
'game': state._activity,
|
"game": state._activity,
|
||||||
'since': 0,
|
"since": 0,
|
||||||
'afk': False
|
"afk": False,
|
||||||
}
|
}
|
||||||
|
|
||||||
if state._intents is not None:
|
if state._intents is not None:
|
||||||
payload['d']['intents'] = state._intents.value
|
payload["d"]["intents"] = state._intents.value
|
||||||
|
|
||||||
await self.call_hooks('before_identify', self.shard_id, initial=self._initial_identify)
|
await self.call_hooks(
|
||||||
|
"before_identify", self.shard_id, initial=self._initial_identify
|
||||||
|
)
|
||||||
await self.send_as_json(payload)
|
await self.send_as_json(payload)
|
||||||
_log.info('Shard ID %s has sent the IDENTIFY payload.', self.shard_id)
|
_log.info("Shard ID %s has sent the IDENTIFY payload.", self.shard_id)
|
||||||
|
|
||||||
|
|
||||||
def error_message(error: str) -> discord.Embed:
|
def error_message(error: str) -> discord.Embed:
|
||||||
|
@ -63,7 +65,7 @@ def get_env_or_error(env: str) -> str:
|
||||||
|
|
||||||
if from_file is None and from_env is None:
|
if from_file is None and from_env is None:
|
||||||
raise KeyError(f"Environment variable {env} not found")
|
raise KeyError(f"Environment variable {env} not found")
|
||||||
elif from_file is None:
|
if from_file is None:
|
||||||
return from_env
|
return from_env
|
||||||
else:
|
else:
|
||||||
return from_file
|
return from_file
|
||||||
|
|
Loading…
Add table
Reference in a new issue