(v4.1.3) Fixed unintended cooldown bug with modals
This commit is contained in:
+12
-9
@@ -55,14 +55,14 @@ export const registerCommandResponders = async () => {
|
||||
return cancel()
|
||||
}
|
||||
|
||||
//check ticket permissions
|
||||
if (!(await checkTicketCreationPerms(instance,source,guild,user,option))) return cancel()
|
||||
|
||||
//start ticket creation
|
||||
if (option.exists("opendiscord:questions") && option.get("opendiscord:questions").value.length > 0){
|
||||
//send modal
|
||||
instance.modal(await opendiscord.builders.modals.getSafe("opendiscord:ticket-questions").build(source,{guild,channel,user,option}))
|
||||
}else{
|
||||
//check ticket permissions
|
||||
if (!(await checkTicketCreationPerms(instance,source,guild,user,option))) return cancel()
|
||||
|
||||
//create ticket
|
||||
await instance.defer(true)
|
||||
const res = await opendiscord.actions.get("opendiscord:create-ticket").run(source,{guild,user,answers:[],option})
|
||||
@@ -106,14 +106,14 @@ export const registerButtonResponders = async () => {
|
||||
return cancel()
|
||||
}
|
||||
|
||||
//check ticket permissions
|
||||
if (!(await checkTicketCreationPerms(instance,"panel-button",guild,user,option))) return cancel()
|
||||
|
||||
//start ticket creation
|
||||
if (option.exists("opendiscord:questions") && option.get("opendiscord:questions").value.length > 0){
|
||||
//send modal
|
||||
instance.modal(await opendiscord.builders.modals.getSafe("opendiscord:ticket-questions").build("panel-button",{guild,channel,user,option}))
|
||||
}else{
|
||||
//check ticket permissions
|
||||
if (!(await checkTicketCreationPerms(instance,"panel-button",guild,user,option))) return cancel()
|
||||
|
||||
//create ticket
|
||||
await instance.defer((generalConfig.data.system.replyOnTicketCreation) ? "reply" : "update",true)
|
||||
|
||||
@@ -150,14 +150,14 @@ export const registerDropdownResponders = async () => {
|
||||
return cancel()
|
||||
}
|
||||
|
||||
//check ticket permissions
|
||||
if (!(await checkTicketCreationPerms(instance,"panel-dropdown",guild,user,option))) return cancel()
|
||||
|
||||
//start ticket creation
|
||||
if (option.exists("opendiscord:questions") && option.get("opendiscord:questions").value.length > 0){
|
||||
//send modal
|
||||
instance.modal(await opendiscord.builders.modals.getSafe("opendiscord:ticket-questions").build("panel-dropdown",{guild,channel,user,option}))
|
||||
}else{
|
||||
//check ticket permissions
|
||||
if (!(await checkTicketCreationPerms(instance,"panel-dropdown",guild,user,option))) return cancel()
|
||||
|
||||
//create ticket
|
||||
await instance.defer((generalConfig.data.system.replyOnTicketCreation) ? "reply" : "update",true)
|
||||
|
||||
@@ -228,6 +228,9 @@ export const registerModalResponders = async () => {
|
||||
}
|
||||
})
|
||||
|
||||
//check ticket permissions
|
||||
if (!(await checkTicketCreationPerms(instance,originalSource,guild,user,option))) return cancel()
|
||||
|
||||
//create ticket
|
||||
const res = await opendiscord.actions.get("opendiscord:create-ticket").run(originalSource,{guild,user,answers,option})
|
||||
if (!res.channel || !res.ticket){
|
||||
|
||||
@@ -1071,15 +1071,9 @@ export class ODModalResponderInstance {
|
||||
async reply(msg:ODMessageBuildResult): Promise<ODMessageBuildSentResult<boolean>> {
|
||||
try{
|
||||
const msgFlags: number[] = msg.ephemeral ? [discord.MessageFlags.Ephemeral] : []
|
||||
if (this.interaction.replied || this.interaction.deferred){
|
||||
const sent = await this.interaction.editReply(Object.assign(msg.message,{flags:msgFlags}))
|
||||
const sent = await this.interaction.followUp(Object.assign(msg.message,{flags:msgFlags}))
|
||||
this.didReply = true
|
||||
return {success:true,message:sent}
|
||||
}else{
|
||||
const sent = await this.interaction.reply(Object.assign(msg.message,{flags:msgFlags}))
|
||||
this.didReply = true
|
||||
return {success:true,message:await sent.fetch()}
|
||||
}
|
||||
}catch{
|
||||
return {success:false,message:null}
|
||||
}
|
||||
@@ -1092,7 +1086,11 @@ export class ODModalResponderInstance {
|
||||
const sent = await this.interaction.editReply(Object.assign(msg.message,{flags:msgFlags}))
|
||||
this.didReply = true
|
||||
return {success:true,message:await sent.fetch()}
|
||||
}else throw new ODSystemError("Unable to update modal interaction!")
|
||||
}else{
|
||||
const sent = await this.interaction.reply(Object.assign(msg.message,{flags:msgFlags}))
|
||||
this.didReply = true
|
||||
return {success:true,message:await sent.fetch()}
|
||||
}
|
||||
}catch{
|
||||
return {success:false,message:null}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user