v3.5.0 push 5

This commit is contained in:
DJj123dj
2023-12-14 21:37:29 +01:00
parent 94510bbfb0
commit 20b617f6eb
9 changed files with 162 additions and 72 deletions
+6 -5
View File
@@ -9,14 +9,15 @@ If there is translation missing & you can write json, then go to the next step!
### Step 2: translating
**RULES:**
- Always upload to the [__`dev` branch!__](https://github.com/DJj123dj/open-ticket/tree/dev)
- Always upload or create a pull request to the [__`dev` branch!__](https://github.com/DJj123dj/open-ticket/tree/dev)
- Don't change anything else, except the translation you are adding!
- Translations are checked before uploading, so don't write things that aren't specified in the json file
- Always start translating from `english.json` or `custom.json`! Never from another language.
If you translate, you need to change 2 files! The first one is required, the other one is optional & will be added by us if you don't do it!
If you translate, you need to change 2 files! The first one is required, the other 2 are optional & will be added by us if you don't do it!
1. add `yourlanguage.json` to the `/language/` directory
2. (OPTIONAL) add your discord name & tag in the translator table in `README.md`
2. add your username to the `_CREDITS` part of `yourlanguage.json`!
3. add your discord username in the translator table in `README.md`
### Step 3: waiting
Translations will always be added in the **next version** of Open Ticket! They will never be added to the `main` branch directly without anything else! This means that it can take some time before your translation is in the official version!
@@ -28,10 +29,10 @@ But don't worry! You can already write some plugins!
**RULES:**
- Always specify the versions that the plugin is compatible with!
- If extra npm dependencies are needed, then they also need to be specified!
- If there are errors while you write a plugin/edit the code in some way. Then we can't help you with fixing the bug. We only fix bugs that are part of an unedited version of Open Ticket!
- If there are errors while you write a plugin/edit the code in some way. Then we can't help you with fixing the bug. We only fix bugs that are part of the original unedited version of Open Ticket!
## Other versions of contributing
If you want to contribute in another way, feel free to join [our discord server](https://discord.dj-dj.be) & talk about how you are going to do it. We will always help you!
If you want to contribute in another way, feel free to join [our discord server](https://discord.dj-dj.be) & talk about how you are going to do it. We will always help you further!
<br>
CONTRIBUTING GUIDELINES - Last updated: 23/3/2023<br>
+13 -13
View File
@@ -2,7 +2,7 @@
## Supported Versions
Support for Open Ticket is only available for the versions specified below!
We only support Open Ticket versions listed below! With support, we mean bugs, errors & helping you further!
✅ Supported
🟧 Partially Supported
@@ -12,29 +12,29 @@ Support for Open Ticket is only available for the versions specified below!
|-----------|-------------------|
| 3.5.0 | ✅ |
| 3.4.4 | ✅ |
| 3.4.3 | ✅ |
| 3.4.3 | 🟧 |
| 3.4.2 | 🟧 |
| < 3.4.2 | ❌ |
## Reporting a Vulnerability
You can report Vulnerabilities, errors & bugs in the following ways:
You can report Vulnerabilities, Errors & Bugs using one of the methods below:
- Create an issue on github
- Create a ticket in our [discord server](https://discord.dj-dj.be)
- Report the bug in DM on discord (djj123dj)
- Email [support@dj-dj.be](mailto:support@dj-dj.be)
- Creating an issue on github
- Creating a ticket in our discord server
- Reporting the bug in DM on discord (DJj123dj#1706)
- Emailing support@dj-dj.be
If your report an error, be clear about what is going on.
Specify the version & language of the bot together with when the error happend. (for example: when I click the close button)
Send screenshots from the error if possible, and send openticketdebug.txt (or a screenshot of it) to us.
Don't just report the error and never reply again! It can be possible that we need you for more information!
While reporting your problem, please be clear about what the problem is.
We would like to know the issue in as much detail as possible.
If possible, try to provide screenshots!
The `openticketdebug.txt` file would also be handy to upload!<br>
**Always specify the version of open ticket that you are working with and if you have modified it or not!**
## Contributing
Visit [Contributing.md](/.github/CONTRIBUTING.md) for rules about translating & adding features!
<br>
SECURITY POLICY - Last updated: 9/11/2023<br>
SECURITY POLICY - Last updated: 14/12/2023<br>
© DJdj Development<br><br>
Website: https://www.dj-dj.be <br>
Discord: https://discord.dj-dj.be <br>
+3 -2
View File
@@ -21,7 +21,8 @@ module.exports = () => {
const header = l.helpMenu.header2
helpEmbed.setDescription(header+"`"+prefix+msgName+" <id>` ➜ _"+l.helpMenu.msgCmd+"_\n\n`"+prefix+"rename <name>` ➜ _"+l.helpMenu.renameCmd+"_\n`"+prefix+"close [reason]` ➜ _"+l.helpMenu.closeCmd+"_\n`"+prefix+"delete` ➜ _"+l.helpMenu.deleteCmd+"_\n`"+prefix+"reopen` ➜ _"+l.helpMenu.reopenCmd+"_\n\n`"+prefix+"add <user>` ➜ _"+l.helpMenu.addCmd+"_\n`"+prefix+"remove <user>` ➜ _"+l.helpMenu.removeCmd+"_\n\n`"+prefix+"change <newtype>` ➜ _"+l.helpMenu.changeCmd+"_\n`"+prefix+"claim [user]` ➜ _"+l.helpMenu.claimCmd+"_\n`"+prefix+"unclaim` ➜ _"+l.helpMenu.unclaimCmd+"_")
helpEmbed.addFields([
{name:"Autoclose",value:l.helpMenu.autocloseCmd+"\n`"+prefix+"autoclose enable <inactive time>`\n`"+prefix+"autoclose disable`"}
{name:"Autoclose",value:l.helpMenu.autocloseCmd+"\n`"+prefix+"autoclose enable <inactive time>`\n`"+prefix+"autoclose disable`"},
{name:"Stats",value:"Get statistics from the bot"+"\n`"+prefix+"stats global`\n`"+prefix+"stats ticket`\n`"+prefix+"stats user [user]`"}
])
var otherprefix = prefix.endsWith(" ") ? prefix.substring(0,prefix.length-1) : prefix
@@ -38,7 +39,7 @@ module.exports = () => {
}
if (args[1]){
if (!args[1].startsWith("close") && !args[1].startsWith("delete") && !args[1].startsWith("remove") && !args[1].startsWith("add") && !args[1].startsWith("msg") && !args[1].startsWith("remove") && !args[1].startsWith("rename") && !args[1].startsWith("reopen") && !args[1].startsWith("change") && !args[1].startsWith("claim") && !args[1].startsWith("unclaim")){
if (!args[1].startsWith("close") && !args[1].startsWith("delete") && !args[1].startsWith("remove") && !args[1].startsWith("add") && !args[1].startsWith("msg") && !args[1].startsWith("remove") && !args[1].startsWith("rename") && !args[1].startsWith("reopen") && !args[1].startsWith("change") && !args[1].startsWith("claim") && !args[1].startsWith("unclaim") && !args[1].startsWith("stats")){
msg.channel.send({embeds:[helpEmbed]})
log("command","someone used the 'help' command",[{key:"user",value:msg.author.username}])
APIEvents.onCommand("help",true,msg.author,msg.channel,msg.guild,new Date())
+88 -38
View File
@@ -1,53 +1,103 @@
/**
!!! NEW !!!
The /stats command
const discord = require('discord.js')
const bot = require('../index')
const client = bot.client
const config = bot.config
const log = bot.errorLog.log
const l = bot.language
const permsChecker = require("../core/utils/permisssionChecker")
(well, it's not finished yet 😉)
=================================================
client.on("messageCreate",async (msg) => {
if (!msg.content.startsWith("!test global")) return
msg.channel.send({
content:"testing `GLOBAL_STATS`",
embeds:[await createGlobalStatsEmbed()]
})
})
client.on("messageCreate",async (msg) => {
if (!msg.content.startsWith("!test ticket")) return
const APIEvents = require("../core/api/modules/events")
const DISABLE = require("../core/api/api.json").disable
if (!existStats("ticket","STATUS",msg.channel.id)){
module.exports = () => {
bot.errorLog.log("debug","COMMANDS: loaded stats.js")
if (!DISABLE.commands.text.stats) client.on("messageCreate",async (msg) => {
if (!msg.content.startsWith(config.prefix+"stats global") && !msg.content.startsWith(config.prefix+"stats ticket") && !msg.content.startsWith(config.prefix+"stats user")) return
if (!msg.guild) return
/**@type {"global"|"ticket"|"user"} */
const mode = msg.content.split(config.prefix+"stats ")[1]
if (mode == "global"){
//send global stats
msg.channel.send({embeds:[await bot.statsManager.createGlobalStatsEmbed()]})
}else if (mode == "user"){
//send user stats
const mention = msg.mentions.users.first()
if (mention){
//get user from mention
if (!bot.statsManager.existStats("user","TICKETS_CREATED",mention.id)){
msg.channel.send({embeds:[bot.errorLog.serverError("This user can't be found in the stats database!")]})
return
}
msg.channel.send({embeds:[await bot.statsManager.createUserStatsEmbed(msg.guild,mention,msg.channel.id)]})
}else{
//use author as user
if (!bot.statsManager.existStats("user","TICKETS_CREATED",msg.author.id)){
msg.channel.send({embeds:[bot.errorLog.serverError("This user can't be found in the stats database!")]})
return
}
msg.channel.send({embeds:[await bot.statsManager.createUserStatsEmbed(msg.guild,msg.author,msg.channel.id)]})
}
}else if (mode == "ticket"){
//send ticket stats
if (!bot.statsManager.existStats("ticket","STATUS",msg.channel.id)){
msg.channel.send({embeds:[bot.errorLog.notInATicket]})
return
}
msg.channel.send({embeds:[await bot.statsManager.createTicketStatsEmbed(msg.guild,msg.channel.id)]})
}
msg.channel.send({
content:"testing `TICKET_STATS`",
embeds:[await createTicketStatsEmbed(msg.guild,msg.channel.id)]
log("command","someone used the 'stats' command",[{key:"user",value:msg.author.username},{key:"mode",value:mode}])
APIEvents.onCommand("stats",true,msg.author,msg.channel,msg.guild,new Date())
})
})
client.on("messageCreate",async (msg) => {
if (!msg.content.startsWith("!test user")) return
const mention = msg.mentions.users.first()
if (!DISABLE.commands.slash.stats) client.on("interactionCreate",async (interaction) => {
if (!interaction.isChatInputCommand()) return
if (interaction.commandName != "stats") return
if (!interaction.guild) return
/**@type {"global"|"ticket"|"user"} */
const mode = interaction.options.getSubcommand(true)
await interaction.deferReply()
if (mode == "global"){
//send global stats
interaction.editReply({embeds:[await bot.statsManager.createGlobalStatsEmbed()]})
}else if (mode == "user"){
//send user stats
const mention = interaction.options.getUser("user",false)
if (mention){
if (!existStats("user","TICKETS_CREATED",mention.id)){
msg.channel.send({embeds:[bot.errorLog.serverError("This user can't be found in the stats database!")]})
//get user from mention
if (!bot.statsManager.existStats("user","TICKETS_CREATED",mention.id)){
interaction.editReply({embeds:[bot.errorLog.serverError("This user can't be found in the stats database!")]})
return
}
msg.channel.send({
content:"testing `USER_STATS`",
embeds:[await createUserStatsEmbed(msg.guild,mention,msg.channel.id)]
})
interaction.editReply({embeds:[await bot.statsManager.createUserStatsEmbed(interaction.guild,mention,interaction.channel.id)]})
}else{
if (!existStats("user","TICKETS_CREATED",msg.author.id)){
msg.channel.send({embeds:[bot.errorLog.serverError("This user can't be found in the stats database!")]})
//use author as user
if (!bot.statsManager.existStats("user","TICKETS_CREATED",interaction.user.id)){
interaction.editReply({embeds:[bot.errorLog.serverError("This user can't be found in the stats database!")]})
return
}
msg.channel.send({
content:"testing `USER_STATS`",
embeds:[await createUserStatsEmbed(msg.guild,msg.author,msg.channel.id)]
})
interaction.editReply({embeds:[await bot.statsManager.createUserStatsEmbed(interaction.guild,interaction.user,interaction.channel.id)]})
}
})
*/
}else if (mode == "ticket"){
//send ticket stats
if (!bot.statsManager.existStats("ticket","STATUS",interaction.channel.id)){
interaction.editReply({embeds:[bot.errorLog.notInATicket]})
return
}
interaction.editReply({embeds:[await bot.statsManager.createTicketStatsEmbed(interaction.guild,interaction.channel.id)]})
}
log("command","someone used the 'stats' command",[{key:"user",value:interaction.user.username},{key:"mode",value:mode}])
APIEvents.onCommand("stats",true,interaction.user,interaction.channel,interaction.guild,new Date())
})
}
+4 -2
View File
@@ -30,7 +30,8 @@
"rename":false,
"claim":false,
"unclaim":false,
"change":false
"change":false,
"stats":false
},
"slash":{
"help":false,
@@ -44,7 +45,8 @@
"rename":false,
"claim":false,
"unclaim":false,
"change":false
"change":false,
"stats":false
}
},
"checkerjs":{
+1 -1
View File
@@ -229,7 +229,7 @@ exports.onTranscriptCreation = (messages,channel,guild,date) => {
}
/**@typedef {"help"|"message"|"close"|"delete"|"reopen"|"rename"|"add"|"remove"|"claim"|"unclaim"|"change"} OTCommandType */
/**@typedef {"help"|"message"|"close"|"delete"|"reopen"|"rename"|"add"|"remove"|"claim"|"unclaim"|"change"|"stats"} OTCommandType */
/**
*
+36 -2
View File
@@ -34,8 +34,8 @@ module.exports = async (invisible) => {
if (!invisible){
setInterval(() => {
if (process.stdout && process.stdout.cursorTo) process.stdout.cursorTo(0)
process.stdout.write("[status] there are "+chalk.blue(readystats+" out of 13")+" commands ready! (this can take up to 40 seconds)")
if (readystats >= 13){
process.stdout.write("[status] there are "+chalk.blue(readystats+" out of 14")+" commands ready! (this can take up to 40 seconds)")
if (readystats >= 14){
console.log(chalk.green("\nready!"))
console.log(chalk.blue("you can now start the bot with "+chalk.bgBlue("'npm start'")+"!"))
process.exit(1)
@@ -268,4 +268,38 @@ module.exports = async (invisible) => {
readystats++
})
//stats
client.application.commands.create({
name:"stats",
description:"See bot statistics!",
defaultPermission:true,
type:act.ChatInput,
options:[
{
type:acot.Subcommand,
name:"global",
description:"See the global bot stats!"
},
{
type:acot.Subcommand,
name:"ticket",
description:"See the stats of a ticket (use inside of ticket)!"
},
{
type:acot.Subcommand,
name:"user",
description:"See the stats from a user or yourself!",
options:[
{
type:acot.User,
name:"user",
required:false,
description:"See the stats from a specific user!"
}
]
}
]
},sid).then(() => {
readystats++
})
}
+1 -1
View File
@@ -220,7 +220,7 @@ const getTicketStats = async (guild,channelid) => {
createdAt: (typeof createdAt == "undefined") ? new Date().getTime() : createdAt,
createdBy: (typeof createdBy == "undefined") ? 0 : createdBy,
messageAmount,
participants:participants,
participants:participants.slice(0,50),
ticketName:channel.name,
status: (typeof status == "undefined") ? "open" : status
}
+2
View File
@@ -293,6 +293,8 @@ if (process.argv[2] && process.argv[2].startsWith("slash")){
require("./commands/claim")()
require("./commands/unclaim")()
require("./commands/change")()
require("./commands/stats")()
this.actionRecorder.push({
category:"ot.managers.loader",
file:"./index.js",