mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-04-22 08:44:10 +00:00
Add implicit cases to permission resolution in Channel.permissions_for
This commit is contained in:
parent
30d623cd46
commit
0eccd85711
@ -255,9 +255,28 @@ class Channel(Hashable):
|
||||
if overwrite.type == 'member' and overwrite.id == member.id:
|
||||
base.handle_overwrite(allow=overwrite.allow, deny=overwrite.deny)
|
||||
|
||||
# default channels can always be read
|
||||
if self.is_default:
|
||||
base.read_messages = True
|
||||
|
||||
# if you can't send a message in a channel then you can't have certain
|
||||
# permissions as well
|
||||
if not base.send_messages:
|
||||
base.send_tts_messages = False
|
||||
base.mention_everyone = False
|
||||
base.embed_links = False
|
||||
base.attach_files = False
|
||||
|
||||
# if you can't read a channel then you have no permissions there
|
||||
if not base.read_messages:
|
||||
denied = Permissions.all_channel()
|
||||
base.value &= ~denied.value
|
||||
|
||||
# text channels do not have voice related permissions
|
||||
if self.type is ChannelType.text:
|
||||
denied = Permissions.voice()
|
||||
base.value &= ~denied.value
|
||||
|
||||
return base
|
||||
|
||||
class PrivateChannel(Hashable):
|
||||
|
Loading…
x
Reference in New Issue
Block a user