v3.2.2 push 1
This commit is contained in:
+2
-2
@@ -5,7 +5,7 @@ exports.checker = async () => {
|
||||
if (process.argv.some((v) => v == "--devconfig")){
|
||||
//console.log(chalk.blue("=> used dev config instead of normal config"))
|
||||
try{
|
||||
var tempconfig = require("../devConfig.json")
|
||||
var tempconfig = require("../devconfig.json")
|
||||
}catch(err){console.log(err);var tempconfig = require("../config.json")}
|
||||
}else{
|
||||
var tempconfig = require("../config.json")
|
||||
@@ -404,7 +404,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")){
|
||||
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")){
|
||||
createError("'languagefile' | invalid language, more info in the wiki")
|
||||
}
|
||||
|
||||
|
||||
+4
-13
@@ -1,23 +1,14 @@
|
||||
const index = require("../index")
|
||||
|
||||
if (index.developerConfig){
|
||||
var config = require("../devConfig.json")
|
||||
var config = require("../devconfig.json")
|
||||
}else{var config = require("../config.json")}
|
||||
|
||||
|
||||
var localLanguage = require("../language/english.json")
|
||||
if (config.languagefile.startsWith("custom")) localLanguage = require("../language/custom.json")
|
||||
else if (config.languagefile.startsWith("dutch")) localLanguage = require("../language/dutch.json")
|
||||
else if (config.languagefile.startsWith("english")) localLanguage = require("../language/english.json")
|
||||
else if (config.languagefile.startsWith("german")) localLanguage = require("../language/german.json")
|
||||
else if (config.languagefile.startsWith("french")) localLanguage = require("../language/french.json")
|
||||
else if (config.languagefile.startsWith("romanian")) localLanguage = require("../language/romanian.json")
|
||||
else if (config.languagefile.startsWith("arabic")) localLanguage = require("../language/arabic.json")
|
||||
else if (config.languagefile.startsWith("spanish")) localLanguage = require("../language/spanish.json")
|
||||
else if (config.languagefile.startsWith("portuguese")) localLanguage = require("../language/portuguese.json")
|
||||
else if (config.languagefile.startsWith("italian")) localLanguage = require("../language/italian.json")
|
||||
else if (config.languagefile.startsWith("danish")) localLanguage = require("../language/danish.json")
|
||||
|
||||
const fs = require("fs")
|
||||
const lfexists = fs.existsSync("./language/"+config.languagefile+".json")
|
||||
if (lfexists) localLanguage = require("../language/"+config.languagefile+".json")
|
||||
|
||||
const errorLog = async () => {
|
||||
const chalk = await (await import("chalk")).default
|
||||
|
||||
@@ -239,12 +239,37 @@ exports.NEWcloseTicket = async (member,channel,prefix,mode,reason,nomessage) =>
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {discord.TextChannel} channel
|
||||
* @param {Number} limit
|
||||
* @returns
|
||||
*/
|
||||
const getmessages = async (channel,limit) => {
|
||||
const final = []
|
||||
var lastId = ""
|
||||
|
||||
while (true) {
|
||||
const options = {limit:100}
|
||||
if (lastId) options.before = lastId
|
||||
|
||||
const messages = await channel.messages.fetch(options)
|
||||
messages.forEach(msg => {final.push(msg)})
|
||||
lastId = messages.last().id
|
||||
|
||||
if (messages.size != 100 || final >= limit) {
|
||||
break
|
||||
}
|
||||
}
|
||||
return final
|
||||
}
|
||||
|
||||
|
||||
const transcriptHandler = async () => {
|
||||
if (!bot.tsconfig.sendTranscripts.enableChannel && !bot.tsconfig.sendTranscripts.enableDM) return false
|
||||
|
||||
const APIEvents = require("../api/modules/events")
|
||||
const messages = await channel.messages.fetch({cache:true})
|
||||
const messages = await getmessages(channel,5000)
|
||||
await require("../transcriptSystem/manager")(messages,guild,channel,user,reason)
|
||||
APIEvents.onTranscriptCreation(messages,channel,guild,new Date())
|
||||
}
|
||||
|
||||
@@ -53,10 +53,10 @@ module.exports = () => {
|
||||
|
||||
if (interaction.isButton()){
|
||||
try {
|
||||
interaction.deferUpdate()
|
||||
if (config.system.answerInEphemeralOnOpen) interaction.deferReply({ephemeral:true})
|
||||
} catch{}
|
||||
}else if (interaction.isChatInputCommand()){
|
||||
interaction.reply({embeds:[bot.errorLog.success(l.messages.createdTitle,l.messages.createdDescription)]})
|
||||
interaction.deferReply({ephemeral:config.system.answerInEphemeralOnOpen})
|
||||
}else if (interaction.isStringSelectMenu()){
|
||||
try {
|
||||
interaction.deferUpdate()
|
||||
@@ -65,14 +65,6 @@ module.exports = () => {
|
||||
|
||||
if (storage.get("ticketStorage",interaction.member.id) == null || storage.get("ticketStorage",interaction.member.id) == "false"|| Number(storage.get("ticketStorage",interaction.member.id)) < config.system.max_allowed_tickets){
|
||||
|
||||
try{
|
||||
if (currentTicketOptions.enableDmOnOpen){
|
||||
interaction.member.send({embeds:[bot.errorLog.custom(l.messages.newTicketDmTitle,currentTicketOptions.message,":ticket:",config.main_color)]})
|
||||
}
|
||||
}
|
||||
catch{log("system","can't send DM to member, member doesn't allow dm's")}
|
||||
|
||||
|
||||
//update storage
|
||||
storage.set("ticketStorage",interaction.member.id,Number(storage.get("ticketStorage",interaction.member.id))+1)
|
||||
var ticketNumber = interaction.member.user.username
|
||||
@@ -205,6 +197,24 @@ module.exports = () => {
|
||||
|
||||
log("system","created new ticket",[{key:"ticket",value:ticketName},{key:"user",value:interaction.user.tag}])
|
||||
require("../api/modules/events").onTicketOpen(interaction.user,ticketChannel,interaction.guild,new Date(),{name:ticketName,status:"open",ticketOptions:currentTicketOptions})
|
||||
|
||||
const channelbutton = new discord.ActionRowBuilder()
|
||||
.addComponents([
|
||||
new discord.ButtonBuilder()
|
||||
.setStyle(discord.ButtonStyle.Link)
|
||||
.setDisabled(false)
|
||||
.setEmoji("🎫")
|
||||
.setLabel("go to ticket")
|
||||
.setURL(ticketChannel.url)
|
||||
])
|
||||
|
||||
try{
|
||||
if (currentTicketOptions.enableDmOnOpen) interaction.member.send({embeds:[bot.errorLog.custom(l.messages.newTicketDmTitle,currentTicketOptions.message,":ticket:",config.main_color)],components:[channelbutton]})
|
||||
}
|
||||
catch{log("system","failed to send DM")}
|
||||
|
||||
if ((interaction.isButton() && config.system.answerInEphemeralOnOpen) || interaction.isChatInputCommand()) interaction.editReply({embeds:[bot.errorLog.success(l.messages.createdTitle,l.messages.createdDescription)],components:[channelbutton]})
|
||||
|
||||
})
|
||||
}else{
|
||||
try {
|
||||
|
||||
@@ -119,7 +119,7 @@ module.exports = async (messages,guild,channel,user,reason) => {
|
||||
if (!user) return
|
||||
const embed = tsembeds.tsready(chName,chId,url,user)
|
||||
try {
|
||||
user.send({embeds:[embed]})
|
||||
ticketopener.send({embeds:[embed]})
|
||||
}catch{}
|
||||
}
|
||||
},duration)
|
||||
|
||||
Reference in New Issue
Block a user