mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-04-18 23:15:48 +00:00
Make all public is_ functions into methods instead of properties.
This commit is contained in:
parent
01c17704bc
commit
e77012f4d9
@ -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
|
||||
|
@ -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()
|
||||
|
@ -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
|
||||
|
@ -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:
|
||||
|
@ -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):
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user