feat(shard): ✨ Prevent non-participants from hanging up or skipping calls.
This commit is contained in:
@@ -116,7 +116,7 @@ class Admin(base.Cog):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
user: models.User = await models.User.get(id=user.id)
|
user: models.User = await models.User.get(id=user.id)
|
||||||
user.set_cache(self.bot.redis)
|
await user.set_cache(self.bot.redis)
|
||||||
|
|
||||||
@commands.command(aliases=["sup"])
|
@commands.command(aliases=["sup"])
|
||||||
@commands.is_owner()
|
@commands.is_owner()
|
||||||
|
|||||||
@@ -73,6 +73,15 @@ class Calls(base.Cog):
|
|||||||
f"☎️ You're not on a call! Use `{ctx.clean_prefix}call` to start one."
|
f"☎️ You're not on a call! Use `{ctx.clean_prefix}call` to start one."
|
||||||
)
|
)
|
||||||
|
|
||||||
|
call = await self.bot.call_handler.get_call_by_channel_id(ctx.channel.id)
|
||||||
|
|
||||||
|
participant = await call.get_participant(ctx.author.id)
|
||||||
|
|
||||||
|
if participant is None:
|
||||||
|
return await ctx.send(
|
||||||
|
"❌ You cannot skip a call you have not participated in."
|
||||||
|
)
|
||||||
|
|
||||||
channels = await self.bot.call_handler.skip(ctx.channel.id)
|
channels = await self.bot.call_handler.skip(ctx.channel.id)
|
||||||
|
|
||||||
for channel in channels:
|
for channel in channels:
|
||||||
@@ -104,6 +113,15 @@ class Calls(base.Cog):
|
|||||||
f"☎️ You're not on a call! Use `{ctx.clean_prefix}call` to start one."
|
f"☎️ You're not on a call! Use `{ctx.clean_prefix}call` to start one."
|
||||||
)
|
)
|
||||||
|
|
||||||
|
call = await self.bot.call_handler.get_call_by_channel_id(ctx.channel.id)
|
||||||
|
|
||||||
|
participant = await call.get_participant(ctx.author.id)
|
||||||
|
|
||||||
|
if participant is None:
|
||||||
|
return await ctx.send(
|
||||||
|
"❌ You cannot hang up a call you have not participated in."
|
||||||
|
)
|
||||||
|
|
||||||
channels = await self.bot.call_handler.hangup(ctx.channel.id)
|
channels = await self.bot.call_handler.hangup(ctx.channel.id)
|
||||||
|
|
||||||
other_channel = channels[0] if channels[0] != ctx.channel.id else channels[1]
|
other_channel = channels[0] if channels[0] != ctx.channel.id else channels[1]
|
||||||
|
|||||||
Reference in New Issue
Block a user