aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRapptz <[email protected]>2017-01-29 20:51:47 -0500
committerRapptz <[email protected]>2017-01-29 20:53:17 -0500
commite77012f4d91dfdb45813fb9fe906a7f791ca4fcf (patch)
tree16b2cd2fcaaea5f09c6c12b3d95bd6f3aac4018d
parentRemove unused Message._handle_upgrades function. (diff)
downloaddiscord.py-e77012f4d91dfdb45813fb9fe906a7f791ca4fcf.tar.xz
discord.py-e77012f4d91dfdb45813fb9fe906a7f791ca4fcf.zip
Make all public is_ functions into methods instead of properties.
-rw-r--r--discord/abc.py3
-rw-r--r--discord/client.py6
-rw-r--r--discord/member.py6
-rw-r--r--discord/role.py5
-rw-r--r--discord/shard.py5
-rw-r--r--examples/background_task.py2
6 files changed, 11 insertions, 16 deletions
diff --git a/discord/abc.py b/discord/abc.py
index 4b2f6d18..92475164 100644
--- a/discord/abc.py
+++ b/discord/abc.py
@@ -185,7 +185,6 @@ class GuildChannel:
ret.append(role)
return ret
- @property
def is_default(self):
"""bool : Indicates if this is the default channel for the :class:`Guild` it belongs to."""
return self.guild.id == self.id
@@ -330,7 +329,7 @@ class GuildChannel:
break
# default channels can always be read
- if self.is_default:
+ if self.is_default():
base.read_messages = True
# if you can't send a message in a channel then you can't have certain
diff --git a/discord/client.py b/discord/client.py
index 2e99b102..8cf5d00b 100644
--- a/discord/client.py
+++ b/discord/client.py
@@ -193,7 +193,6 @@ class Client:
"""List[:class:`VoiceClient`]: Represents a list of voice connections."""
return self.connection.voice_clients
- @property
def is_ready(self):
"""bool: Specifies if the client's internal cache is ready for use."""
return self._ready.is_set()
@@ -359,7 +358,7 @@ class Client:
"""
self.ws = yield from DiscordWebSocket.from_client(self)
- while not self.is_closed:
+ while not self.is_closed():
try:
yield from self.ws.poll_event()
except (ReconnectWebSocket, ResumeWebSocket) as e:
@@ -384,7 +383,7 @@ class Client:
Closes the connection to discord.
"""
- if self.is_closed:
+ if self.is_closed():
return
for voice in list(self.voice_clients):
@@ -458,7 +457,6 @@ class Client:
# properties
- @property
def is_closed(self):
"""bool: Indicates if the websocket connection is closed."""
return self._closed.is_set()
diff --git a/discord/member.py b/discord/member.py
index 77a81077..b3286994 100644
--- a/discord/member.py
+++ b/discord/member.py
@@ -49,7 +49,7 @@ class VoiceState:
Indicates if the user is currently muted by their own accord.
self_deaf: bool
Indicates if the user is currently deafened by their own accord.
- is_afk: bool
+ afk: bool
Indicates if the user is currently in the AFK channel in the guild.
channel: :class:`VoiceChannel`
The voice channel that the user is currently connected to. None if the user
@@ -57,7 +57,7 @@ class VoiceState:
"""
__slots__ = ( 'session_id', 'deaf', 'mute', 'self_mute',
- 'self_deaf', 'is_afk', 'channel' )
+ 'self_deaf', 'afk', 'channel' )
def __init__(self, *, data, channel=None):
self.session_id = data.get('session_id')
@@ -66,7 +66,7 @@ class VoiceState:
def _update(self, data, channel):
self.self_mute = data.get('self_mute', False)
self.self_deaf = data.get('self_deaf', False)
- self.is_afk = data.get('suppress', False)
+ self.afk = data.get('suppress', False)
self.mute = data.get('mute', False)
self.deaf = data.get('deaf', False)
self.channel = channel
diff --git a/discord/role.py b/discord/role.py
index fd07dd78..652a7fb5 100644
--- a/discord/role.py
+++ b/discord/role.py
@@ -135,7 +135,6 @@ class Role(Hashable):
self.mentionable = data.get('mentionable', False)
self.color = self.colour
- @property
def is_everyone(self):
"""Checks if the role is the @everyone role."""
return self.guild.id == self.id
@@ -154,7 +153,7 @@ class Role(Hashable):
def members(self):
"""Returns a list of :class:`Member` with this role."""
all_members = self.guild.members
- if self.is_everyone:
+ if self.is_everyone():
return all_members
ret = []
@@ -168,7 +167,7 @@ class Role(Hashable):
if position <= 0:
raise InvalidArgument("Cannot move role to position 0 or below")
- if self.is_everyone:
+ if self.is_everyone():
raise InvalidArgument("Cannot move default role")
if self.position == position:
diff --git a/discord/shard.py b/discord/shard.py
index 4ae9768e..7bb3a201 100644
--- a/discord/shard.py
+++ b/discord/shard.py
@@ -237,7 +237,7 @@ class AutoShardedClient(Client):
"""
yield from self.launch_shards()
- while not self.is_closed:
+ while not self.is_closed():
pollers = [shard.get_future() for shard in self.shards.values()]
yield from asyncio.wait(pollers, loop=self.loop, return_when=asyncio.FIRST_COMPLETED)
@@ -247,7 +247,7 @@ class AutoShardedClient(Client):
Closes the connection to discord.
"""
- if self.is_closed:
+ if self.is_closed():
return
for shard in self.shards.values():
@@ -255,7 +255,6 @@ class AutoShardedClient(Client):
yield from self.http.close()
self._closed.set()
- self._is_ready.clear()
@asyncio.coroutine
def change_presence(self, *, game=None, status=None, afk=False, shard_id=None):
diff --git a/examples/background_task.py b/examples/background_task.py
index f6d7abcf..a72862fb 100644
--- a/examples/background_task.py
+++ b/examples/background_task.py
@@ -18,7 +18,7 @@ class MyClient(discord.Client):
await self.wait_until_ready()
counter = 0
channel = self.get_channel(1234567) # channel ID goes here
- while not self.is_closed:
+ while not self.is_closed():
counter += 1
await channel.send(counter)
await asyncio.sleep(60) # task runs every 60 seconds