mirror of
https://github.com/Steffo99/nortrom.git
synced 2024-11-24 10:24:18 +00:00
🔧 Check permissions before deafening/muting
This commit is contained in:
parent
792ac1b307
commit
d227dfd703
2 changed files with 29 additions and 0 deletions
|
@ -46,5 +46,10 @@
|
||||||
<inspection_tool class="RegExpRepeatedSpace" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
|
<inspection_tool class="RegExpRepeatedSpace" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
|
||||||
<inspection_tool class="RegExpUnexpectedAnchor" enabled="true" level="ERROR" enabled_by_default="true" />
|
<inspection_tool class="RegExpUnexpectedAnchor" enabled="true" level="ERROR" enabled_by_default="true" />
|
||||||
<inspection_tool class="ShellCheck" enabled="true" level="WARNING" enabled_by_default="true" />
|
<inspection_tool class="ShellCheck" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
|
<inspection_tool class="SpellCheckingInspection" enabled="false" level="TYPO" enabled_by_default="false">
|
||||||
|
<option name="processCode" value="true" />
|
||||||
|
<option name="processLiterals" value="true" />
|
||||||
|
<option name="processComments" value="true" />
|
||||||
|
</inspection_tool>
|
||||||
</profile>
|
</profile>
|
||||||
</component>
|
</component>
|
|
@ -19,6 +19,12 @@ async def _mute(ctx: ds.SlashContext):
|
||||||
return
|
return
|
||||||
|
|
||||||
channel: d.VoiceChannel = voice.channel
|
channel: d.VoiceChannel = voice.channel
|
||||||
|
|
||||||
|
permissions: d.Permissions = ctx.author.permissions_in(channel=channel)
|
||||||
|
if not permissions.mute_members:
|
||||||
|
await ctx.send(content="⚠️ You don't have the _Mute Members_ permission.", hidden=True)
|
||||||
|
return
|
||||||
|
|
||||||
members: list[d.Member] = channel.members
|
members: list[d.Member] = channel.members
|
||||||
for member in members:
|
for member in members:
|
||||||
await member.edit(mute=True)
|
await member.edit(mute=True)
|
||||||
|
@ -34,6 +40,12 @@ async def _unmute(ctx: ds.SlashContext):
|
||||||
return
|
return
|
||||||
|
|
||||||
channel: d.VoiceChannel = voice.channel
|
channel: d.VoiceChannel = voice.channel
|
||||||
|
|
||||||
|
permissions: d.Permissions = ctx.author.permissions_in(channel=channel)
|
||||||
|
if not permissions.mute_members:
|
||||||
|
await ctx.send(content="⚠️ You don't have the _Mute Members_ permission.", hidden=True)
|
||||||
|
return
|
||||||
|
|
||||||
members: list[d.Member] = channel.members
|
members: list[d.Member] = channel.members
|
||||||
for member in members:
|
for member in members:
|
||||||
await member.edit(mute=False)
|
await member.edit(mute=False)
|
||||||
|
@ -49,6 +61,12 @@ async def _deafen(ctx: ds.SlashContext):
|
||||||
return
|
return
|
||||||
|
|
||||||
channel: d.VoiceChannel = voice.channel
|
channel: d.VoiceChannel = voice.channel
|
||||||
|
|
||||||
|
permissions: d.Permissions = ctx.author.permissions_in(channel=channel)
|
||||||
|
if not permissions.deafen_members:
|
||||||
|
await ctx.send(content="⚠️ You don't have the _Deafen Members_ permission.", hidden=True)
|
||||||
|
return
|
||||||
|
|
||||||
members: list[d.Member] = channel.members
|
members: list[d.Member] = channel.members
|
||||||
for member in members:
|
for member in members:
|
||||||
await member.edit(deafen=True)
|
await member.edit(deafen=True)
|
||||||
|
@ -64,6 +82,12 @@ async def _undeafen(ctx: ds.SlashContext):
|
||||||
return
|
return
|
||||||
|
|
||||||
channel: d.VoiceChannel = voice.channel
|
channel: d.VoiceChannel = voice.channel
|
||||||
|
|
||||||
|
permissions: d.Permissions = ctx.author.permissions_in(channel=channel)
|
||||||
|
if not permissions.deafen_members:
|
||||||
|
await ctx.send(content="⚠️ You don't have the _Deafen Members_ permission.", hidden=True)
|
||||||
|
return
|
||||||
|
|
||||||
members: list[d.Member] = channel.members
|
members: list[d.Member] = channel.members
|
||||||
for member in members:
|
for member in members:
|
||||||
await member.edit(deafen=False)
|
await member.edit(deafen=False)
|
||||||
|
|
Loading…
Reference in a new issue