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:
		@@ -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)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user