v3.5.4 push 2

This commit is contained in:
DJj123dj
2024-04-04 14:06:48 +02:00
parent 5dfbce1856
commit e80ce1a64a
19 changed files with 299 additions and 146 deletions
@@ -215,7 +215,7 @@ exports.compile = (guild,channel,user,messagesInv,data) => {
interactionName:msg.interaction.commandName
},
user:{
name:msg.interaction.user.username,
name:msg.interaction.user.displayName,
id:msg.interaction.user.id,
color:replycolor,
pfp:msg.interaction.user.displayAvatarURL(),
@@ -227,15 +227,15 @@ exports.compile = (guild,channel,user,messagesInv,data) => {
}else if (replytype == "reply"){
var replycontentRAW = messages.find((msg2) => msg2.id == msg.reference.messageId)
var replycontent = (replycontentRAW && replycontentRAW.content) ? replycontentRAW.content.slice(0,(60-replycontentRAW.author.username.length)) : "deleted this message"
var replycontent = (replycontentRAW && replycontentRAW.content) ? replycontentRAW.content.slice(0,(60-replycontentRAW.author.displayName.length)) : "deleted this message"
const replycolorRAW = (replycontentRAW) ? msg.guild.members.cache.find((m) => m.id == replycontentRAW.author.id) : false
const replycolor = (replycolorRAW) ? replycolorRAW.displayHexColor.replace("#000000","#ffffff") : "#ffffff"
var user = (replycontentRAW && replycontentRAW.content) ? {
name:(replycontentRAW) ? replycontentRAW.author.username : "undefined",
name:(replycontentRAW) ? replycontentRAW.author.displayName : "undefined",
id:(replycontentRAW) ? replycontentRAW.author.id : "undefined",
color:replycolor,
pfp:(replycontentRAW) ? replycontentRAW.author.username : "",
pfp:(replycontentRAW) ? replycontentRAW.author.displayName : "",
bot:(replycontentRAW) ? replycontentRAW.author.bot : false,
system:(replycontentRAW) ? replycontentRAW.author.system : false,
verifiedBot:(replycontentRAW) ? replycontentRAW.author.flags.has(discord.UserFlags.VerifiedBot) : false,
@@ -264,7 +264,7 @@ exports.compile = (guild,channel,user,messagesInv,data) => {
const authorColor = msg.member ? msg.member.displayHexColor.replace("#000000","#ffffff") : "#ffffff"
messagesArray.push({
author:{
name:msg.author.username,
name:msg.author.displayName,
id:msg.author.id,
color:authorColor,
pfp:msg.author.displayAvatarURL(),
@@ -332,7 +332,7 @@ exports.compile = (guild,channel,user,messagesInv,data) => {
creatorid:data.ticket.creatorid,
creatorpfp:data.ticket.creatorpfp,
closedbyname:user.username,
closedbyname:user.displayName,
closedbyid:user.id,
closedbypfp:user.displayAvatarURL(),
+1 -1
View File
@@ -22,7 +22,7 @@ exports.upload = async (json) => {
resolve(res.data)
}catch(err){
console.log("failed transcript upload!",err.response)
console.log("Failed HTML transcript upload! Reached Ratelimit 429!")
resolve(false)
}
})
+1 -1
View File
@@ -74,7 +74,7 @@ exports.tserror = (name,id,user,err) => {
const errDesc = (typeof err == "string") ? "\n"+err : ""
embed.setDescription("Something went wrong while creating the HTML transcript.\n\n[possible reasons](https://docs.openticket.dj-dj.be/the-system/transcripts/transcript-errors)"+errDesc)
embed.setDescription("Something went wrong while creating the HTML transcript.\n\n[possible reasons](https://otdocs.dj-dj.be/docs/current/docs/system/transcripts)"+errDesc)
return embed
}
+21 -3
View File
@@ -88,13 +88,13 @@ module.exports = async (messages,guild,channel,user,reason) => {
},
bot:{
name:client.user.username,
name:client.user.displayName,
id:client.user.id,
pfp:client.user.displayAvatarURL(),
},
ticket:{
creatorid:ticketopener.id,
creatorname:ticketopener.username,
creatorname:ticketopener.displayName,
creatorpfp:ticketopener.displayAvatarURL(),
openedtime:opentime.getTime(),
@@ -123,7 +123,25 @@ module.exports = async (messages,guild,channel,user,reason) => {
}
const TSdata = await require("./communication/index").upload(JSONDATA)
if (!TSdata) return false
if (!TSdata){
const attachment = await require("./oldTranscript").createTranscript(messages,channel)
const errembed = tsembeds.tserror(chName,chId,user,"`HTML Transcript API: reached ratelimit`")
if (tsconfig.sendTranscripts.enableChannel){
/**@type {discord.TextChannel|undefined} */
const tc = guild.channels.cache.find((c) => c.id == tsconfig.sendTranscripts.channel)
if (!tc) return
tc.send({embeds:[errembed],files:[attachment]})
}
if (tsconfig.sendTranscripts.enableDM && user){
const embed = tsembeds.tsready(chName,null,user,ticketopener)
try {
ticketopener.send({embeds:[embed],files:[attachment]})
}catch{}
}
return false
}
if (TSdata.status == "success"){
//MAKE THIS COMPATIBLE WITH PREMIUM "customTranscriptUrl" IN FUTURE VERSIONS!!