diff --git a/.eggs/README.md b/.eggs/README.md
index 7d1eba7..0342bc9 100644
--- a/.eggs/README.md
+++ b/.eggs/README.md
@@ -2,7 +2,7 @@
[](https://discord.com/invite/26vT9wt3n3)
-[](https://github.com/open-discord-bots/open-ticket/releases/tag/v4.0.4)
+[](https://github.com/open-discord-bots/open-ticket/releases/tag/v4.0.5)
[](https://github.com/sponsors/DJj123dj)
[](.eggs/README.md)
@@ -20,6 +20,9 @@ It's recommended to provide at least `1GB` of **Memory/RAM** and `5GB` of **disk
[**`openticket-egg-main.json` (Recommended)**](openticket-egg-main.json)
- This egg will use the `main` branch of Open Ticket.
+[**`openticket-egg-v4.0.5.json`**](openticket-egg-v4.0.5.json)
+- This egg will always use Open Ticket `v4.0.5`. Open Ticket updates will not have an effect on this egg.
+
[**`openticket-egg-v4.0.4.json`**](openticket-egg-v4.0.4.json)
- This egg will always use Open Ticket `v4.0.4`. Open Ticket updates will not have an effect on this egg.
diff --git a/.eggs/openticket-egg-v4.0.5.json b/.eggs/openticket-egg-v4.0.5.json
new file mode 100644
index 0000000..7206808
--- /dev/null
+++ b/.eggs/openticket-egg-v4.0.5.json
@@ -0,0 +1,62 @@
+{
+ "_comment": "DO NOT EDIT: FILE GENERATED AUTOMATICALLY BY PTERODACTYL PANEL - PTERODACTYL.IO",
+ "meta": {
+ "version": "PTDL_v2",
+ "update_url": null
+ },
+ "exported_at": "2025-03-16T18:10:18+01:00",
+ "name": "Open Ticket (v4.0.5)",
+ "author": "support@dj-dj.be",
+ "description": "This is the official Pterodactyl egg for Open Ticket v4.0.5, the most advanced & customisable discord ticket bot that you will ever find! You can customise up to 300+ variables! This includes Html Transcripts, Advanced Plugins, Custom Embeds, Questions\/Modals, Stats & more!",
+ "features": null,
+ "docker_images": {
+ "ghcr.io\/parkervcp\/yolks:nodejs_20": "ghcr.io\/parkervcp\/yolks:nodejs_20"
+ },
+ "file_denylist": [],
+ "startup": "if [[ ! -z ${NODE_PACKAGES} ]]; then npm install ${NODE_PACKAGES}; fi; if [[ ! -z ${UNNODE_PACKAGES} ]]; then npm uninstall ${UNNODE_PACKAGES}; fi; if [ -f \/home\/container\/package.json ]; then npm install; fi; node \"\/home\/container\/index.js\" ${NODE_FLAGS};",
+ "config": {
+ "files": "{}",
+ "startup": "{\r\n \"done\": \"STARTUP INFO:\"\r\n}",
+ "logs": "{}",
+ "stop": "^C"
+ },
+ "scripts": {
+ "installation": {
+ "script": "#!\/bin\/bash\r\n# Open Ticket Installation Script (v4.0.5)\r\n# Inspired by: Node.js Installation Script\r\n# \u00a9 DJdj Development\r\n\r\necho -e \"[OT INSTALLER] installing dependencies. please wait...\"\r\napt update\r\napt install -y git curl\r\n\r\necho -e \"[OT INSTALLER] updating npm. please wait...\"\r\nnpm install npm@latest --location=global\r\n\r\nmkdir -p \/mnt\/server\r\ncd \/mnt\/server\r\n\r\nBRANCH=\"v4.0.5\"\r\n\r\nif [ \"$(ls -A \/mnt\/server)\" ]; then\r\n echo -e \"[OT INSTALLER] \/mnt\/server directory is not empty.\"\r\n if [ -d .git ]; then\r\n echo -e \"[OT INSTALLER] .git directory exists\"\r\n if [ -f .git\/config ]; then\r\n echo -e \"[OT INSTALLER] loading info from git config\"\r\n ORIGIN=$(git config --get remote.origin.url)\r\n else\r\n echo -e \"[OT INSTALLER] files found with no git config\"\r\n echo -e \"[OT INSTALLER] closing out without touching things to not break anything\"\r\n exit 10\r\n fi\r\n fi\r\n\r\n if [ \"${ORIGIN}\" == \"https:\/\/github.com\/open-discord-bots\/open-ticket.git\" ]; then\r\n echo \"pulling latest from github\"\r\n git pull\r\n fi\r\nelse\r\n echo -e \"[OT INSTALLER] \/mnt\/server is empty.\"\r\n echo -e \"[OT INSTALLER] cloning files into repo.\"\r\n if [ -z ${BRANCH} ]; then\r\n echo -e \"[OT INSTALLER] cloning default branch\"\r\n git clone https:\/\/github.com\/open-discord-bots\/open-ticket.git .\r\n else\r\n echo -e \"[OT INSTALLER] cloning ${BRANCH}'\"\r\n git clone --single-branch --branch ${BRANCH} https:\/\/github.com\/open-discord-bots\/open-ticket.git .\r\n fi\r\nfi\r\n\r\necho -e \"[OT INSTALLER] installing Open Ticket node.js packages.\"\r\nif [ -f \/mnt\/server\/package.json ]; then\r\n \/usr\/local\/bin\/npm install --omit=dev\r\nfi\r\n\r\necho -e \"[OT INSTALLER] installing custom node.js packages.\"\r\nif [[ ! -z ${NODE_PACKAGES} ]]; then\r\n \/usr\/local\/bin\/npm install ${NODE_PACKAGES}\r\nfi\r\n\r\necho -e \"[OT INSTALLER] install complete!\"\r\nexit 0",
+ "container": "node:latest",
+ "entrypoint": "bash"
+ }
+ },
+ "variables": [
+ {
+ "name": "Additional Npm Packages",
+ "description": "Specify additional npm packages used by Open Ticket plugins. Use spaces to separate.",
+ "env_variable": "NODE_PACKAGES",
+ "default_value": "",
+ "user_viewable": false,
+ "user_editable": true,
+ "rules": "string|nullable",
+ "field_type": "text"
+ },
+ {
+ "name": "Startup Flags",
+ "description": "Start the bot with additional Open Ticket flags. Separate using spaces.\r\nA full reference list can be found in the documentation.",
+ "env_variable": "NODE_FLAGS",
+ "default_value": "",
+ "user_viewable": false,
+ "user_editable": true,
+ "rules": "string|nullable",
+ "field_type": "text"
+ },
+ {
+ "name": "Uninstall Npm Packages",
+ "description": "A list of npm packages to uninstall. Separate by spaces.",
+ "env_variable": "UNNODE_PACKAGES",
+ "default_value": "",
+ "user_viewable": false,
+ "user_editable": true,
+ "rules": "string|nullable",
+ "field_type": "text"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md
index 368e26e..953ff77 100644
--- a/.github/CONTRIBUTING.md
+++ b/.github/CONTRIBUTING.md
@@ -1,7 +1,7 @@
# Contributing Guidelines
-[](https://discord.com/invite/26vT9wt3n3) [](https://github.com/open-discord-bots/open-ticket/releases/tag/v4.0.4) [](https://github.com/sponsors/DJj123dj)
+[](https://discord.com/invite/26vT9wt3n3) [](https://github.com/open-discord-bots/open-ticket/releases/tag/v4.0.5) [](https://github.com/sponsors/DJj123dj)
These are the Contributing Guidelines of Open Ticket!
Here you can find everything you need to know about contributing to Open Ticket.
diff --git a/.github/SECURITY.md b/.github/SECURITY.md
index a40952d..cda1f14 100644
--- a/.github/SECURITY.md
+++ b/.github/SECURITY.md
@@ -20,6 +20,7 @@ This list will be updated on every release.
| Version | Supported | Notes |
|------------|-----------|------------------------------------------|
| 4.1.0 | ๐ฆ | |
+| 4.0.5 | โ
| |
| 4.0.4 | โ
| |
| 4.0.3 | โ
| Transcripts v2.0 (Offline August 2025) |
| 4.0.2 | ๐ง | Major discord.js bug |
diff --git a/README.md b/README.md
index d3d4df4..665d165 100644
--- a/README.md
+++ b/README.md
@@ -8,7 +8,7 @@
Powered By

-
+
diff --git a/config/general.json b/config/general.json
index 03132b8..2d8fe37 100644
--- a/config/general.json
+++ b/config/general.json
@@ -2,7 +2,7 @@
"_INFO":{
"support":"https://otdocs.dj-dj.be",
"discord":"https://discord.dj-dj.be",
- "version":"open-ticket-v4.0.4"
+ "version":"open-ticket-v4.0.5"
},
"token":"your bot token here! (or leave empty when using 'tokenFromENV')",
diff --git a/config/panels.json b/config/panels.json
index 07cc86e..3017154 100644
--- a/config/panels.json
+++ b/config/panels.json
@@ -17,7 +17,7 @@
"image":"https://www.example.com/image.png (or leave empty)",
"thumbnail":"https://www.example.com/image.png (or leave empty)",
- "footer":"Open Ticket v4.0.4 (or leave empty)",
+ "footer":"Open Ticket v4.0.5 (or leave empty)",
"fields":[
{"name":"field name","value":"field value","inline":false}
],
diff --git a/index.js b/index.js
index 4c0d6ed..8480e05 100644
--- a/index.js
+++ b/index.js
@@ -14,7 +14,7 @@ process.argv.push(...flags)
โโโ โโโโโโโโโโ โโโโโโ โโโโโโโโโโ โโโ โโโโโโ โโโโโโโ โโโโโโ โโโ
โโโโโโโโโโโโ โโโโโโโโโโโ โโโโโโ โโโ โโโโโโโโโโโโโโ โโโโโโโโโโโ โโโ
โโโโโโโ โโโ โโโโโโโโโโโ โโโโโ โโโ โโโ โโโโโโโโโโ โโโโโโโโโโโ โโโ
- v4.0.4 - Made by DJj123dj & Contributors
+ v4.0.5 - Made by DJj123dj & Contributors
Discord: https://discord.dj-dj.be
Docs: https://otdocs.dj-dj.be
diff --git a/languages/arabic.json b/languages/arabic.json
index 7b85661..57b279b 100644
--- a/languages/arabic.json
+++ b/languages/arabic.json
@@ -1,6 +1,6 @@
{
"_TRANSLATION": {
- "otversion": "v4.0.4",
+ "otversion": "v4.0.5",
"translators": ["palestinian"],
"lastedited": "06/12/2024",
"language": "Arabic",
diff --git a/languages/catalan.json b/languages/catalan.json
index f7c4c58..f41e694 100644
--- a/languages/catalan.json
+++ b/languages/catalan.json
@@ -1,6 +1,6 @@
{
"_TRANSLATION":{
- "otversion":"v4.0.4",
+ "otversion":"v4.0.5",
"translators":["guillee3"],
"lastedited":"21/08/2024",
"language":"Catalan",
diff --git a/languages/custom.json b/languages/custom.json
index 65f7ab4..dda25a6 100644
--- a/languages/custom.json
+++ b/languages/custom.json
@@ -1,6 +1,6 @@
{
"_TRANSLATION":{
- "otversion":"v4.0.4",
+ "otversion":"v4.0.5",
"translators":["DJj123dj"],
"lastedited":"21/08/2024",
"language":"Custom",
diff --git a/languages/czech.json b/languages/czech.json
index 2aad67b..f71e5c9 100644
--- a/languages/czech.json
+++ b/languages/czech.json
@@ -1,6 +1,6 @@
{
"_TRANSLATION":{
- "otversion":"v4.0.4",
+ "otversion":"v4.0.5",
"translators":["spyeye_"],
"lastedited":"21/08/2024",
"language":"Czech",
diff --git a/languages/danish.json b/languages/danish.json
index 2a113ea..557e8f6 100644
--- a/languages/danish.json
+++ b/languages/danish.json
@@ -1,6 +1,6 @@
{
"_TRANSLATION":{
- "otversion":"v4.0.4",
+ "otversion":"v4.0.5",
"translators":["the_gamer"],
"lastedited":"26/09/2024",
"language":"Danish",
diff --git a/languages/dutch.json b/languages/dutch.json
index 3b4da46..da72052 100644
--- a/languages/dutch.json
+++ b/languages/dutch.json
@@ -1,6 +1,6 @@
{
"_TRANSLATION":{
- "otversion":"v4.0.4",
+ "otversion":"v4.0.5",
"translators":["DJj123dj"],
"lastedited":"21/08/2024",
"language":"Dutch",
diff --git a/languages/english.json b/languages/english.json
index b237db6..afb861e 100644
--- a/languages/english.json
+++ b/languages/english.json
@@ -1,6 +1,6 @@
{
"_TRANSLATION":{
- "otversion":"v4.0.4",
+ "otversion":"v4.0.5",
"translators":["DJj123dj"],
"lastedited":"21/08/2024",
"language":"English",
diff --git a/languages/estonian.json b/languages/estonian.json
index 486015c..7572e45 100644
--- a/languages/estonian.json
+++ b/languages/estonian.json
@@ -1,6 +1,6 @@
{
"_TRANSLATION":{
- "otversion":"v4.0.4",
+ "otversion":"v4.0.5",
"translators":["iamnotmega","ChatGPT"],
"lastedited":"21/10/2024",
"language":"Estonian",
diff --git a/languages/finnish.json b/languages/finnish.json
index 973f08f..94f514d 100644
--- a/languages/finnish.json
+++ b/languages/finnish.json
@@ -1,6 +1,6 @@
{
"_TRANSLATION":{
- "otversion":"v4.0.4",
+ "otversion":"v4.0.5",
"translators":["iamnotmega","ChatGPT"],
"lastedited":"21/10/2024",
"language":"Finnish",
diff --git a/languages/french.json b/languages/french.json
index 664cdb3..1c4452e 100644
--- a/languages/french.json
+++ b/languages/french.json
@@ -1,6 +1,6 @@
{
"_TRANSLATION":{
- "otversion":"v4.0.4",
+ "otversion":"v4.0.5",
"translators":["guillee3"],
"lastedited":"04/12/2024",
"language":"French",
diff --git a/languages/german.json b/languages/german.json
index 5089890..0242724 100644
--- a/languages/german.json
+++ b/languages/german.json
@@ -1,6 +1,6 @@
{
"_TRANSLATION":{
- "otversion":"v4.0.4",
+ "otversion":"v4.0.5",
"translators":["benzorich"],
"lastedited":"06/10/2024",
"language":"German",
diff --git a/languages/hindi.json b/languages/hindi.json
index 7a8656e..f6183d8 100644
--- a/languages/hindi.json
+++ b/languages/hindi.json
@@ -1,6 +1,6 @@
{
"_TRANSLATION":{
- "otversion":"v4.0.4",
+ "otversion":"v4.0.5",
"translators":["an_developer"],
"lastedited":"14/12/2024",
"language":"Hindi",
diff --git a/languages/hungarian.json b/languages/hungarian.json
index 9ce88f8..fd3e653 100644
--- a/languages/hungarian.json
+++ b/languages/hungarian.json
@@ -1,6 +1,6 @@
{
"_TRANSLATION":{
- "otversion":"v4.0.4",
+ "otversion":"v4.0.5",
"translators":["Kornel0706"],
"lastedited":"22/08/2024",
"language":"Hungarian",
diff --git a/languages/indonesian.json b/languages/indonesian.json
index 9e5ac77..938e53b 100644
--- a/languages/indonesian.json
+++ b/languages/indonesian.json
@@ -1,6 +1,6 @@
{
"_TRANSLATION":{
- "otversion":"v4.0.4",
+ "otversion":"v4.0.5",
"translators":["erxg"],
"lastedited":"25/08/2024",
"language":"Indonesian",
diff --git a/languages/italian.json b/languages/italian.json
index 987d3b5..1a82891 100644
--- a/languages/italian.json
+++ b/languages/italian.json
@@ -1,6 +1,6 @@
{
"_TRANSLATION":{
- "otversion":"v4.0.4",
+ "otversion":"v4.0.5",
"translators":["fraden1mvp."],
"lastedited":"08/10/2024",
"language":"Italian",
diff --git a/languages/latvian.json b/languages/latvian.json
index 652c59d..dde15dc 100644
--- a/languages/latvian.json
+++ b/languages/latvian.json
@@ -1,6 +1,6 @@
{
"_TRANSLATION": {
- "otversion": "v4.0.4",
+ "otversion": "v4.0.5",
"translators": ["NoOneNook"],
"lastedited": "25/03/2025",
"language": "Latvian",
diff --git a/languages/lithuanian.json b/languages/lithuanian.json
index dc37513..c6b594d 100644
--- a/languages/lithuanian.json
+++ b/languages/lithuanian.json
@@ -1,6 +1,6 @@
{
"_TRANSLATION":{
- "otversion":"v4.0.4",
+ "otversion":"v4.0.5",
"translators":["TsgIndrius"],
"lastedited":"26/01/2025",
"language":"Lithuanian",
diff --git a/languages/norwegian.json b/languages/norwegian.json
index e9d871c..09817d4 100644
--- a/languages/norwegian.json
+++ b/languages/norwegian.json
@@ -1,6 +1,6 @@
{
"_TRANSLATION": {
- "otversion": "v4.0.4",
+ "otversion": "v4.0.5",
"translators": ["NoOneNook"],
"lastedited": "25/03/2025",
"language": "Norwegian",
diff --git a/languages/polish.json b/languages/polish.json
index 7cc992f..fc28051 100644
--- a/languages/polish.json
+++ b/languages/polish.json
@@ -1,6 +1,6 @@
{
"_TRANSLATION":{
- "otversion":"v4.0.4",
+ "otversion":"v4.0.5",
"translators":["DanoGlez"],
"lastedited":"28/01/2025",
"language":"Polish",
diff --git a/languages/portuguese.json b/languages/portuguese.json
index 4271402..ea8c74e 100644
--- a/languages/portuguese.json
+++ b/languages/portuguese.json
@@ -1,6 +1,6 @@
{
"_TRANSLATION":{
- "otversion":"v4.0.4",
+ "otversion":"v4.0.5",
"translators":["quiradon"],
"lastedited":"20/08/2024",
"language":"Portuguese",
diff --git a/languages/romanian.json b/languages/romanian.json
index 037e5ae..509a8ec 100644
--- a/languages/romanian.json
+++ b/languages/romanian.json
@@ -1,6 +1,6 @@
{
"_TRANSLATION":{
- "otversion":"v4.0.4",
+ "otversion":"v4.0.5",
"translators":["SankeDev"],
"lastedited":"27/08/2024",
"language":"Romanian",
diff --git a/languages/russian.json b/languages/russian.json
index 9f09336..bc8d1c5 100644
--- a/languages/russian.json
+++ b/languages/russian.json
@@ -1,6 +1,6 @@
{
"_TRANSLATION": {
- "otversion": "v4.0.4",
+ "otversion": "v4.0.5",
"translators": ["NoOneNook"],
"lastedited": "25/03/2025",
"language": "Russian",
diff --git a/languages/spanish.json b/languages/spanish.json
index d11a24d..1eaf6cd 100644
--- a/languages/spanish.json
+++ b/languages/spanish.json
@@ -1,6 +1,6 @@
{
"_TRANSLATION":{
- "otversion":"v4.0.4",
+ "otversion":"v4.0.5",
"translators":["Redactado","Josuens"],
"lastedited":"22/08/2024",
"language":"Spanish",
diff --git a/languages/swedish.json b/languages/swedish.json
index eea1585..e71c76c 100644
--- a/languages/swedish.json
+++ b/languages/swedish.json
@@ -1,6 +1,6 @@
{
"_TRANSLATION": {
- "otversion": "v4.0.4",
+ "otversion": "v4.0.5",
"translators": ["NoOneNook"],
"lastedited": "25/03/2025",
"language": "Svenska",
diff --git a/languages/thai.json b/languages/thai.json
index 7d6f332..41ebb65 100644
--- a/languages/thai.json
+++ b/languages/thai.json
@@ -1,6 +1,6 @@
{
"_TRANSLATION":{
- "otversion":"v4.0.4",
+ "otversion":"v4.0.5",
"translators":["modshd"],
"lastedited":"13/11/2024",
"language":"Thai",
diff --git a/languages/turkish.json b/languages/turkish.json
index b985005..dcb7ce7 100644
--- a/languages/turkish.json
+++ b/languages/turkish.json
@@ -1,6 +1,6 @@
{
"_TRANSLATION": {
- "otversion": "v4.0.4",
+ "otversion": "v4.0.5",
"translators": ["palestinian"],
"lastedited": "26/11/2024",
"language": "Turkish",
diff --git a/languages/ukrainian.json b/languages/ukrainian.json
index 293a5a5..02b191b 100644
--- a/languages/ukrainian.json
+++ b/languages/ukrainian.json
@@ -1,6 +1,6 @@
{
"_TRANSLATION":{
- "otversion":"v4.0.4",
+ "otversion":"v4.0.5",
"translators":["Anderskiy"],
"lastedited":"31/08/2024",
"language":"Ukrainian",
diff --git a/languages/vietnamese.json b/languages/vietnamese.json
index f2f2d59..3881160 100644
--- a/languages/vietnamese.json
+++ b/languages/vietnamese.json
@@ -1,6 +1,6 @@
{
"_TRANSLATION":{
- "otversion":"v4.0.4",
+ "otversion":"v4.0.5",
"translators":["ngocdiep2006"],
"lastedited":"07/04/2025",
"language":"Vietnamese",
diff --git a/package.json b/package.json
index edee026..a33ee7f 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
{
"name": "open-ticket",
"author": "DJdj Development",
- "version": "4.0.4",
+ "version": "4.0.5",
"description": "The most advanced open-source discord ticket bot with HTML transcripts, plugins, questions, claiming, pinning & more! Using discord.js v14 & JSON database! ",
"keywords": [
"ticket-bot",
diff --git a/src/actions/createTicket.ts b/src/actions/createTicket.ts
index 6c2cfab..0974e02 100644
--- a/src/actions/createTicket.ts
+++ b/src/actions/createTicket.ts
@@ -20,7 +20,7 @@ export const registerActions = async () => {
const channelCategory = option.get("opendiscord:channel-category").value
const channelBackupCategory = option.get("opendiscord:channel-category-backup").value
const channelDescription = option.get("opendiscord:channel-description").value
- const channelSuffix = opendiscord.options.suffix.getSuffixFromOption(option,user)
+ const channelSuffix = await opendiscord.options.suffix.getSuffixFromOption(option,user)
const channelName = channelPrefix+channelSuffix
//handle category
diff --git a/src/core/api/main.ts b/src/core/api/main.ts
index 2252838..65fbd57 100644
--- a/src/core/api/main.ts
+++ b/src/core/api/main.ts
@@ -130,7 +130,7 @@ export class ODMain {
constructor(){
this.versions = new ODVersionManager_Default()
- this.versions.add(ODVersion.fromString("opendiscord:version","v4.0.4"))
+ this.versions.add(ODVersion.fromString("opendiscord:version","v4.0.5"))
this.versions.add(ODVersion.fromString("opendiscord:api","v1.0.0"))
this.versions.add(ODVersion.fromString("opendiscord:transcripts","v2.0.0"))
this.versions.add(ODVersion.fromString("opendiscord:livestatus","v2.0.0"))
diff --git a/src/core/api/modules/base.ts b/src/core/api/modules/base.ts
index 492d0a3..5c73c59 100644
--- a/src/core/api/modules/base.ts
+++ b/src/core/api/modules/base.ts
@@ -648,8 +648,8 @@ export class ODHTTPGetRequest {
this.throwOnError = throwOnError
const newConfig = config ?? {}
newConfig.method = "GET"
- if (newConfig.headers) Object.assign(newConfig.headers,{"User-Agent":"OpenDiscordBots-OpenTicket/4.0.4"})
- else newConfig.headers = {"User-Agent":"OpenDiscordBots-OpenTicket/4.0.4"}
+ if (newConfig.headers) Object.assign(newConfig.headers,{"User-Agent":"OpenDiscordBots-OpenTicket/4.0.5"})
+ else newConfig.headers = {"User-Agent":"OpenDiscordBots-OpenTicket/4.0.5"}
this.config = newConfig
}
@@ -703,8 +703,8 @@ export class ODHTTPPostRequest {
this.throwOnError = throwOnError
const newConfig = config ?? {}
newConfig.method = "POST"
- if (newConfig.headers) Object.assign(newConfig.headers,{"User-Agent":"OpenDiscordBots-OpenTicket/4.0.4"})
- else newConfig.headers = {"User-Agent":"OpenDiscordBots-OpenTicket/4.0.4"}
+ if (newConfig.headers) Object.assign(newConfig.headers,{"User-Agent":"OpenDiscordBots-OpenTicket/4.0.5"})
+ else newConfig.headers = {"User-Agent":"OpenDiscordBots-OpenTicket/4.0.5"}
this.config = newConfig
}
diff --git a/src/core/api/modules/builder.ts b/src/core/api/modules/builder.ts
index 8ae96d9..b62ce42 100644
--- a/src/core/api/modules/builder.ts
+++ b/src/core/api/modules/builder.ts
@@ -257,7 +257,7 @@ export class ODQuickButton {
/**The id of this button. */
id: ODId
/**The current data of this button */
- data: ODButtonData = {
+ data: Partial = {
customId:"",
mode:"button",
url:null,
@@ -267,7 +267,7 @@ export class ODQuickButton {
disabled:false
}
- constructor(id:ODValidId,data:ODButtonData){
+ constructor(id:ODValidId,data:Partial){
this.id = new ODId(id)
this.data = data
}
@@ -277,7 +277,7 @@ export class ODQuickButton {
try {
//create the discord.js button
const button = new discord.ButtonBuilder()
- if (this.data.mode == "button") button.setCustomId(this.data.customId)
+ if (this.data.mode == "button") button.setCustomId(this.data.customId ?? "od:unknown-button")
if (this.data.mode == "url") button.setStyle(discord.ButtonStyle.Link)
else if (this.data.color == "gray") button.setStyle(discord.ButtonStyle.Secondary)
else if (this.data.color == "blue") button.setStyle(discord.ButtonStyle.Primary)
@@ -287,7 +287,7 @@ export class ODQuickButton {
if (this.data.label) button.setLabel(this.data.label)
if (this.data.emoji) button.setEmoji(this.data.emoji)
if (this.data.disabled) button.setDisabled(this.data.disabled)
- if (!this.data.emoji && !this.data.label) button.setLabel(this.data.customId)
+ if (!this.data.emoji && !this.data.label) button.setLabel(this.data.customId ?? "od:unknown-button")
return {id:this.id,component:button}
}catch(err){
@@ -564,7 +564,7 @@ export class ODQuickDropdown {
/**The id of this dropdown. */
id: ODId
/**The current data of this dropdown */
- data: ODDropdownData = {
+ data: Partial = {
customId:"",
type:"string",
placeholder:null,
@@ -580,7 +580,7 @@ export class ODQuickDropdown {
mentionables:[]
}
- constructor(id:ODValidId,data:ODDropdownData){
+ constructor(id:ODValidId,data:Partial){
this.id = new ODId(id)
this.data = data
}
@@ -590,8 +590,9 @@ export class ODQuickDropdown {
try{
//create the discord.js dropdown
if (this.data.type == "string"){
+ if (!this.data.options) throw new ODSystemError("ODQuickDropdown:build(): "+this.id.value+" => Dropdown requires at least 1 option to be present.")
const dropdown = new discord.StringSelectMenuBuilder()
- dropdown.setCustomId(this.data.customId)
+ dropdown.setCustomId(this.data.customId ?? "od:unknown-dropdown")
dropdown.setOptions(...this.data.options)
if (this.data.placeholder) dropdown.setPlaceholder(this.data.placeholder)
if (this.data.minValues) dropdown.setMinValues(this.data.minValues)
@@ -601,8 +602,9 @@ export class ODQuickDropdown {
return {id:this.id,component:dropdown}
}else if (this.data.type == "user"){
+ if (!this.data.users) throw new ODSystemError("ODQuickDropdown:build(): "+this.id.value+" => Dropdown requires at least 1 user option to be present.")
const dropdown = new discord.UserSelectMenuBuilder()
- dropdown.setCustomId(this.data.customId)
+ dropdown.setCustomId(this.data.customId ?? "od:unknown-dropdown")
if (this.data.users.length > 0) dropdown.setDefaultUsers(...this.data.users.map((u) => u.id))
if (this.data.placeholder) dropdown.setPlaceholder(this.data.placeholder)
if (this.data.minValues) dropdown.setMinValues(this.data.minValues)
@@ -612,8 +614,9 @@ export class ODQuickDropdown {
return {id:this.id,component:dropdown}
}else if (this.data.type == "role"){
+ if (!this.data.roles) throw new ODSystemError("ODQuickDropdown:build(): "+this.id.value+" => Dropdown requires at least 1 role option to be present.")
const dropdown = new discord.RoleSelectMenuBuilder()
- dropdown.setCustomId(this.data.customId)
+ dropdown.setCustomId(this.data.customId ?? "od:unknown-dropdown")
if (this.data.roles.length > 0) dropdown.setDefaultRoles(...this.data.roles.map((r) => r.id))
if (this.data.placeholder) dropdown.setPlaceholder(this.data.placeholder)
if (this.data.minValues) dropdown.setMinValues(this.data.minValues)
@@ -623,8 +626,9 @@ export class ODQuickDropdown {
return {id:this.id,component:dropdown}
}else if (this.data.type == "channel"){
+ if (!this.data.channels) throw new ODSystemError("ODQuickDropdown:build(): "+this.id.value+" => Dropdown requires at least 1 channel option to be present.")
const dropdown = new discord.ChannelSelectMenuBuilder()
- dropdown.setCustomId(this.data.customId)
+ dropdown.setCustomId(this.data.customId ?? "od:unknown-dropdown")
if (this.data.channels.length > 0) dropdown.setDefaultChannels(...this.data.channels.map((c) => c.id))
if (this.data.placeholder) dropdown.setPlaceholder(this.data.placeholder)
if (this.data.minValues) dropdown.setMinValues(this.data.minValues)
@@ -634,6 +638,7 @@ export class ODQuickDropdown {
return {id:this.id,component:dropdown}
}else if (this.data.type == "mentionable"){
+ if (!this.data.mentionables) throw new ODSystemError("ODQuickDropdown:build(): "+this.id.value+" => Dropdown requires at least 1 mentionable option to be present.")
const dropdown = new discord.MentionableSelectMenuBuilder()
const values: ({type:discord.SelectMenuDefaultValueType.User,id:string}|{type:discord.SelectMenuDefaultValueType.Role,id:string})[] = []
@@ -645,7 +650,7 @@ export class ODQuickDropdown {
}
})
- dropdown.setCustomId(this.data.customId)
+ dropdown.setCustomId(this.data.customId ?? "od:unknown-dropdown")
if (this.data.mentionables.length > 0) dropdown.setDefaultValues(...values)
if (this.data.placeholder) dropdown.setPlaceholder(this.data.placeholder)
if (this.data.minValues) dropdown.setMinValues(this.data.minValues)
@@ -799,14 +804,14 @@ export class ODQuickFile {
/**The id of this file. */
id: ODId
/**The current data of this file */
- data: ODFileData = {
+ data: Partial = {
file:"",
name:"file.txt",
description:null,
spoiler:false
}
- constructor(id:ODValidId,data:ODFileData){
+ constructor(id:ODValidId,data:Partial){
this.id = new ODId(id)
this.data = data
}
@@ -815,7 +820,7 @@ export class ODQuickFile {
async build(): Promise {
try{
//create the discord.js attachment
- const file = new discord.AttachmentBuilder(this.data.file)
+ const file = new discord.AttachmentBuilder(this.data.file ?? "")
file.setName(this.data.name ? this.data.name : "file.txt")
if (this.data.description) file.setDescription(this.data.description)
if (this.data.spoiler) file.setSpoiler(this.data.spoiler)
@@ -1055,7 +1060,7 @@ export class ODQuickEmbed {
/**The id of this embed. */
id: ODId
/**The current data of this embed */
- data: ODEmbedData = {
+ data: Partial = {
title:null,
color:null,
url:null,
@@ -1071,7 +1076,7 @@ export class ODQuickEmbed {
timestamp:null
}
- constructor(id:ODValidId,data:ODEmbedData){
+ constructor(id:ODValidId,data:Partial){
this.id = new ODId(id)
this.data = data
}
@@ -1097,7 +1102,7 @@ export class ODQuickEmbed {
if (this.data.image) embed.setImage(this.data.image)
if (this.data.thumbnail) embed.setThumbnail(this.data.thumbnail)
if (this.data.timestamp) embed.setTimestamp(this.data.timestamp)
- if (this.data.fields.length > 0) embed.setFields(this.data.fields)
+ if (this.data.fields && this.data.fields.length > 0) embed.setFields(this.data.fields)
return {id:this.id,embed}
}catch(err){
diff --git a/src/core/api/openticket/option.ts b/src/core/api/openticket/option.ts
index d71268d..75e741a 100644
--- a/src/core/api/openticket/option.ts
+++ b/src/core/api/openticket/option.ts
@@ -350,10 +350,10 @@ export class ODOptionSuffixManager extends ODManager {
}
/**Instantly get the suffix from an `ODTicketOption`. */
- getSuffixFromOption(option:ODTicketOption,user:discord.User): string|null {
+ async getSuffixFromOption(option:ODTicketOption,user:discord.User): Promise {
const suffix = this.getAll().find((suffix) => suffix.option.id.value == option.id.value)
if (!suffix) return null
- return suffix.getSuffix(user)
+ return await suffix.getSuffix(user)
}
}
@@ -374,7 +374,7 @@ export class ODOptionSuffix extends ODManagerData {
}
/**Get the suffix for a new ticket. */
- getSuffix(user:discord.User): string {
+ async getSuffix(user:discord.User): Promise {
throw new ODSystemError("Tried to use an unimplemented ODOptionSuffix!")
}
}
@@ -387,7 +387,7 @@ export class ODOptionSuffix extends ODManagerData {
* Use `getSuffix()` to get the new suffix!
*/
export class ODOptionUserNameSuffix extends ODOptionSuffix {
- getSuffix(user:discord.User): string {
+ async getSuffix(user:discord.User): Promise {
return user.username
}
}
@@ -400,7 +400,7 @@ export class ODOptionUserNameSuffix extends ODOptionSuffix {
* Use `getSuffix()` to get the new suffix!
*/
export class ODOptionUserIdSuffix extends ODOptionSuffix {
- getSuffix(user:discord.User): string {
+ async getSuffix(user:discord.User): Promise {
return user.id
}
}
@@ -426,11 +426,11 @@ export class ODOptionCounterDynamicSuffix extends ODOptionSuffix {
async #init(){
if (!await this.database.exists("opendiscord:option-suffix-counter",this.option.id.value)) await this.database.set("opendiscord:option-suffix-counter",this.option.id.value,0)
}
- getSuffix(user:discord.User): string {
- const rawCurrentValue = this.database.get("opendiscord:option-suffix-counter",this.option.id.value)
+ async getSuffix(user:discord.User): Promise {
+ const rawCurrentValue = await this.database.get("opendiscord:option-suffix-counter",this.option.id.value)
const currentValue = (typeof rawCurrentValue != "number") ? 0 : rawCurrentValue
const newValue = currentValue+1
- this.database.set("opendiscord:option-suffix-counter",this.option.id.value,newValue)
+ await this.database.set("opendiscord:option-suffix-counter",this.option.id.value,newValue)
return newValue.toString()
}
}
@@ -456,12 +456,12 @@ export class ODOptionCounterFixedSuffix extends ODOptionSuffix {
async #init(){
if (!await this.database.exists("opendiscord:option-suffix-counter",this.option.id.value)) await this.database.set("opendiscord:option-suffix-counter",this.option.id.value,0)
}
- getSuffix(user:discord.User): string {
- const rawCurrentValue = this.database.get("opendiscord:option-suffix-counter",this.option.id.value)
+ async getSuffix(user:discord.User): Promise {
+ const rawCurrentValue = await this.database.get("opendiscord:option-suffix-counter",this.option.id.value)
const currentValue = (typeof rawCurrentValue != "number") ? 0 : rawCurrentValue
const newValue = (currentValue >= 9999) ? 0 : currentValue+1
- this.database.set("opendiscord:option-suffix-counter",this.option.id.value,newValue)
+ await this.database.set("opendiscord:option-suffix-counter",this.option.id.value,newValue)
if (newValue.toString().length == 1) return "000"+newValue.toString()
else if (newValue.toString().length == 2) return "00"+newValue.toString()
else if (newValue.toString().length == 3) return "0"+newValue.toString()
@@ -501,13 +501,13 @@ export class ODOptionRandomNumberSuffix extends ODOptionSuffix {
if (history.includes(number)) return this.#generateUniqueValue(history)
else return number
}
- getSuffix(user:discord.User): string {
- const rawCurrentValues = this.database.get("opendiscord:option-suffix-history",this.option.id.value)
+ async getSuffix(user:discord.User): Promise {
+ const rawCurrentValues = await this.database.get("opendiscord:option-suffix-history",this.option.id.value)
const currentValues = ((Array.isArray(rawCurrentValues)) ? rawCurrentValues : []) as string[]
const newValue = this.#generateUniqueValue(currentValues)
currentValues.push(newValue)
if (currentValues.length > 50) currentValues.shift()
- this.database.set("opendiscord:option-suffix-history",this.option.id.value,currentValues)
+ await this.database.set("opendiscord:option-suffix-history",this.option.id.value,currentValues)
return newValue
}
}
@@ -539,13 +539,13 @@ export class ODOptionRandomHexSuffix extends ODOptionSuffix {
if (history.includes(hex)) return this.#generateUniqueValue(history)
else return hex
}
- getSuffix(user:discord.User): string {
- const rawCurrentValues = this.database.get("opendiscord:option-suffix-history",this.option.id.value)
+ async getSuffix(user:discord.User): Promise {
+ const rawCurrentValues = await this.database.get("opendiscord:option-suffix-history",this.option.id.value)
const currentValues = ((Array.isArray(rawCurrentValues)) ? rawCurrentValues : []) as string[]
const newValue = this.#generateUniqueValue(currentValues)
currentValues.push(newValue)
if (currentValues.length > 50) currentValues.shift()
- this.database.set("opendiscord:option-suffix-history",this.option.id.value,currentValues)
+ await this.database.set("opendiscord:option-suffix-history",this.option.id.value,currentValues)
return newValue
}
}
\ No newline at end of file
diff --git a/src/core/startup/migration.ts b/src/core/startup/migration.ts
index d7a1720..65a8852 100644
--- a/src/core/startup/migration.ts
+++ b/src/core/startup/migration.ts
@@ -22,5 +22,8 @@ export const migrations = [
new utilities.ODVersionMigration(api.ODVersion.fromString("opendiscord:version","v4.0.3"),async () => {},async () => {}),
//MIGRATE TO v4.0.4
- new utilities.ODVersionMigration(api.ODVersion.fromString("opendiscord:version","v4.0.4"),async () => {},async () => {})
+ new utilities.ODVersionMigration(api.ODVersion.fromString("opendiscord:version","v4.0.4"),async () => {},async () => {}),
+
+ //MIGRATE TO v4.0.5
+ new utilities.ODVersionMigration(api.ODVersion.fromString("opendiscord:version","v4.0.5"),async () => {},async () => {})
]
\ No newline at end of file
diff --git a/src/data/framework/checkerLoader.ts b/src/data/framework/checkerLoader.ts
index 4a8024c..a63b2cd 100644
--- a/src/data/framework/checkerLoader.ts
+++ b/src/data/framework/checkerLoader.ts
@@ -441,7 +441,7 @@ export const defaultPanelsStructure = new api.ODCheckerArrayStructure("opendisco
{key:"id",optional:false,priority:0,checker:new api.ODCheckerCustomStructure_UniqueId("opendiscord:panel-id","openticket","panel-ids",{regex:/^[A-Za-z0-9-รฉรจรงร รชรขรดรปรฎ]+$/,minLength:3,maxLength:40})},
{key:"name",optional:false,priority:0,checker:new api.ODCheckerStringStructure("opendiscord:panel-name",{minLength:3,maxLength:50})},
{key:"dropdown",optional:false,priority:0,checker:new api.ODCheckerBooleanStructure("opendiscord:panel-dropdown",{})},
- {key:"options",optional:false,priority:0,checker:new api.ODCheckerCustomStructure_UniqueIdArray("opendiscord:panel-options","openticket","option-ids","option-ids-used",{allowDoubles:false,maxLength:25})},
+ {key:"options",optional:false,priority:0,checker:new api.ODCheckerCustomStructure_UniqueIdArray("opendiscord:panel-options","openticket","option-ids","option-ids-used",{allowDoubles:false,minLength:1,maxLength:25})},
//EMBED & TEXT
{key:"text",optional:false,priority:0,checker:new api.ODCheckerStringStructure("opendiscord:panel-text",{maxLength:4096})},
diff --git a/src/index.ts b/src/index.ts
index b0bd9d6..3aca6c5 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -20,7 +20,7 @@
INFORMATION:
============
- Open Ticket v4.0.4 - ยฉ DJdj Development
+ Open Ticket v4.0.5 - ยฉ DJdj Development
support us: https://github.com/sponsors/DJj123dj
discord: https://discord.dj-dj.be