diff --git a/README.md b/README.md index fad8a54..0b2f840 100644 --- a/README.md +++ b/README.md @@ -59,6 +59,7 @@ Translators |Russian |Apexo#0723 | |Turkish |Hydrâelčhâvø#1575 | |Polish |MKevas#8311 | +|Slovenian |n1kkec#5341 | ## links current version: _v3.3.0_ diff --git a/commands/claim.js b/commands/claim.js index a608d39..dfe79e6 100644 --- a/commands/claim.js +++ b/commands/claim.js @@ -41,11 +41,10 @@ module.exports = () => { .setFooter({text:"claimed by: "+interaction.user.tag,iconURL:interaction.user.displayAvatarURL()}) .setDescription(hdraw.description+bot.hiddenData.writeHiddenData(hiddendata.type,hiddendata.data)) - if (!firstmsg.components[0].components[1].disabled){ - firstmsg.edit({components:[bot.buttons.firstmsg.firstmsgRowNormalNoClaim],embeds:[newEmbed]}) - - }else if (firstmsg.components[0].components[1].disabled){ + if (firstmsg.components[0].components[1] && firstmsg.components[0].components[1].disabled){ firstmsg.edit({components:[bot.buttons.firstmsg.firstmsgRowDisabledNoClaim],embeds:[newEmbed]}) + }else{ + firstmsg.edit({components:[bot.buttons.firstmsg.firstmsgRowNormalNoClaim],embeds:[newEmbed]}) } msg.channel.send({embeds:[bot.embeds.commands.claimEmbed(claimingUser,msg.author)]}) @@ -67,6 +66,7 @@ module.exports = () => { if (!interaction.guild) return if (!permsChecker.command(interaction.user.id,interaction.guild.id)){ permsChecker.sendUserNoPerms(interaction.user) + interaction.reply({content:":x: "+l.errors.noPermsTitle,ephemeral:true}) return } @@ -87,11 +87,10 @@ module.exports = () => { .setFooter({text:"claimed by: "+user.tag,iconURL:user.displayAvatarURL()}) .setDescription(hdraw.description+bot.hiddenData.writeHiddenData(hiddendata.type,hiddendata.data)) - if (!firstmsg.components[0].components[1].disabled){ - firstmsg.edit({components:[bot.buttons.firstmsg.firstmsgRowNormalNoClaim],embeds:[newEmbed]}) - - }else if (firstmsg.components[0].components[1].disabled){ + if (firstmsg.components[0].components[1] && firstmsg.components[0].components[1].disabled){ firstmsg.edit({components:[bot.buttons.firstmsg.firstmsgRowDisabledNoClaim],embeds:[newEmbed]}) + }else{ + firstmsg.edit({components:[bot.buttons.firstmsg.firstmsgRowNormalNoClaim],embeds:[newEmbed]}) } interaction.editReply({embeds:[bot.embeds.commands.claimEmbed(user,interaction.user)]}) diff --git a/commands/unclaim.js b/commands/unclaim.js index e6821ea..74176fa 100644 --- a/commands/unclaim.js +++ b/commands/unclaim.js @@ -48,11 +48,10 @@ module.exports = () => { newEmbed.setFooter(null) } - if (!firstmsg.components[0].components[1].disabled){ - firstmsg.edit({components:[bot.buttons.firstmsg.firstmsgRowNormal],embeds:[newEmbed]}) - - }else if (firstmsg.components[0].components[1].disabled){ + if (firstmsg.components[0].components[1] && firstmsg.components[0].components[1].disabled){ firstmsg.edit({components:[bot.buttons.firstmsg.firstmsgRowDisabled],embeds:[newEmbed]}) + }else{ + firstmsg.edit({components:[bot.buttons.firstmsg.firstmsgRowNormal],embeds:[newEmbed]}) } msg.channel.send({embeds:[bot.embeds.commands.unclaimEmbed(msg.author)]}) @@ -73,6 +72,7 @@ module.exports = () => { if (!interaction.guild) return if (!permsChecker.command(interaction.user.id,interaction.guild.id)){ permsChecker.sendUserNoPerms(interaction.user) + interaction.reply({content:":x: "+l.errors.noPermsTitle,ephemeral:true}) return } @@ -104,11 +104,10 @@ module.exports = () => { newEmbed.setFooter(null) } - if (!firstmsg.components[0].components[1].disabled){ - firstmsg.edit({components:[bot.buttons.firstmsg.firstmsgRowNormal],embeds:[newEmbed]}) - - }else if (firstmsg.components[0].components[1].disabled){ + if (firstmsg.components[0].components[1] && firstmsg.components[0].components[1].disabled){ firstmsg.edit({components:[bot.buttons.firstmsg.firstmsgRowDisabled],embeds:[newEmbed]}) + }else{ + firstmsg.edit({components:[bot.buttons.firstmsg.firstmsgRowNormal],embeds:[newEmbed]}) } interaction.editReply({embeds:[bot.embeds.commands.unclaimEmbed(interaction.user)]}) diff --git a/core/checker.js b/core/checker.js index 23f48be..a0fd9d5 100644 --- a/core/checker.js +++ b/core/checker.js @@ -427,7 +427,7 @@ exports.checker = async () => { checkType(config.languageFile,"string","languagefile") const lf = config.languageFile - if (!lf.startsWith("custom") && !lf.startsWith("english") && !lf.startsWith("dutch") && !lf.startsWith("romanian") && !lf.startsWith("german") && !lf.startsWith("arabic") && !lf.startsWith("spanish") && !lf.startsWith("portuguese") && !lf.startsWith("french") && !lf.startsWith("italian") && !lf.startsWith("czech") && !lf.startsWith("danish") && !lf.startsWith("russian") && !lf.startsWith("turkish") && !lf.startsWith("polish")){ + if (!lf.startsWith("custom") && !lf.startsWith("english") && !lf.startsWith("dutch") && !lf.startsWith("romanian") && !lf.startsWith("german") && !lf.startsWith("arabic") && !lf.startsWith("spanish") && !lf.startsWith("portuguese") && !lf.startsWith("french") && !lf.startsWith("italian") && !lf.startsWith("czech") && !lf.startsWith("danish") && !lf.startsWith("russian") && !lf.startsWith("turkish") && !lf.startsWith("polish") && !lf.startsWith("slovenian")){ createError("'languagefile' | invalid language, more info in the wiki") } diff --git a/core/interactionHandlers/handlers/accepted/claiming.js b/core/interactionHandlers/handlers/accepted/claiming.js index 6f7f1cb..dfb5c96 100644 --- a/core/interactionHandlers/handlers/accepted/claiming.js +++ b/core/interactionHandlers/handlers/accepted/claiming.js @@ -10,6 +10,7 @@ const storage = bot.storage const hiddendata = bot.hiddenData const embed = discord.EmbedBuilder const mc = config.color +const permsChecker = require("../../../utils/permisssionChecker") const button = discord.ButtonBuilder const arb = discord.ActionRowBuilder @@ -22,9 +23,15 @@ module.exports = () => { if (interaction.customId != "OTclaimTicket") return try { - interaction.deferUpdate() + await interaction.deferUpdate() }catch{} + if (!interaction.guild) return + if (!permsChecker.command(interaction.user.id,interaction.guild.id)){ + permsChecker.sendUserNoPerms(interaction.user) + return + } + interaction.channel.messages.fetchPinned().then(msglist => { /**@type {discord.Message} */ var firstmsg = msglist.last() @@ -40,11 +47,10 @@ module.exports = () => { .setFooter({text:"claimed by: "+interaction.user.tag,iconURL:interaction.user.displayAvatarURL()}) .setDescription(hdraw.description+bot.hiddenData.writeHiddenData(hiddendata.type,hiddendata.data)) - if (!firstmsg.components[0].components[1].disabled){ - firstmsg.edit({components:[bot.buttons.firstmsg.firstmsgRowNormalNoClaim],embeds:[newEmbed]}) - - }else if (firstmsg.components[0].components[1].disabled){ + if (firstmsg.components[0].components[1] && firstmsg.components[0].components[1].disabled){ firstmsg.edit({components:[bot.buttons.firstmsg.firstmsgRowDisabledNoClaim],embeds:[newEmbed]}) + }else{ + firstmsg.edit({components:[bot.buttons.firstmsg.firstmsgRowNormalNoClaim],embeds:[newEmbed]}) } }) }) diff --git a/core/transcriptSystem/communication/compileJson.js b/core/transcriptSystem/communication/compileJson.js index 7218495..a28a5f5 100644 --- a/core/transcriptSystem/communication/compileJson.js +++ b/core/transcriptSystem/communication/compileJson.js @@ -64,12 +64,12 @@ exports.compile = (guild,channel,user,messagesInv,data) => { }) }) - + const memberColor = msg.member ? msg.member.displayHexColor : "#ffffff" messagesArray.push({ author:{ name:msg.author.tag, id:Number(msg.author.id), - color:msg.member.displayHexColor || "#ffffff", + color:memberColor, pfp:msg.author.displayAvatarURL() }, content:msg.content || "", diff --git a/core/utils/hiddendata.js b/core/utils/hiddendata.js index 53dc898..f620185 100644 --- a/core/utils/hiddendata.js +++ b/core/utils/hiddendata.js @@ -1,5 +1,5 @@ -/**@typedef {{type:String,data:[{key:String,value:String}]}} hiddenData */ +/**@typedef {{type:String,data:[{key:String,value:String}],status:Boolean}} hiddenData */ /** * @@ -9,6 +9,7 @@ exports.readHiddenData = (messageContent) => { //ticketdata//type:123|userid:456) + if (!messageContent.includes("[ ](OTDATA|")) return {type:"",data:[],status:false} const rawhidden = messageContent.split("[ ](OTDATA|")[1] const rawhidden2 = rawhidden.split("//") @@ -29,7 +30,7 @@ exports.readHiddenData = (messageContent) => { resultData.push({key:dataresult[0],value:dataresult[1]}) }) - return {type:datatype,data:resultData} + return {type:datatype,data:resultData,status:true} } /** @@ -57,8 +58,9 @@ exports.writeHiddenData = (type,data) => { * @returns {{description:String,hiddenData:hiddenData}} */ exports.removeHiddenData = (description) => { - const hiddenData = this.readHiddenData(description) + if (!description.includes("[ ](OTDATA|")) return {description:description,hiddenData:[]} + const hiddenData = this.readHiddenData(description) const splitted = description.split("[ ](OTDATA") const original = splitted[0] diff --git a/language/slovenian.json b/language/slovenian.json index 53a4284..13d43cd 100644 --- a/language/slovenian.json +++ b/language/slovenian.json @@ -24,10 +24,17 @@ "closeTitle": "Zaprl ta ticket!", "deleteTitle": "Brisanje ticketa...", "reopenTitle": "Ponovno odprl ta ticket!", - "claimTitle": "Ta ticket je zdaj claimana za {0}", - "unclaimTitle": "Ta ticket ni več zahtevan!", - "changeTitle": "Vrsta ticketa je spremenjena na {0}!", + + "claimTitle":"Ticket je claimal {0}", + "unclaimTitle":"Ticket ni več claiman!", + "changeTitle":"Changed ticket type to {0}!", + "statsTitle":"Statistike za {0}!", + "autocloseTitle":"Ticket so avtomatsko zapru po {0}!", + "autocloseRejectTitle":"Ticket se nebo avtomatsko zapru!", + "autocloseWarn":"To ima efekt samo na inactive ticketih!", + + "goToTicket":"pojdi v ticket", "ticketWarning": "Opozorilo je v spodnjem sporočilu!", "maxTicketWarning": "**Opozorilo:** _Naenkrat lahko ustvarite le {0} ticketov!_" }, @@ -42,7 +49,12 @@ "deleteCmd": "Izbriši ticket.", "addCmd": "Dodaj uporabnika v ticket.", "removeCmd": "Odstrani uporabnika z ticket-a.", - "reopenCmd": "Ponovno odprite ticket, ko je bila zaprta." + "reopenCmd": "Ponovno odprite ticket, ko je bila zaprta.", + "changeCmd":"Spremeni tip ticketa.", + "claimCmd":"Claimaj ticket.", + "unclaimCmd":"Unclaimaj ticket.", + "statCmds":"Statistike ticketa.", + "autocloseCmd":"Nastavi timer da avtomatsko zapre ticket" }, "buttons":{ "close":"Zapri Ticket", @@ -51,9 +63,6 @@ "closeWithReason":"Zapri z razlogom" }, "messages":{ - "reopenTitle": "Ponovno odprl ta ticket!", - "reopenDescription": "Feel free to talk again!", - "closedTitle": "Zaprli ta ticket!", "closedDescription": "V tem ticket-u lahko zdaj govorijo samo administratorji!\n\n*Kliknite na spodnji gumb za brisanje ali ponovno odprtje te ticket!*", "createdTitle": "Ticket ustvarjen!", "createdDescription": "Vaš ticket je ustvarjen, lahko jo odkrijete s pingom!", @@ -71,9 +80,11 @@ "none": "ni", "reason": "razlog", - + "createdat":"ustvarjeno ob", + "openedby":"odprto od", "deletedby": "izbrisano s", "closedby": "zaprl", + "modalreason": "Kakšen je razlog za zaprtje tega ticket?", "chooseATicket": "Izberi ticket" },