v3.5.0 push 3
This commit is contained in:
@@ -13,6 +13,7 @@ storage/dynamicDB/
|
||||
storage/slashcmdEnabled.txt
|
||||
storage/database.json
|
||||
storage/tsdatabase.json
|
||||
storage/stats.json
|
||||
storage/.DS_Store
|
||||
.vscode/
|
||||
livestatus.json
|
||||
|
||||
+68
-4
@@ -5,11 +5,11 @@ const log = bot.errorLog.log
|
||||
const l = bot.language
|
||||
|
||||
/**@typedef {"TICKETS_CREATED"|"TICKETS_CLOSED"|"TICKETS_DELETED"|"TICKETS_REOPENED"|"TICKETS_AUTOCLOSED"|"TRANSCRIPTS_CREATED"|"TIME_SINCE_UPDATE"} OTGlobalStatsType */
|
||||
/**@typedef {"TICKET_AGE"} OTTicketStatsType */
|
||||
/**@typedef {"TICKETS_CREATED"} OTUserStatsType */
|
||||
/**@typedef {"TICKET_AGE"|"CREATED_BY"} OTTicketStatsType */
|
||||
/**@typedef {"TICKETS_CREATED"|"TICKETS_CLOSED"|"TICKETS_DELETED"|"TICKETS_REOPENED"} OTUserStatsType */
|
||||
/**
|
||||
* @callback OTStatsCallback
|
||||
* @param {Boolean|Number|String} current
|
||||
* @param {Boolean|Number|String|undefined} current
|
||||
* @returns {Boolean|Number|String|undefined}
|
||||
*/
|
||||
|
||||
@@ -63,9 +63,73 @@ const removeStats = (scope,type,id) => {
|
||||
bot.statsStorage.delete(newScope,type)
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {"global"|"ticket"|"user"} scope
|
||||
* @param {OTGlobalStatsType|OTTicketStatsType|OTUserStatsType} type
|
||||
* @param {String} [id]
|
||||
*/
|
||||
const existStats = (scope,type,id) => {
|
||||
const newScope = (scope == "global") ? scope : scope+"_"+id
|
||||
return (typeof bot.statsStorage.get(newScope,type) == "undefined") ? false : true
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {"global"|"ticket"|"user"} scope
|
||||
* @param {OTGlobalStatsType|OTTicketStatsType|OTUserStatsType} type
|
||||
* @param {String} [id]
|
||||
*/
|
||||
const getStats = (scope,type,id) => {
|
||||
const newScope = (scope == "global") ? scope : scope+"_"+id
|
||||
return bot.statsStorage.get(newScope,type)
|
||||
}
|
||||
|
||||
const startupStatsManager = () => {
|
||||
if (!existStats("global","TIME_SINCE_UPDATE")){
|
||||
updateGlobalStats("TIME_SINCE_UPDATE",(current) => {
|
||||
return new Date().getTime()
|
||||
})
|
||||
}
|
||||
if (!existStats("global","TICKETS_CREATED")){
|
||||
updateGlobalStats("TICKETS_CREATED",(current) => {
|
||||
return 0
|
||||
})
|
||||
}
|
||||
if (!existStats("global","TICKETS_CLOSED")){
|
||||
updateGlobalStats("TICKETS_CLOSED",(current) => {
|
||||
return 0
|
||||
})
|
||||
}
|
||||
if (!existStats("global","TICKETS_DELETED")){
|
||||
updateGlobalStats("TICKETS_DELETED",(current) => {
|
||||
return 0
|
||||
})
|
||||
}
|
||||
if (!existStats("global","TICKETS_AUTOCLOSED")){
|
||||
updateGlobalStats("TICKETS_AUTOCLOSED",(current) => {
|
||||
return 0
|
||||
})
|
||||
}
|
||||
if (!existStats("global","TICKETS_REOPENED")){
|
||||
updateGlobalStats("TICKETS_REOPENED",(current) => {
|
||||
return 0
|
||||
})
|
||||
}if (!existStats("global","TRANSCRIPTS_CREATED")){
|
||||
updateGlobalStats("TRANSCRIPTS_CREATED",(current) => {
|
||||
return 0
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
updateGlobalStats,
|
||||
updateTicketStats,
|
||||
updateUserStats,
|
||||
removeStats
|
||||
|
||||
removeStats,
|
||||
existStats,
|
||||
getStats,
|
||||
|
||||
startupStatsManager
|
||||
}
|
||||
@@ -10,7 +10,7 @@ const version = require("../info.json").version
|
||||
|
||||
const mentions = require("./mentions").replacementions
|
||||
|
||||
/**@typedef {{background:{enableCustomBackground:Boolean, backgroundModus:"color"|"image", backgroundData:String}, header:{enableCustomHeader:Boolean, decoColor:String, backgroundColor:String, textColor:String}, stats:{enableCustomStats:Boolean, backgroundColor:String, keyTextColor:String, valueTextColor:String, hideBackgroundColor:String, hideTextColor:String}} OTTranscriptStyle} */
|
||||
/**@typedef {{background:{enableCustomBackground:Boolean, backgroundModus:"color"|"image", backgroundData:String}, header:{enableCustomHeader:Boolean, decoColor:String, backgroundColor:String, textColor:String}, stats:{enableCustomStats:Boolean, backgroundColor:String, keyTextColor:String, valueTextColor:String, hideBackgroundColor:String, hideTextColor:String}, favicon:{enableCustomFavicon:Boolean, imageUrl:String}} OTTranscriptStyle} */
|
||||
/**@typedef {{name:String, id:String, pfp:String}} OTTranscriptBot */
|
||||
/**@typedef {{name:String, id:String, guildname:String, guildid:String, guildinvite:String|false, creatorname:String, creatorid:String, closedbyname:String, closedbyid:String, claimedname:String, claimedid:String, creatorpfp:String, closedbypfp:String, claimedpfp:String, closedtime:Number, openedtime:Number, components:{messages:1, files:1, embeds:1, reactions:1, interactions:{dropdowns:1, buttons:1, total:1}, attachments:{invites:1, images:1, gifs:1, stickers:1}}, roleColors:[{id:String,color:String}] }} OTTranscriptTicket */
|
||||
/**@typedef {{author:{name:String, id:String, color:String, pfp:String, bot:Boolean, verifiedBot:Boolean, system:Boolean}, content:String|false, timestamp:Number, type:"normal", important:Boolean, edited:Boolean, embeds:[{title:String|false, description:String|false, authorimg:String|false, authortext:String|false, footerimg:String|false, footertext:String|false, color:String, image:String|false, thumbnail:String|false, url:String|false, fields:[{name:String,value:String,inline:Boolean}]}], attachments:[{type:"FILE", name:String, fileType:String, size:String, url:String}, {type:"FILE:image", name:String, fileType:String, size:String, url:String}, {type:"URL:invite", guildId:String, guildName:String, guildSize:Number, guildOnline:Number, image:String, url:String}, {type:"URL:gif", url:String}, {type:"BUILDIN:sticker", name:String, url:String}], components:[{type:"buttons", buttons:[{type:"interaction"|"url", label:String|false, icon:String|false, color:"gray"|"green"|"red"|"blue", id:String|false, url:String|false, disabled:Boolean}]}, {type:"dropdown", placeholder:String|false, options:[{label:String|false, icon:String|false, description:String|false, id:String|false}]}, {type:"reactions", reactions:[{amount:1, emoji:String, type:"svg"|"image"|"gif"}]}], reply:{type:"reply"|"command"|false, user:{name:String, id:String, color:String, pfp:String, bot:Boolean, verifiedBot:Boolean, system:Boolean}, replyOptions:{content:String, messageId:String, channelId:String, guildId:String}, commandOptions:{interactionName:String, interactionId:String}}}} OTTranscriptMessage */
|
||||
@@ -288,6 +288,7 @@ exports.compile = (guild,channel,user,messagesInv,data) => {
|
||||
const dsb = data.style.background
|
||||
const dsh = data.style.header
|
||||
const dss = data.style.stats
|
||||
const dsf = data.style.favicon
|
||||
|
||||
/**@type {OTTranscriptCompileInput} */
|
||||
const result = {
|
||||
@@ -382,8 +383,8 @@ exports.compile = (guild,channel,user,messagesInv,data) => {
|
||||
name:"test-server"
|
||||
},
|
||||
customFavicon:{
|
||||
enabled:false,
|
||||
image:"https://openticket.dj-dj.be"
|
||||
enabled:dsf.enableCustomFavicon,
|
||||
image:(dsf.imageUrl) ? dsf.imageUrl : "https://openticket.dj-dj.be"
|
||||
},
|
||||
additionalFlags:[]
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ exports.upload = async (json) => {
|
||||
const data = encodeURIComponent(JSON.stringify(json))
|
||||
|
||||
try {
|
||||
const res = await axios.post("https://transcripts.dj-dj.be/api/upload?auth=openticketTRANSCRIPT1234&version=2",JSON.stringify(json))
|
||||
const res = await axios.post("https://apis.dj-dj.be/transcripts/upload?auth=openticketTRANSCRIPT1234&version=2",JSON.stringify(json))
|
||||
if (res.status != 200) resolve(false)
|
||||
|
||||
resolve(res.data)
|
||||
|
||||
@@ -55,6 +55,7 @@ module.exports = async (messages,guild,channel,user,reason) => {
|
||||
const tsb = tsconfig.style.background
|
||||
const tsh = tsconfig.style.header
|
||||
const tss = tsconfig.style.stats
|
||||
const tsf = tsconfig.style.favicon
|
||||
const JSONDATA = require("./communication/compileJsonV2").compile(guild,channel,user,messages,{
|
||||
style:{
|
||||
background:{
|
||||
@@ -75,6 +76,10 @@ module.exports = async (messages,guild,channel,user,reason) => {
|
||||
valueTextColor:tss.valueTextColor,
|
||||
hideBackgroundColor:tss.hideBackgroundColor,
|
||||
hideTextColor:tss.hideTextColor
|
||||
},
|
||||
favicon:{
|
||||
enableCustomFavicon:tsf.enableCustomFavicon,
|
||||
imageUrl:tsf.imageUrl
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
@@ -46,7 +46,7 @@ const getLivestatus = (local) => {
|
||||
}
|
||||
}else{
|
||||
try {
|
||||
axios.get("https://livestatus.dj-dj.be/openticket.json").then((res) => {
|
||||
axios.get("https://apis.dj-dj.be/livestatus/announcements/openticket.json").then((res) => {
|
||||
const livestatus = res.data
|
||||
if (!Array.isArray(livestatus)) return resolve(false)
|
||||
if (!livestatus) return resolve(false)
|
||||
|
||||
@@ -17,13 +17,10 @@
|
||||
|
||||
SUGGESTING NEW FEATURES:
|
||||
=====================
|
||||
Open Ticket is a community project. This means that
|
||||
almost all feature ideas come from our community.
|
||||
Are you missing something you want in open ticket?
|
||||
Then join our Discord server and we will add it (if possible)
|
||||
|
||||
Did you know that 80% of all features in OT were ideas from our community?
|
||||
|
||||
Open Ticket is an open-source community project!
|
||||
Because of this, almost 80% of all features in OT were ideas from our community!
|
||||
Feel free to add new ideas in our discord server
|
||||
or via github issues! Translations are always welcome!
|
||||
|
||||
|
||||
INFORMATION:
|
||||
@@ -32,7 +29,7 @@
|
||||
|
||||
discord: https://discord.dj-dj.be
|
||||
website: https://www.dj-dj.be
|
||||
github: https://openticket.dj-dj.be
|
||||
github: https://github.openticket.dj-dj.be
|
||||
support e-mail: support@dj-dj.be
|
||||
|
||||
Config files:
|
||||
@@ -60,6 +57,7 @@ exports.client = client
|
||||
client.setMaxListeners(50)
|
||||
if (process.argv.some((v) => v == "--debug")) console.log("[TEMP_DEBUG]","created client")
|
||||
|
||||
//LOAD CONFIG
|
||||
var tempconfig = require("./config.json")
|
||||
/**@type {Boolean} */
|
||||
var isDevConfig = false
|
||||
@@ -75,15 +73,16 @@ if (process.argv.some((v) => v == "--devconfig")){
|
||||
if (process.argv.some((v) => v == "--debug")) console.log("[TEMP_DEBUG]","loaded flags")
|
||||
|
||||
exports.developerConfig = isDevConfig
|
||||
|
||||
const config = tempconfig
|
||||
exports.config = config
|
||||
|
||||
const tsconfig = isDevConfig ? require("./devtsconfig.json") : require("./transcriptconfig.json")
|
||||
exports.tsconfig = tsconfig
|
||||
|
||||
//LOAD LANGUAGE
|
||||
const language = require("./core/languageManager").language
|
||||
exports.language = language
|
||||
|
||||
//LOAD FLAGS
|
||||
if (process.argv.some((v) => v == "--debug")) console.log("[TEMP_DEBUG]","loaded language")
|
||||
|
||||
if (process.argv.some((v) => v == "--debug")) console.log("[TEMP_DEBUG]","loaded config")
|
||||
@@ -98,11 +97,10 @@ if (process.argv.some((v) => v == "--debug")) console.log("[TEMP_DEBUG]","LOADED
|
||||
if (process.argv.some((v) => v == "--debug")) console.log("[TEMP_DEBUG]","switching to new logs")
|
||||
this.errorLog.log("debug","loaded new logs")
|
||||
|
||||
//LOAD SYSTEM LIBRARYS
|
||||
exports.actionRecorder = require("./core/utils/liveStatus").actionRecorder
|
||||
|
||||
exports.hiddenData = require("./core/utils/hiddendata")
|
||||
this.errorLog.log("debug","loaded hiddendataTM")
|
||||
|
||||
exports.embeds = {
|
||||
commands:require("./core/interactionHandlers/embeds/commands")
|
||||
}
|
||||
@@ -113,6 +111,9 @@ exports.buttons = {
|
||||
}
|
||||
this.errorLog.log("debug","loaded buttons & embeds")
|
||||
|
||||
require("./core/statsManager").startupStatsManager()
|
||||
|
||||
//START CLIENT LOGIN PROCESS
|
||||
client.on('ready',async () => {
|
||||
this.errorLog.log("debug","client logged in")
|
||||
this.actionRecorder.push({
|
||||
@@ -158,7 +159,6 @@ client.on('ready',async () => {
|
||||
this.errorLog.log("debug","loaded console interface")
|
||||
|
||||
if (config.status.enabled){
|
||||
console.log("TEST STATUS (delete me)")
|
||||
setStatus(config.status.type,config.status.text)
|
||||
}
|
||||
|
||||
@@ -232,7 +232,7 @@ client.on('ready',async () => {
|
||||
}
|
||||
}
|
||||
|
||||
//load plugins
|
||||
//LOAD PLUGINS (after client login)
|
||||
this.actionRecorder.push({
|
||||
category:"ot.managers.plugins",
|
||||
file:"./core/api/pluginlauncher.js",
|
||||
@@ -248,6 +248,8 @@ client.on('ready',async () => {
|
||||
})
|
||||
this.errorLog.log("debug","loading plugins")
|
||||
})
|
||||
|
||||
//LOAD CHECKER.JS
|
||||
if (!require("./core/api/api.json").disable.checkerjs.all){
|
||||
this.actionRecorder.push({
|
||||
category:"ot.managers.main",
|
||||
@@ -266,6 +268,7 @@ if (!require("./core/api/api.json").disable.checkerjs.all){
|
||||
})
|
||||
}
|
||||
|
||||
//LOAD COMMANDS & CORE
|
||||
if (process.argv[2] && process.argv[2].startsWith("slash")){
|
||||
//do nothing
|
||||
}else{
|
||||
@@ -320,6 +323,7 @@ if (process.argv[2] && process.argv[2].startsWith("slash")){
|
||||
})
|
||||
}
|
||||
|
||||
//LOAD API
|
||||
this.actionRecorder.push({
|
||||
category:"ot.managers.loader",
|
||||
file:"./index.js",
|
||||
@@ -337,6 +341,7 @@ this.actionRecorder.push({
|
||||
type:"api.success"
|
||||
})
|
||||
|
||||
//ERROR SYSTEM
|
||||
this.actionRecorder.push({
|
||||
category:"ot.managers.loader",
|
||||
file:"./index.js",
|
||||
@@ -388,6 +393,7 @@ this.actionRecorder.push({
|
||||
type:"debugsystem.success"
|
||||
})
|
||||
|
||||
//LOGIN SYSTEM
|
||||
const token = config.token.fromENV ? process.env.TOKEN : config.token.value
|
||||
client.login(token)
|
||||
this.errorLog.log("debug","login with token")
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"start": "node index.js",
|
||||
"test": "node index.js --devconfig",
|
||||
"test": "node index.js --devconfig --noerrorupload",
|
||||
"slashEnable": "node index.js slash enable",
|
||||
"slashDisable": "node index.js slash disable",
|
||||
"cleardata": "node ./core/dynamicdatabase/cleardata.js"
|
||||
|
||||
@@ -27,6 +27,10 @@
|
||||
"valueTextColor":"#ffffff",
|
||||
"hideBackgroundColor":"#40444a",
|
||||
"hideTextColor":"#ffffff"
|
||||
},
|
||||
"favicon":{
|
||||
"enableCustomFavicon":false,
|
||||
"imageUrl":"https://transcripts.dj-dj.be/favicon.png"
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user