Added coroutine to defer response to interaction
This should compensate for the lag in the bot and fix the menu bug
This commit is contained in:
parent
f5097a9d2d
commit
be43d3e03a
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user