(v4.1) Added +/-10 Minor Features & Improvements

This commit is contained in:
DJj123dj
2025-11-04 19:39:52 +01:00
parent c7b44232c4
commit e55438cc67
14 changed files with 223 additions and 55 deletions
+12
View File
@@ -64,6 +64,18 @@ export const registerCommandResponders = async () => {
instance.reply(await opendiscord.builders.messages.getSafe("opendiscord:error-ticket-busy").build("button",{guild,channel,user}))
return cancel()
}
//return when not allowed because of missing messages
if (!generalConfig.data.system.allowCloseBeforeMessage || !generalConfig.data.system.allowCloseBeforeAdminMessage){
const analysis = await opendiscord.transcripts.collector.ticketUserMessagesAnalysis(ticket,guild,channel)
if (analysis && !generalConfig.data.system.allowCloseBeforeMessage && analysis.totalMessages < 1){
instance.reply(await opendiscord.builders.messages.getSafe("opendiscord:error").build("button",{guild,channel,user,layout:"simple",error:"This ticket cannot be closed/deleted before a message has been sent by a user.",customTitle:opendiscord.languages.getTranslation("errors.titles.noPermissions")})) //TODO TRANSLATION!!!
return cancel()
}
if (analysis && !generalConfig.data.system.allowCloseBeforeAdminMessage && analysis.adminMessages < 1){
instance.reply(await opendiscord.builders.messages.getSafe("opendiscord:error").build("button",{guild,channel,user,layout:"simple",error:"This ticket cannot be closed/deleted before a message has been sent by a ticket admin or support member.",customTitle:opendiscord.languages.getTranslation("errors.titles.noPermissions")})) //TODO TRANSLATION!!!
return cancel()
}
}
const reason = instance.options.getString("reason",false)
+20
View File
@@ -59,10 +59,30 @@ export const registerCommandResponders = async () => {
instance.reply(await opendiscord.builders.messages.getSafe("opendiscord:error-ticket-busy").build("button",{guild,channel,user}))
return cancel()
}
//return when not allowed because of missing messages
if (!generalConfig.data.system.allowCloseBeforeMessage || !generalConfig.data.system.allowCloseBeforeAdminMessage){
const analysis = await opendiscord.transcripts.collector.ticketUserMessagesAnalysis(ticket,guild,channel)
if (analysis && !generalConfig.data.system.allowCloseBeforeMessage && analysis.totalMessages < 1){
instance.reply(await opendiscord.builders.messages.getSafe("opendiscord:error").build("button",{guild,channel,user,layout:"simple",error:"This ticket cannot be closed/deleted before a message has been sent by a user.",customTitle:opendiscord.languages.getTranslation("errors.titles.noPermissions")})) //TODO TRANSLATION!!!
return cancel()
}
if (analysis && !generalConfig.data.system.allowCloseBeforeAdminMessage && analysis.adminMessages < 1){
instance.reply(await opendiscord.builders.messages.getSafe("opendiscord:error").build("button",{guild,channel,user,layout:"simple",error:"This ticket cannot be closed/deleted before a message has been sent by a ticket admin or support member.",customTitle:opendiscord.languages.getTranslation("errors.titles.noPermissions")})) //TODO TRANSLATION!!!
return cancel()
}
}
const reason = instance.options.getString("reason",false)
const withoutTranscript = instance.options.getBoolean("notranscript",false) ?? false
//don't allow deleteWithoutTranscript to non-global-admins when enabled
if (withoutTranscript && generalConfig.data.system.adminOnlyDeleteWithoutTranscript){
if (!opendiscord.permissions.hasPermissions("support",await opendiscord.permissions.getPermissions(instance.user,instance.channel,instance.guild,{allowChannelRoleScope:false,allowChannelUserScope:false,allowGlobalRoleScope:true,allowGlobalUserScope:true}))){
instance.reply(await opendiscord.builders.messages.getSafe("opendiscord:error-no-permissions").build("button",{guild:instance.guild,channel:instance.channel,user:instance.user,permissions:["support"]}))
return cancel()
}
}
//start deleting ticket
await instance.defer(false)
await instance.reply(await opendiscord.builders.messages.getSafe("opendiscord:delete-message").build(source,{guild,channel,user,ticket,reason}))