3.0 update first beta

This commit is contained in:
DJj123dj
2022-09-24 08:56:34 +02:00
parent 69de612d1e
commit ed9c98e2f0
45 changed files with 623 additions and 595 deletions
+22 -4
View File
@@ -9,9 +9,19 @@ const permsChecker = require("../core/utils/permisssionChecker")
const APIEvents = require("../core/api/modules/events")
module.exports = () => {
bot.errorLog.log("debug","COMMANDS: loaded close.js")
client.on("messageCreate",msg => {
if (!msg.content.startsWith(config.prefix+"close")) return
const args = msg.content.substring((config.prefix+"close").length).split(" ")
args.shift()
/**@type {String|false} */
var tempreason = args.join(" ")
if (!tempreason || tempreason == " " || tempreason == " "){
tempreason = false
}
const reason = tempreason
msg.channel.messages.fetchPinned().then(msglist => {
var firstmsg = msglist.last()
@@ -19,7 +29,10 @@ module.exports = () => {
const hiddendata = bot.hiddenData.readHiddenData(firstmsg.embeds[0].description)
const ticketId = hiddendata.data.find(d => d.key == "type").value
msg.channel.send({embeds:[bot.embeds.commands.closeEmbed(msg.author)],components:[bot.buttons.close.closeCommandRow]})
if (hiddendata.data.find(h => h.key == "pendingdelete")) return msg.channel.send({embeds:[bot.errorLog.warning("Warning!","You can't close a ticket while it's being deleted!")]})
const descriptionReason = reason ? "**"+l.messages.reason+":** "+reason : false
msg.channel.send({embeds:[bot.embeds.commands.closeEmbed(msg.author,descriptionReason)],components:[bot.buttons.close.closeCommandRow]})
var name = msg.channel.name
var prefix = ""
@@ -30,7 +43,7 @@ module.exports = () => {
}
})
require("../core/ticketCloser").NEWcloseTicket(msg.member,msg.channel,prefix,"close",false,true)
require("../core/ticketActions/ticketCloser").NEWcloseTicket(msg.member,msg.channel,prefix,"close",reason,true)
log("command","someone used the 'close' command",[{key:"user",value:msg.author.tag}])
APIEvents.onCommand("close",true,msg.author,msg.channel,msg.guild,new Date())
@@ -46,13 +59,18 @@ module.exports = () => {
//interaction.deferReply()
const reason = interaction.options.getString("reason") ? interaction.options.getString("reason") : false
interaction.channel.messages.fetchPinned().then(msglist => {
var firstmsg = msglist.last()
if (firstmsg == undefined || firstmsg.author.id != client.user.id) return interaction.reply({embeds:[bot.errorLog.notInATicket]})
const hiddendata = bot.hiddenData.readHiddenData(firstmsg.embeds[0].description)
const ticketId = hiddendata.data.find(d => d.key == "type").value
interaction.reply({embeds:[bot.embeds.commands.closeEmbed(interaction.user)],components:[bot.buttons.close.closeCommandRow]})
if (hiddendata.data.find(h => h.key == "pendingdelete")) return interaction.reply({embeds:[bot.errorLog.warning("Warning!","You can't close a ticket while it's being deleted!")]})
const descriptionReason = reason ? "**"+l.messages.reason+":** "+reason : false
interaction.reply({embeds:[bot.embeds.commands.closeEmbed(interaction.user,descriptionReason)],components:[bot.buttons.close.closeCommandRow]})
var name = interaction.channel.name
var prefix = ""
@@ -63,7 +81,7 @@ module.exports = () => {
}
})
require("../core/ticketCloser").NEWcloseTicket(interaction.member,interaction.channel,prefix,"close",false,true)
require("../core/ticketActions/ticketCloser").NEWcloseTicket(interaction.member,interaction.channel,prefix,"close",false,true)
log("command","someone used the 'close' command",[{key:"user",value:interaction.user.tag}])
APIEvents.onCommand("close",true,interaction.user,interaction.channel,interaction.guild,new Date())