Remove afk parameter from change_presence
This commit is contained in:
parent
0faf4c8e2b
commit
15eb3d2e5d
@ -967,7 +967,6 @@ class Client:
|
||||
*,
|
||||
activity: Optional[BaseActivity] = None,
|
||||
status: Optional[Status] = None,
|
||||
afk: bool = False,
|
||||
):
|
||||
"""|coro|
|
||||
|
||||
@ -981,6 +980,9 @@ class Client:
|
||||
game = discord.Game("with the API")
|
||||
await client.change_presence(status=discord.Status.idle, activity=game)
|
||||
|
||||
.. versionchanged:: 2.0
|
||||
Removed the ``afk`` keyword-only parameter.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
activity: Optional[:class:`.BaseActivity`]
|
||||
@ -988,10 +990,6 @@ class Client:
|
||||
status: Optional[:class:`.Status`]
|
||||
Indicates what status to change to. If ``None``, then
|
||||
:attr:`.Status.online` is used.
|
||||
afk: Optional[:class:`bool`]
|
||||
Indicates if you are going AFK. This allows the discord
|
||||
client to know how to handle push notifications better
|
||||
for you in case you are actually idle and not lying.
|
||||
|
||||
Raises
|
||||
------
|
||||
@ -1008,7 +1006,7 @@ class Client:
|
||||
else:
|
||||
status_str = str(status)
|
||||
|
||||
await self.ws.change_presence(activity=activity, status=status_str, afk=afk)
|
||||
await self.ws.change_presence(activity=activity, status=status_str)
|
||||
|
||||
for guild in self._connection.guilds:
|
||||
me = guild.me
|
||||
|
@ -594,7 +594,7 @@ class DiscordWebSocket:
|
||||
if not self._can_handle_close():
|
||||
raise ConnectionClosed(self.socket, shard_id=self.shard_id) from exc
|
||||
|
||||
async def change_presence(self, *, activity=None, status=None, afk=False, since=0.0):
|
||||
async def change_presence(self, *, activity=None, status=None, since=0.0):
|
||||
if activity is not None:
|
||||
if not isinstance(activity, BaseActivity):
|
||||
raise InvalidArgument('activity must derive from BaseActivity.')
|
||||
@ -609,7 +609,7 @@ class DiscordWebSocket:
|
||||
'op': self.PRESENCE,
|
||||
'd': {
|
||||
'activities': activity,
|
||||
'afk': afk,
|
||||
'afk': False,
|
||||
'since': since,
|
||||
'status': status
|
||||
}
|
||||
@ -718,7 +718,7 @@ class DiscordVoiceWebSocket:
|
||||
|
||||
async def _hook(self, *args):
|
||||
pass
|
||||
|
||||
|
||||
async def send_as_json(self, data):
|
||||
log.debug('Sending voice websocket frame: %s.', data)
|
||||
await self.ws.send_str(utils.to_json(data))
|
||||
@ -823,7 +823,7 @@ class DiscordVoiceWebSocket:
|
||||
interval = data['heartbeat_interval'] / 1000.0
|
||||
self._keep_alive = VoiceKeepAliveHandler(ws=self, interval=min(interval, 5.0))
|
||||
self._keep_alive.start()
|
||||
|
||||
|
||||
await self._hook(self, msg)
|
||||
|
||||
async def initial_connection(self, data):
|
||||
|
@ -436,7 +436,7 @@ class AutoShardedClient(Client):
|
||||
await self.http.close()
|
||||
self.__queue.put_nowait(EventItem(EventType.clean_close, None, None))
|
||||
|
||||
async def change_presence(self, *, activity=None, status=None, afk=False, shard_id=None):
|
||||
async def change_presence(self, *, activity=None, status=None, shard_id=None):
|
||||
"""|coro|
|
||||
|
||||
Changes the client's presence.
|
||||
@ -446,6 +446,9 @@ class AutoShardedClient(Client):
|
||||
game = discord.Game("with the API")
|
||||
await client.change_presence(status=discord.Status.idle, activity=game)
|
||||
|
||||
.. versionchanged:: 2.0
|
||||
Removed the ``afk`` keyword-only parameter.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
activity: Optional[:class:`BaseActivity`]
|
||||
@ -453,10 +456,6 @@ class AutoShardedClient(Client):
|
||||
status: Optional[:class:`Status`]
|
||||
Indicates what status to change to. If ``None``, then
|
||||
:attr:`Status.online` is used.
|
||||
afk: :class:`bool`
|
||||
Indicates if you are going AFK. This allows the discord
|
||||
client to know how to handle push notifications better
|
||||
for you in case you are actually idle and not lying.
|
||||
shard_id: Optional[:class:`int`]
|
||||
The shard_id to change the presence to. If not specified
|
||||
or ``None``, then it will change the presence of every
|
||||
@ -480,12 +479,12 @@ class AutoShardedClient(Client):
|
||||
|
||||
if shard_id is None:
|
||||
for shard in self.__shards.values():
|
||||
await shard.ws.change_presence(activity=activity, status=status, afk=afk)
|
||||
await shard.ws.change_presence(activity=activity, status=status)
|
||||
|
||||
guilds = self._connection.guilds
|
||||
else:
|
||||
shard = self.__shards[shard_id]
|
||||
await shard.ws.change_presence(activity=activity, status=status, afk=afk)
|
||||
await shard.ws.change_presence(activity=activity, status=status)
|
||||
guilds = [g for g in self._connection.guilds if g.shard_id == shard_id]
|
||||
|
||||
activities = () if activity is None else (activity,)
|
||||
|
Loading…
x
Reference in New Issue
Block a user