style (settings): Don't display deleted channels.
Hides deleted or inexistent channels in the formatted settings.
This commit is contained in:
@@ -295,13 +295,17 @@ class Channel(SettingType):
|
|||||||
@classmethod
|
@classmethod
|
||||||
def _format_data(cls, id: int, data: Optional[int], **kwargs):
|
def _format_data(cls, id: int, data: Optional[int], **kwargs):
|
||||||
"""
|
"""
|
||||||
Retrieve an artificially created channel mention.
|
Retrieve the channel mention, if the channel still exists.
|
||||||
If the channel does not exist, this will show up as invalid-channel.
|
If the channel no longer exists, or cannot be seen by the client, returns None.
|
||||||
"""
|
"""
|
||||||
if data is None:
|
if data is None:
|
||||||
return None
|
return None
|
||||||
else:
|
else:
|
||||||
return "<#{}>".format(data)
|
channel = client.get_channel(data)
|
||||||
|
if channel:
|
||||||
|
return channel.mention
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
class VoiceChannel(Channel):
|
class VoiceChannel(Channel):
|
||||||
|
|||||||
Reference in New Issue
Block a user