mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-12-06 01:12:33 -05:00
check both connect and speak permissions before performing audio actions (#5012)
This commit is contained in:
@@ -643,7 +643,7 @@ class PlayerControllerCommands(MixinMeta, metaclass=CompositeMetaClass):
|
||||
|
||||
try:
|
||||
if (
|
||||
not ctx.author.voice.channel.permissions_for(ctx.me).connect
|
||||
not self.can_join_and_speak(ctx.author.voice.channel)
|
||||
or not ctx.author.voice.channel.permissions_for(ctx.me).move_members
|
||||
and self.is_vc_full(ctx.author.voice.channel)
|
||||
):
|
||||
@@ -651,7 +651,7 @@ class PlayerControllerCommands(MixinMeta, metaclass=CompositeMetaClass):
|
||||
return await self.send_embed_msg(
|
||||
ctx,
|
||||
title=_("Unable To Join Voice Channel"),
|
||||
description=_("I don't have permission to connect to your channel."),
|
||||
description=_("I don't have permission to connect and speak in your channel."),
|
||||
)
|
||||
if not self._player_check(ctx):
|
||||
player = await lavalink.connect(
|
||||
|
||||
@@ -73,14 +73,16 @@ class PlayerCommands(MixinMeta, metaclass=CompositeMetaClass):
|
||||
return await self.send_embed_msg(ctx, title=msg, description=desc)
|
||||
try:
|
||||
if (
|
||||
not ctx.author.voice.channel.permissions_for(ctx.me).connect
|
||||
not self.can_join_and_speak(ctx.author.voice.channel)
|
||||
or not ctx.author.voice.channel.permissions_for(ctx.me).move_members
|
||||
and self.is_vc_full(ctx.author.voice.channel)
|
||||
):
|
||||
return await self.send_embed_msg(
|
||||
ctx,
|
||||
title=_("Unable To Play Tracks"),
|
||||
description=_("I don't have permission to connect to your channel."),
|
||||
description=_(
|
||||
"I don't have permission to connect and speak in your channel."
|
||||
),
|
||||
)
|
||||
await lavalink.connect(
|
||||
ctx.author.voice.channel,
|
||||
@@ -179,14 +181,16 @@ class PlayerCommands(MixinMeta, metaclass=CompositeMetaClass):
|
||||
return await self.send_embed_msg(ctx, title=msg, description=desc)
|
||||
try:
|
||||
if (
|
||||
not ctx.author.voice.channel.permissions_for(ctx.me).connect
|
||||
not self.can_join_and_speak(ctx.author.voice.channel)
|
||||
or not ctx.author.voice.channel.permissions_for(ctx.me).move_members
|
||||
and self.is_vc_full(ctx.author.voice.channel)
|
||||
):
|
||||
return await self.send_embed_msg(
|
||||
ctx,
|
||||
title=_("Unable To Play Tracks"),
|
||||
description=_("I don't have permission to connect to your channel."),
|
||||
description=_(
|
||||
"I don't have permission to connect and speak in your channel."
|
||||
),
|
||||
)
|
||||
await lavalink.connect(
|
||||
ctx.author.voice.channel,
|
||||
@@ -441,14 +445,16 @@ class PlayerCommands(MixinMeta, metaclass=CompositeMetaClass):
|
||||
return await self.send_embed_msg(ctx, title=msg, description=desc)
|
||||
try:
|
||||
if (
|
||||
not ctx.author.voice.channel.permissions_for(ctx.me).connect
|
||||
not self.can_join_and_speak(ctx.author.voice.channel)
|
||||
or not ctx.author.voice.channel.permissions_for(ctx.me).move_members
|
||||
and self.is_vc_full(ctx.author.voice.channel)
|
||||
):
|
||||
return await self.send_embed_msg(
|
||||
ctx,
|
||||
title=_("Unable To Play Tracks"),
|
||||
description=_("I don't have permission to connect to your channel."),
|
||||
description=_(
|
||||
"I don't have permission to connect and speak in your channel."
|
||||
),
|
||||
)
|
||||
await lavalink.connect(
|
||||
ctx.author.voice.channel,
|
||||
@@ -555,14 +561,16 @@ class PlayerCommands(MixinMeta, metaclass=CompositeMetaClass):
|
||||
return await self.send_embed_msg(ctx, title=msg, description=desc)
|
||||
try:
|
||||
if (
|
||||
not ctx.author.voice.channel.permissions_for(ctx.me).connect
|
||||
not self.can_join_and_speak(ctx.author.voice.channel)
|
||||
or not ctx.author.voice.channel.permissions_for(ctx.me).move_members
|
||||
and self.is_vc_full(ctx.author.voice.channel)
|
||||
):
|
||||
return await self.send_embed_msg(
|
||||
ctx,
|
||||
title=_("Unable To Play Tracks"),
|
||||
description=_("I don't have permission to connect to your channel."),
|
||||
description=_(
|
||||
"I don't have permission to connect and speak in your channel."
|
||||
),
|
||||
)
|
||||
await lavalink.connect(
|
||||
ctx.author.voice.channel,
|
||||
@@ -677,14 +685,16 @@ class PlayerCommands(MixinMeta, metaclass=CompositeMetaClass):
|
||||
return await self.send_embed_msg(ctx, title=msg, description=desc)
|
||||
try:
|
||||
if (
|
||||
not ctx.author.voice.channel.permissions_for(ctx.me).connect
|
||||
not self.can_join_and_speak(ctx.author.voice.channel)
|
||||
or not ctx.author.voice.channel.permissions_for(ctx.me).move_members
|
||||
and self.is_vc_full(ctx.author.voice.channel)
|
||||
):
|
||||
return await self.send_embed_msg(
|
||||
ctx,
|
||||
title=_("Unable To Search For Tracks"),
|
||||
description=_("I don't have permission to connect to your channel."),
|
||||
description=_(
|
||||
"I don't have permission to connect and speak in your channel."
|
||||
),
|
||||
)
|
||||
await lavalink.connect(
|
||||
ctx.author.voice.channel,
|
||||
|
||||
@@ -328,7 +328,7 @@ class QueueCommands(MixinMeta, metaclass=CompositeMetaClass):
|
||||
)
|
||||
try:
|
||||
if (
|
||||
not ctx.author.voice.channel.permissions_for(ctx.me).connect
|
||||
not self.can_join_and_speak(ctx.author.voice.channel)
|
||||
or not ctx.author.voice.channel.permissions_for(ctx.me).move_members
|
||||
and self.is_vc_full(ctx.author.voice.channel)
|
||||
):
|
||||
@@ -336,7 +336,7 @@ class QueueCommands(MixinMeta, metaclass=CompositeMetaClass):
|
||||
return await self.send_embed_msg(
|
||||
ctx,
|
||||
title=_("Unable To Shuffle Queue"),
|
||||
description=_("I don't have permission to connect to your channel."),
|
||||
description=_("I don't have permission to connect and speak in your channel."),
|
||||
)
|
||||
player = await lavalink.connect(
|
||||
ctx.author.voice.channel,
|
||||
|
||||
Reference in New Issue
Block a user