feat(shard): ✨ Prevent non-participants from hanging up or skipping calls.

This commit is contained in:
2025-03-31 11:37:36 -03:00
parent 131bbcc548
commit 688d28140f
3 changed files with 20 additions and 2 deletions
+1 -1
View File
@@ -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()
+18
View File
@@ -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]
Generated
+1 -1
View File
@@ -414,7 +414,7 @@ wheels = [
[[package]] [[package]]
name = "payphone" name = "payphone"
version = "0.66.0" version = "0.67.0"
source = { virtual = "." } source = { virtual = "." }
dependencies = [ dependencies = [
{ name = "aerich" }, { name = "aerich" },