diff --git a/app/cogs/events/secondary/pitch_listener.py b/app/cogs/events/secondary/pitch_listener.py index ab90ced..07ba9d5 100644 --- a/app/cogs/events/secondary/pitch_listener.py +++ b/app/cogs/events/secondary/pitch_listener.py @@ -17,6 +17,15 @@ class PitchListener(commands.Cog, name='Pitch Listener'): def __init__(self, client): self.client = client + @commands.Cog.listener(name='on_component') + async def _response_defer(self, ctx:ComponentContext): + pitches = yaml_load(pitchesFile) + guildStr = str(ctx.guild.id) + if not pitches.get(guildStr, {}): return # If no pitches for current guild, ignore. + [timeslot] = [*pitches[guildStr]] + if ctx.origin_message.id not in pitches[guildStr][timeslot]['messages'] + [pitches[guildStr][timeslot]['control']]: return # If the context id is not in the pitch menu, ignore + await ctx.defer(hidden = True) + @commands.Cog.listener(name='on_component') async def _pitch_listener(self, ctx:ComponentContext): conf = yaml_load(configFile)