mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-06-05 11:27:13 +00:00
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,
|
activity: Optional[BaseActivity] = None,
|
||||||
status: Optional[Status] = None,
|
status: Optional[Status] = None,
|
||||||
afk: bool = False,
|
|
||||||
):
|
):
|
||||||
"""|coro|
|
"""|coro|
|
||||||
|
|
||||||
@ -981,6 +980,9 @@ class Client:
|
|||||||
game = discord.Game("with the API")
|
game = discord.Game("with the API")
|
||||||
await client.change_presence(status=discord.Status.idle, activity=game)
|
await client.change_presence(status=discord.Status.idle, activity=game)
|
||||||
|
|
||||||
|
.. versionchanged:: 2.0
|
||||||
|
Removed the ``afk`` keyword-only parameter.
|
||||||
|
|
||||||
Parameters
|
Parameters
|
||||||
----------
|
----------
|
||||||
activity: Optional[:class:`.BaseActivity`]
|
activity: Optional[:class:`.BaseActivity`]
|
||||||
@ -988,10 +990,6 @@ class Client:
|
|||||||
status: Optional[:class:`.Status`]
|
status: Optional[:class:`.Status`]
|
||||||
Indicates what status to change to. If ``None``, then
|
Indicates what status to change to. If ``None``, then
|
||||||
:attr:`.Status.online` is used.
|
: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
|
Raises
|
||||||
------
|
------
|
||||||
@ -1008,7 +1006,7 @@ class Client:
|
|||||||
else:
|
else:
|
||||||
status_str = str(status)
|
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:
|
for guild in self._connection.guilds:
|
||||||
me = guild.me
|
me = guild.me
|
||||||
|
@ -594,7 +594,7 @@ class DiscordWebSocket:
|
|||||||
if not self._can_handle_close():
|
if not self._can_handle_close():
|
||||||
raise ConnectionClosed(self.socket, shard_id=self.shard_id) from exc
|
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 activity is not None:
|
||||||
if not isinstance(activity, BaseActivity):
|
if not isinstance(activity, BaseActivity):
|
||||||
raise InvalidArgument('activity must derive from BaseActivity.')
|
raise InvalidArgument('activity must derive from BaseActivity.')
|
||||||
@ -609,7 +609,7 @@ class DiscordWebSocket:
|
|||||||
'op': self.PRESENCE,
|
'op': self.PRESENCE,
|
||||||
'd': {
|
'd': {
|
||||||
'activities': activity,
|
'activities': activity,
|
||||||
'afk': afk,
|
'afk': False,
|
||||||
'since': since,
|
'since': since,
|
||||||
'status': status
|
'status': status
|
||||||
}
|
}
|
||||||
@ -718,7 +718,7 @@ class DiscordVoiceWebSocket:
|
|||||||
|
|
||||||
async def _hook(self, *args):
|
async def _hook(self, *args):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
async def send_as_json(self, data):
|
async def send_as_json(self, data):
|
||||||
log.debug('Sending voice websocket frame: %s.', data)
|
log.debug('Sending voice websocket frame: %s.', data)
|
||||||
await self.ws.send_str(utils.to_json(data))
|
await self.ws.send_str(utils.to_json(data))
|
||||||
@ -823,7 +823,7 @@ class DiscordVoiceWebSocket:
|
|||||||
interval = data['heartbeat_interval'] / 1000.0
|
interval = data['heartbeat_interval'] / 1000.0
|
||||||
self._keep_alive = VoiceKeepAliveHandler(ws=self, interval=min(interval, 5.0))
|
self._keep_alive = VoiceKeepAliveHandler(ws=self, interval=min(interval, 5.0))
|
||||||
self._keep_alive.start()
|
self._keep_alive.start()
|
||||||
|
|
||||||
await self._hook(self, msg)
|
await self._hook(self, msg)
|
||||||
|
|
||||||
async def initial_connection(self, data):
|
async def initial_connection(self, data):
|
||||||
|
@ -436,7 +436,7 @@ class AutoShardedClient(Client):
|
|||||||
await self.http.close()
|
await self.http.close()
|
||||||
self.__queue.put_nowait(EventItem(EventType.clean_close, None, None))
|
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|
|
"""|coro|
|
||||||
|
|
||||||
Changes the client's presence.
|
Changes the client's presence.
|
||||||
@ -446,6 +446,9 @@ class AutoShardedClient(Client):
|
|||||||
game = discord.Game("with the API")
|
game = discord.Game("with the API")
|
||||||
await client.change_presence(status=discord.Status.idle, activity=game)
|
await client.change_presence(status=discord.Status.idle, activity=game)
|
||||||
|
|
||||||
|
.. versionchanged:: 2.0
|
||||||
|
Removed the ``afk`` keyword-only parameter.
|
||||||
|
|
||||||
Parameters
|
Parameters
|
||||||
----------
|
----------
|
||||||
activity: Optional[:class:`BaseActivity`]
|
activity: Optional[:class:`BaseActivity`]
|
||||||
@ -453,10 +456,6 @@ class AutoShardedClient(Client):
|
|||||||
status: Optional[:class:`Status`]
|
status: Optional[:class:`Status`]
|
||||||
Indicates what status to change to. If ``None``, then
|
Indicates what status to change to. If ``None``, then
|
||||||
:attr:`Status.online` is used.
|
: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`]
|
shard_id: Optional[:class:`int`]
|
||||||
The shard_id to change the presence to. If not specified
|
The shard_id to change the presence to. If not specified
|
||||||
or ``None``, then it will change the presence of every
|
or ``None``, then it will change the presence of every
|
||||||
@ -480,12 +479,12 @@ class AutoShardedClient(Client):
|
|||||||
|
|
||||||
if shard_id is None:
|
if shard_id is None:
|
||||||
for shard in self.__shards.values():
|
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
|
guilds = self._connection.guilds
|
||||||
else:
|
else:
|
||||||
shard = self.__shards[shard_id]
|
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]
|
guilds = [g for g in self._connection.guilds if g.shard_id == shard_id]
|
||||||
|
|
||||||
activities = () if activity is None else (activity,)
|
activities = () if activity is None else (activity,)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user