Make all public is_ functions into methods instead of properties.
This commit is contained in:
		| @@ -185,7 +185,6 @@ class GuildChannel: | |||||||
|             ret.append(role) |             ret.append(role) | ||||||
|         return ret |         return ret | ||||||
|  |  | ||||||
|     @property |  | ||||||
|     def is_default(self): |     def is_default(self): | ||||||
|         """bool : Indicates if this is the default channel for the :class:`Guild` it belongs to.""" |         """bool : Indicates if this is the default channel for the :class:`Guild` it belongs to.""" | ||||||
|         return self.guild.id == self.id |         return self.guild.id == self.id | ||||||
| @@ -330,7 +329,7 @@ class GuildChannel: | |||||||
|                 break |                 break | ||||||
|  |  | ||||||
|         # default channels can always be read |         # default channels can always be read | ||||||
|         if self.is_default: |         if self.is_default(): | ||||||
|             base.read_messages = True |             base.read_messages = True | ||||||
|  |  | ||||||
|         # if you can't send a message in a channel then you can't have certain |         # if you can't send a message in a channel then you can't have certain | ||||||
|   | |||||||
| @@ -193,7 +193,6 @@ class Client: | |||||||
|         """List[:class:`VoiceClient`]: Represents a list of voice connections.""" |         """List[:class:`VoiceClient`]: Represents a list of voice connections.""" | ||||||
|         return self.connection.voice_clients |         return self.connection.voice_clients | ||||||
|  |  | ||||||
|     @property |  | ||||||
|     def is_ready(self): |     def is_ready(self): | ||||||
|         """bool: Specifies if the client's internal cache is ready for use.""" |         """bool: Specifies if the client's internal cache is ready for use.""" | ||||||
|         return self._ready.is_set() |         return self._ready.is_set() | ||||||
| @@ -359,7 +358,7 @@ class Client: | |||||||
|         """ |         """ | ||||||
|         self.ws = yield from DiscordWebSocket.from_client(self) |         self.ws = yield from DiscordWebSocket.from_client(self) | ||||||
|  |  | ||||||
|         while not self.is_closed: |         while not self.is_closed(): | ||||||
|             try: |             try: | ||||||
|                 yield from self.ws.poll_event() |                 yield from self.ws.poll_event() | ||||||
|             except (ReconnectWebSocket, ResumeWebSocket) as e: |             except (ReconnectWebSocket, ResumeWebSocket) as e: | ||||||
| @@ -384,7 +383,7 @@ class Client: | |||||||
|  |  | ||||||
|         Closes the connection to discord. |         Closes the connection to discord. | ||||||
|         """ |         """ | ||||||
|         if self.is_closed: |         if self.is_closed(): | ||||||
|             return |             return | ||||||
|  |  | ||||||
|         for voice in list(self.voice_clients): |         for voice in list(self.voice_clients): | ||||||
| @@ -458,7 +457,6 @@ class Client: | |||||||
|  |  | ||||||
|     # properties |     # properties | ||||||
|  |  | ||||||
|     @property |  | ||||||
|     def is_closed(self): |     def is_closed(self): | ||||||
|         """bool: Indicates if the websocket connection is closed.""" |         """bool: Indicates if the websocket connection is closed.""" | ||||||
|         return self._closed.is_set() |         return self._closed.is_set() | ||||||
|   | |||||||
| @@ -49,7 +49,7 @@ class VoiceState: | |||||||
|         Indicates if the user is currently muted by their own accord. |         Indicates if the user is currently muted by their own accord. | ||||||
|     self_deaf: bool |     self_deaf: bool | ||||||
|         Indicates if the user is currently deafened by their own accord. |         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. |         Indicates if the user is currently in the AFK channel in the guild. | ||||||
|     channel: :class:`VoiceChannel` |     channel: :class:`VoiceChannel` | ||||||
|         The voice channel that the user is currently connected to. None if the user |         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', |     __slots__ = ( 'session_id', 'deaf', 'mute', 'self_mute', | ||||||
|                   'self_deaf', 'is_afk', 'channel' ) |                   'self_deaf', 'afk', 'channel' ) | ||||||
|  |  | ||||||
|     def __init__(self, *, data, channel=None): |     def __init__(self, *, data, channel=None): | ||||||
|         self.session_id = data.get('session_id') |         self.session_id = data.get('session_id') | ||||||
| @@ -66,7 +66,7 @@ class VoiceState: | |||||||
|     def _update(self, data, channel): |     def _update(self, data, channel): | ||||||
|         self.self_mute = data.get('self_mute', False) |         self.self_mute = data.get('self_mute', False) | ||||||
|         self.self_deaf = data.get('self_deaf', 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.mute = data.get('mute', False) | ||||||
|         self.deaf = data.get('deaf', False) |         self.deaf = data.get('deaf', False) | ||||||
|         self.channel = channel |         self.channel = channel | ||||||
|   | |||||||
| @@ -135,7 +135,6 @@ class Role(Hashable): | |||||||
|         self.mentionable = data.get('mentionable', False) |         self.mentionable = data.get('mentionable', False) | ||||||
|         self.color = self.colour |         self.color = self.colour | ||||||
|  |  | ||||||
|     @property |  | ||||||
|     def is_everyone(self): |     def is_everyone(self): | ||||||
|         """Checks if the role is the @everyone role.""" |         """Checks if the role is the @everyone role.""" | ||||||
|         return self.guild.id == self.id |         return self.guild.id == self.id | ||||||
| @@ -154,7 +153,7 @@ class Role(Hashable): | |||||||
|     def members(self): |     def members(self): | ||||||
|         """Returns a list of :class:`Member` with this role.""" |         """Returns a list of :class:`Member` with this role.""" | ||||||
|         all_members = self.guild.members |         all_members = self.guild.members | ||||||
|         if self.is_everyone: |         if self.is_everyone(): | ||||||
|             return all_members |             return all_members | ||||||
|  |  | ||||||
|         ret = [] |         ret = [] | ||||||
| @@ -168,7 +167,7 @@ class Role(Hashable): | |||||||
|         if position <= 0: |         if position <= 0: | ||||||
|             raise InvalidArgument("Cannot move role to position 0 or below") |             raise InvalidArgument("Cannot move role to position 0 or below") | ||||||
|  |  | ||||||
|         if self.is_everyone: |         if self.is_everyone(): | ||||||
|             raise InvalidArgument("Cannot move default role") |             raise InvalidArgument("Cannot move default role") | ||||||
|  |  | ||||||
|         if self.position == position: |         if self.position == position: | ||||||
|   | |||||||
| @@ -237,7 +237,7 @@ class AutoShardedClient(Client): | |||||||
|         """ |         """ | ||||||
|         yield from self.launch_shards() |         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()] |             pollers = [shard.get_future() for shard in self.shards.values()] | ||||||
|             yield from asyncio.wait(pollers, loop=self.loop, return_when=asyncio.FIRST_COMPLETED) |             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. |         Closes the connection to discord. | ||||||
|         """ |         """ | ||||||
|         if self.is_closed: |         if self.is_closed(): | ||||||
|             return |             return | ||||||
|  |  | ||||||
|         for shard in self.shards.values(): |         for shard in self.shards.values(): | ||||||
| @@ -255,7 +255,6 @@ class AutoShardedClient(Client): | |||||||
|  |  | ||||||
|         yield from self.http.close() |         yield from self.http.close() | ||||||
|         self._closed.set() |         self._closed.set() | ||||||
|         self._is_ready.clear() |  | ||||||
|  |  | ||||||
|     @asyncio.coroutine |     @asyncio.coroutine | ||||||
|     def change_presence(self, *, game=None, status=None, afk=False, shard_id=None): |     def change_presence(self, *, game=None, status=None, afk=False, shard_id=None): | ||||||
|   | |||||||
| @@ -18,7 +18,7 @@ class MyClient(discord.Client): | |||||||
|         await self.wait_until_ready() |         await self.wait_until_ready() | ||||||
|         counter = 0 |         counter = 0 | ||||||
|         channel = self.get_channel(1234567) # channel ID goes here |         channel = self.get_channel(1234567) # channel ID goes here | ||||||
|         while not self.is_closed: |         while not self.is_closed(): | ||||||
|             counter += 1 |             counter += 1 | ||||||
|             await channel.send(counter) |             await channel.send(counter) | ||||||
|             await asyncio.sleep(60) # task runs every 60 seconds |             await asyncio.sleep(60) # task runs every 60 seconds | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user