Bugfix: Allow for longer command execution times
This commit is contained in:
		@ -52,11 +52,18 @@ func (discord *Discord) RegisterCommand(name string, config common.ChatCommandCo
 | 
				
			|||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							session.InteractionRespond(r.Interaction, &discordgo.InteractionResponse{
 | 
				
			||||||
 | 
								Type: discordgo.InteractionResponseDeferredChannelMessageWithSource,
 | 
				
			||||||
 | 
								Data: &discordgo.InteractionResponseData{
 | 
				
			||||||
 | 
									Flags: discordgo.MessageFlagsEphemeral,
 | 
				
			||||||
 | 
								},
 | 
				
			||||||
 | 
							})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		result := handler(NewUser(r.Member.User), optionsMap)
 | 
							result := handler(NewUser(r.Member.User), optionsMap)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if result != "" {
 | 
							if result != "" {
 | 
				
			||||||
			// Handle response
 | 
								// Handle response
 | 
				
			||||||
			responseData := &discordgo.InteractionResponseData{
 | 
								responseData := &discordgo.WebhookParams{
 | 
				
			||||||
				Content: result,
 | 
									Content: result,
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -64,11 +71,12 @@ func (discord *Discord) RegisterCommand(name string, config common.ChatCommandCo
 | 
				
			|||||||
				responseData.Flags = discordgo.MessageFlagsEphemeral
 | 
									responseData.Flags = discordgo.MessageFlagsEphemeral
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			session.InteractionRespond(r.Interaction, &discordgo.InteractionResponse{
 | 
								session.FollowupMessageCreate(r.Interaction, false, responseData)
 | 
				
			||||||
				Type: discordgo.InteractionResponseChannelMessageWithSource,
 | 
					
 | 
				
			||||||
				Data: responseData,
 | 
					 | 
				
			||||||
			})
 | 
					 | 
				
			||||||
		} else {
 | 
							} else {
 | 
				
			||||||
 | 
								session.FollowupMessageCreate(r.Interaction, false, &discordgo.WebhookParams{
 | 
				
			||||||
 | 
									Content: "Command did not return a response!",
 | 
				
			||||||
 | 
								})
 | 
				
			||||||
			log.Printf("Command '%s' did not return a response: %v", name, optionsMap)
 | 
								log.Printf("Command '%s' did not return a response: %v", name, optionsMap)
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user