diff --git a/.eggs/README.md b/.eggs/README.md
index be20612..7d1eba7 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.3)
+[](https://github.com/open-discord-bots/open-ticket/releases/tag/v4.0.4)
[](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.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.
+
[**`openticket-egg-v4.0.3.json`**](openticket-egg-v4.0.3.json)
- This egg will always use Open Ticket `v4.0.3`. Open Ticket updates will not have an effect on this egg.
diff --git a/.eggs/openticket-egg-v4.0.4.json b/.eggs/openticket-egg-v4.0.4.json
new file mode 100644
index 0000000..f9e3edf
--- /dev/null
+++ b/.eggs/openticket-egg-v4.0.4.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.4)",
+ "author": "support@dj-dj.be",
+ "description": "This is the official Pterodactyl egg for Open Ticket v4.0.4, 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.4)\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.4\"\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 cece475..368e26e 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.3) [](https://github.com/sponsors/DJj123dj)
+[](https://discord.com/invite/26vT9wt3n3) [](https://github.com/open-discord-bots/open-ticket/releases/tag/v4.0.4) [](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 799664c..a40952d 100644
--- a/.github/SECURITY.md
+++ b/.github/SECURITY.md
@@ -1,7 +1,7 @@
# Security Policy
-[](https://discord.com/invite/26vT9wt3n3) [](https://github.com/open-discord-bots/open-ticket/releases/tag/v4.0.3) [](https://github.com/sponsors/DJj123dj)
+[](https://discord.com/invite/26vT9wt3n3) [](https://github.com/open-discord-bots/open-ticket/releases/tag/v4.0.4) [](https://github.com/sponsors/DJj123dj)
This is the Security Policy of Open Ticket!
Here you can find a list of all supported & deprecated versions of the bot.
@@ -17,16 +17,16 @@ This list will be updated on every release.
- 🟧 Deprecated **(docs)**
- ❌ Fully Deprecated
-| Version | Supported | Notes |
-|------------|-----------|--------------------------------|
-| 4.1.0 | 🟦 | |
-| 4.0.3 | ✅ | |
-| 4.0.2 | ✅ | Major discord.js bug |
-| 4.0.1 | ✅ | |
-| 4.0.0 | 🚧 | Supported until May 2025 |
-| 3.5.9 | 🚧 | Supported until May 2025 (LTS) |
-| 3.5.8 | 🟧 | Documentation Only |
-| < 3.5.8 | ❌ | |
+| Version | Supported | Notes |
+|------------|-----------|------------------------------------------|
+| 4.1.0 | 🟦 | |
+| 4.0.4 | ✅ | |
+| 4.0.3 | ✅ | Transcripts v2.0 (Offline August 2025) |
+| 4.0.2 | 🚧 | Major discord.js bug |
+| 4.0.1 | 🚧 | |
+| 4.0.0 | 🚧 | Supported until June 2025 (LTS) |
+| 3.5.9 | 🟧 | Documentation Only |
+| < 3.5.9 | ❌ | |
### 🕷️ Reporting Vulnerabilities
You can report vulnerabilities, errors & bugs using one of the following methods:
diff --git a/README.md b/README.md
index c8d7009..8e6e2ac 100644
--- a/README.md
+++ b/README.md
@@ -8,7 +8,7 @@
Powered By

-
+
@@ -59,8 +59,8 @@ The bot is translated in more than 27 Languages and has been battle
> ### 📦 Resources
> Not all resources are accurate yet! We are working on this.
->
->
+>
+>
>
### ❤️ Sponsors
diff --git a/config/general.json b/config/general.json
index 177aa15..03132b8 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.3"
+ "version":"open-ticket-v4.0.4"
},
"token":"your bot token here! (or leave empty when using 'tokenFromENV')",
diff --git a/config/panels.json b/config/panels.json
index 8a1093e..07cc86e 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.3 (or leave empty)",
+ "footer":"Open Ticket v4.0.4 (or leave empty)",
"fields":[
{"name":"field name","value":"field value","inline":false}
],
diff --git a/config/transcripts.json b/config/transcripts.json
index 15b111c..37651ae 100644
--- a/config/transcripts.json
+++ b/config/transcripts.json
@@ -49,7 +49,7 @@
},
"favicon":{
"enableCustomFavicon":false,
- "imageUrl":"https://transcripts.dj-dj.be/favicon.png"
+ "imageUrl":"https://t.dj-dj.be/favicon.png"
}
}
}
\ No newline at end of file
diff --git a/index.js b/index.js
index 85f8db8..4c0d6ed 100644
--- a/index.js
+++ b/index.js
@@ -14,7 +14,7 @@ process.argv.push(...flags)
██║ ██║██╔═══╝ ██╔══╝ ██║╚██╗██║ ██║ ██║██║ ██╔═██╗ ██╔══╝ ██║
╚██████╔╝██║ ███████╗██║ ╚████║ ██║ ██║╚██████╗██║ ██╗███████╗ ██║
╚═════╝ ╚═╝ ╚══════╝╚═╝ ╚═══╝ ╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝╚══════╝ ╚═╝
- v4.0.3 - Made by DJj123dj & Contributors
+ v4.0.4 - 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 3329551..7b85661 100644
--- a/languages/arabic.json
+++ b/languages/arabic.json
@@ -1,6 +1,6 @@
{
"_TRANSLATION": {
- "otversion": "v4.0.3",
+ "otversion": "v4.0.4",
"translators": ["palestinian"],
"lastedited": "06/12/2024",
"language": "Arabic",
diff --git a/languages/catalan.json b/languages/catalan.json
index ca680c0..f7c4c58 100644
--- a/languages/catalan.json
+++ b/languages/catalan.json
@@ -1,6 +1,6 @@
{
"_TRANSLATION":{
- "otversion":"v4.0.3",
+ "otversion":"v4.0.4",
"translators":["guillee3"],
"lastedited":"21/08/2024",
"language":"Catalan",
diff --git a/languages/custom.json b/languages/custom.json
index a144e18..65f7ab4 100644
--- a/languages/custom.json
+++ b/languages/custom.json
@@ -1,6 +1,6 @@
{
"_TRANSLATION":{
- "otversion":"v4.0.3",
+ "otversion":"v4.0.4",
"translators":["DJj123dj"],
"lastedited":"21/08/2024",
"language":"Custom",
diff --git a/languages/czech.json b/languages/czech.json
index 4626527..2aad67b 100644
--- a/languages/czech.json
+++ b/languages/czech.json
@@ -1,6 +1,6 @@
{
"_TRANSLATION":{
- "otversion":"v4.0.3",
+ "otversion":"v4.0.4",
"translators":["spyeye_"],
"lastedited":"21/08/2024",
"language":"Czech",
diff --git a/languages/danish.json b/languages/danish.json
index f71795c..2a113ea 100644
--- a/languages/danish.json
+++ b/languages/danish.json
@@ -1,6 +1,6 @@
{
"_TRANSLATION":{
- "otversion":"v4.0.3",
+ "otversion":"v4.0.4",
"translators":["the_gamer"],
"lastedited":"26/09/2024",
"language":"Danish",
diff --git a/languages/dutch.json b/languages/dutch.json
index 7f7eeae..27a73e9 100644
--- a/languages/dutch.json
+++ b/languages/dutch.json
@@ -1,6 +1,6 @@
{
"_TRANSLATION":{
- "otversion":"v4.0.3",
+ "otversion":"v4.0.4",
"translators":["DJj123dj"],
"lastedited":"21/08/2024",
"language":"Dutch",
diff --git a/languages/english.json b/languages/english.json
index b762448..b237db6 100644
--- a/languages/english.json
+++ b/languages/english.json
@@ -1,6 +1,6 @@
{
"_TRANSLATION":{
- "otversion":"v4.0.3",
+ "otversion":"v4.0.4",
"translators":["DJj123dj"],
"lastedited":"21/08/2024",
"language":"English",
diff --git a/languages/estonian.json b/languages/estonian.json
index 49eb6e3..486015c 100644
--- a/languages/estonian.json
+++ b/languages/estonian.json
@@ -1,6 +1,6 @@
{
"_TRANSLATION":{
- "otversion":"v4.0.3",
+ "otversion":"v4.0.4",
"translators":["iamnotmega","ChatGPT"],
"lastedited":"21/10/2024",
"language":"Estonian",
diff --git a/languages/finnish.json b/languages/finnish.json
index 6ecbf84..973f08f 100644
--- a/languages/finnish.json
+++ b/languages/finnish.json
@@ -1,6 +1,6 @@
{
"_TRANSLATION":{
- "otversion":"v4.0.3",
+ "otversion":"v4.0.4",
"translators":["iamnotmega","ChatGPT"],
"lastedited":"21/10/2024",
"language":"Finnish",
diff --git a/languages/french.json b/languages/french.json
index c5998ab..664cdb3 100644
--- a/languages/french.json
+++ b/languages/french.json
@@ -1,6 +1,6 @@
{
"_TRANSLATION":{
- "otversion":"v4.0.3",
+ "otversion":"v4.0.4",
"translators":["guillee3"],
"lastedited":"04/12/2024",
"language":"French",
diff --git a/languages/german.json b/languages/german.json
index c63cdb9..5089890 100644
--- a/languages/german.json
+++ b/languages/german.json
@@ -1,6 +1,6 @@
{
"_TRANSLATION":{
- "otversion":"v4.0.3",
+ "otversion":"v4.0.4",
"translators":["benzorich"],
"lastedited":"06/10/2024",
"language":"German",
diff --git a/languages/hindi.json b/languages/hindi.json
index 1312f62..7a8656e 100644
--- a/languages/hindi.json
+++ b/languages/hindi.json
@@ -1,6 +1,6 @@
{
"_TRANSLATION":{
- "otversion":"v4.0.3",
+ "otversion":"v4.0.4",
"translators":["an_developer"],
"lastedited":"14/12/2024",
"language":"Hindi",
diff --git a/languages/hungarian.json b/languages/hungarian.json
index e765d86..9ce88f8 100644
--- a/languages/hungarian.json
+++ b/languages/hungarian.json
@@ -1,6 +1,6 @@
{
"_TRANSLATION":{
- "otversion":"v4.0.3",
+ "otversion":"v4.0.4",
"translators":["Kornel0706"],
"lastedited":"22/08/2024",
"language":"Hungarian",
diff --git a/languages/indonesian.json b/languages/indonesian.json
index 8ae3703..9e5ac77 100644
--- a/languages/indonesian.json
+++ b/languages/indonesian.json
@@ -1,6 +1,6 @@
{
"_TRANSLATION":{
- "otversion":"v4.0.3",
+ "otversion":"v4.0.4",
"translators":["erxg"],
"lastedited":"25/08/2024",
"language":"Indonesian",
diff --git a/languages/italian.json b/languages/italian.json
index 4a39112..987d3b5 100644
--- a/languages/italian.json
+++ b/languages/italian.json
@@ -1,6 +1,6 @@
{
"_TRANSLATION":{
- "otversion":"v4.0.3",
+ "otversion":"v4.0.4",
"translators":["fraden1mvp."],
"lastedited":"08/10/2024",
"language":"Italian",
diff --git a/languages/latvian.json b/languages/latvian.json
index f30a92e..652c59d 100644
--- a/languages/latvian.json
+++ b/languages/latvian.json
@@ -1,6 +1,6 @@
{
"_TRANSLATION": {
- "otversion": "v4.0.3",
+ "otversion": "v4.0.4",
"translators": ["NoOneNook"],
"lastedited": "25/03/2025",
"language": "Latvian",
diff --git a/languages/lithuanian.json b/languages/lithuanian.json
index b1e8971..dc37513 100644
--- a/languages/lithuanian.json
+++ b/languages/lithuanian.json
@@ -1,6 +1,6 @@
{
"_TRANSLATION":{
- "otversion":"v4.0.3",
+ "otversion":"v4.0.4",
"translators":["TsgIndrius"],
"lastedited":"26/01/2025",
"language":"Lithuanian",
diff --git a/languages/norwegian.json b/languages/norwegian.json
index f6da1f1..e9d871c 100644
--- a/languages/norwegian.json
+++ b/languages/norwegian.json
@@ -1,6 +1,6 @@
{
"_TRANSLATION": {
- "otversion": "v4.0.3",
+ "otversion": "v4.0.4",
"translators": ["NoOneNook"],
"lastedited": "25/03/2025",
"language": "Norwegian",
diff --git a/languages/polish.json b/languages/polish.json
index 4864649..7cc992f 100644
--- a/languages/polish.json
+++ b/languages/polish.json
@@ -1,6 +1,6 @@
{
"_TRANSLATION":{
- "otversion":"v4.0.3",
+ "otversion":"v4.0.4",
"translators":["DanoGlez"],
"lastedited":"28/01/2025",
"language":"Polish",
diff --git a/languages/portuguese.json b/languages/portuguese.json
index 6dc7a77..4271402 100644
--- a/languages/portuguese.json
+++ b/languages/portuguese.json
@@ -1,6 +1,6 @@
{
"_TRANSLATION":{
- "otversion":"v4.0.3",
+ "otversion":"v4.0.4",
"translators":["quiradon"],
"lastedited":"20/08/2024",
"language":"Portuguese",
diff --git a/languages/romanian.json b/languages/romanian.json
index 0181447..037e5ae 100644
--- a/languages/romanian.json
+++ b/languages/romanian.json
@@ -1,6 +1,6 @@
{
"_TRANSLATION":{
- "otversion":"v4.0.3",
+ "otversion":"v4.0.4",
"translators":["SankeDev"],
"lastedited":"27/08/2024",
"language":"Romanian",
diff --git a/languages/russian.json b/languages/russian.json
index 1a43cee..9f09336 100644
--- a/languages/russian.json
+++ b/languages/russian.json
@@ -1,6 +1,6 @@
{
"_TRANSLATION": {
- "otversion": "v4.0.3",
+ "otversion": "v4.0.4",
"translators": ["NoOneNook"],
"lastedited": "25/03/2025",
"language": "Russian",
diff --git a/languages/spanish.json b/languages/spanish.json
index 3f27592..d11a24d 100644
--- a/languages/spanish.json
+++ b/languages/spanish.json
@@ -1,6 +1,6 @@
{
"_TRANSLATION":{
- "otversion":"v4.0.3",
+ "otversion":"v4.0.4",
"translators":["Redactado","Josuens"],
"lastedited":"22/08/2024",
"language":"Spanish",
diff --git a/languages/swedish.json b/languages/swedish.json
index ea79370..eea1585 100644
--- a/languages/swedish.json
+++ b/languages/swedish.json
@@ -1,6 +1,6 @@
{
"_TRANSLATION": {
- "otversion": "v4.0.3",
+ "otversion": "v4.0.4",
"translators": ["NoOneNook"],
"lastedited": "25/03/2025",
"language": "Svenska",
diff --git a/languages/thai.json b/languages/thai.json
index a6ec3c9..7d6f332 100644
--- a/languages/thai.json
+++ b/languages/thai.json
@@ -1,6 +1,6 @@
{
"_TRANSLATION":{
- "otversion":"v4.0.3",
+ "otversion":"v4.0.4",
"translators":["modshd"],
"lastedited":"13/11/2024",
"language":"Thai",
diff --git a/languages/turkish.json b/languages/turkish.json
index de2ba80..b985005 100644
--- a/languages/turkish.json
+++ b/languages/turkish.json
@@ -1,6 +1,6 @@
{
"_TRANSLATION": {
- "otversion": "v4.0.3",
+ "otversion": "v4.0.4",
"translators": ["palestinian"],
"lastedited": "26/11/2024",
"language": "Turkish",
diff --git a/languages/ukrainian.json b/languages/ukrainian.json
index e9f88cb..293a5a5 100644
--- a/languages/ukrainian.json
+++ b/languages/ukrainian.json
@@ -1,6 +1,6 @@
{
"_TRANSLATION":{
- "otversion":"v4.0.3",
+ "otversion":"v4.0.4",
"translators":["Anderskiy"],
"lastedited":"31/08/2024",
"language":"Ukrainian",
diff --git a/languages/vietnamese.json b/languages/vietnamese.json
index d64339c..f2f2d59 100644
--- a/languages/vietnamese.json
+++ b/languages/vietnamese.json
@@ -1,6 +1,6 @@
{
"_TRANSLATION":{
- "otversion":"v4.0.3",
+ "otversion":"v4.0.4",
"translators":["ngocdiep2006"],
"lastedited":"07/04/2025",
"language":"Vietnamese",
diff --git a/package.json b/package.json
index 30b99c6..7e7cbae 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
{
"name": "open-ticket",
"author": "DJdj Development",
- "version": "4.0.3",
+ "version": "4.0.4",
"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/createTranscript.ts b/src/actions/createTranscript.ts
index 07894b8..825a142 100644
--- a/src/actions/createTranscript.ts
+++ b/src/actions/createTranscript.ts
@@ -38,7 +38,9 @@ export const registerActions = async () => {
await opendiscord.events.get("onTranscriptInit").emit([opendiscord.transcripts,ticket,channel,user])
if (instance.compiler.init){
try{
+ instance.initData = null
const result = await instance.compiler.init(ticket,channel,user)
+ instance.initData = result.initData
if (result.success && result.pendingMessage && transcriptConfig.data.general.enableChannel){
//send init message to channel
const post = opendiscord.posts.get("opendiscord:transcripts")
@@ -49,7 +51,9 @@ export const registerActions = async () => {
instance.pendingMessage = null
instance.errorReason = result.errorReason
throw new api.ODSystemError("ODAction(ot:create-transcript) => Known Init Error => "+result.errorReason)
- }else instance.pendingMessage = null
+ }else{
+ instance.pendingMessage = null
+ }
}catch(err){
instance.success = false
cancel()
@@ -72,7 +76,7 @@ export const registerActions = async () => {
await opendiscord.events.get("onTranscriptCompile").emit([opendiscord.transcripts,ticket,channel,user])
if (instance.compiler.compile){
try{
- const result = await instance.compiler.compile(ticket,channel,user)
+ const result = await instance.compiler.compile(ticket,channel,user,instance.initData)
if (!result.success){
instance.errorReason = result.errorReason
throw new api.ODSystemError("ODAction(ot:create-transcript) => Known Compiler Error => "+result.errorReason)
diff --git a/src/core/api/defaults/action.ts b/src/core/api/defaults/action.ts
index 842ec62..f3ef684 100644
--- a/src/core/api/defaults/action.ts
+++ b/src/core/api/defaults/action.ts
@@ -25,7 +25,7 @@ export interface ODActionManagerIds_Default {
"opendiscord:create-transcript":{
source:"slash"|"text"|"ticket-message"|"reopen-message"|"close-message"|"autoclose-message"|"autodelete"|"clear"|"other",
params:{guild:discord.Guild,channel:discord.GuildTextBasedChannel,user:discord.User,ticket:ODTicket},
- result:{compiler:ODTranscriptCompiler, success:boolean, result:ODTranscriptCompilerCompileResult, errorReason:string|null, pendingMessage:ODMessageBuildSentResult|null, participants:{user:discord.User,role:"creator"|"participant"|"admin"}[]},
+ result:{compiler:ODTranscriptCompiler, success:boolean, result:ODTranscriptCompilerCompileResult, errorReason:string|null, pendingMessage:ODMessageBuildSentResult|null, initData:object|null, participants:{user:discord.User,role:"creator"|"participant"|"admin"}[]},
workers:"opendiscord:select-compiler"|"opendiscord:init-transcript"|"opendiscord:compile-transcript"|"opendiscord:ready-transcript"|"opendiscord:logs"
},
"opendiscord:create-ticket":{
diff --git a/src/core/api/defaults/builder.ts b/src/core/api/defaults/builder.ts
index 97cb2ec..6d556c3 100644
--- a/src/core/api/defaults/builder.ts
+++ b/src/core/api/defaults/builder.ts
@@ -58,9 +58,9 @@ export interface ODButtonManagerIds_Default {
"opendiscord:pin-ticket":{source:"ticket-message"|"unpin-message"|"other",params:{guild:discord.Guild,channel:discord.TextBasedChannel,user:discord.User,ticket:ODTicket},workers:"opendiscord:pin-ticket"},
"opendiscord:unpin-ticket":{source:"ticket-message"|"pin-message"|"other",params:{guild:discord.Guild,channel:discord.TextBasedChannel,user:discord.User,ticket:ODTicket},workers:"opendiscord:unpin-ticket"},
- "opendiscord:transcript-html-visit":{source:"channel"|"creator-dm"|"participant-dm"|"active-admin-dm"|"every-admin-dm"|"other",params:{guild:discord.Guild,channel:discord.GuildTextBasedChannel,user:discord.User,ticket:ODTicket,compiler:ODTranscriptCompiler<{url:string}>,result:ODTranscriptCompilerCompileResult<{url:string}>},workers:"opendiscord:transcript-html-visit"},
- "opendiscord:transcript-error-retry":{source:"slash"|"text"|"ticket-message"|"reopen-message"|"close-message"|"autoclose-message"|"autodelete"|"clear"|"other",params:{guild:discord.Guild,channel:discord.GuildTextBasedChannel,user:discord.User,ticket:ODTicket,compiler:ODTranscriptCompiler,reason:string|null},workers:"opendiscord:transcript-error-retry"},
- "opendiscord:transcript-error-continue":{source:"slash"|"text"|"ticket-message"|"reopen-message"|"close-message"|"autoclose-message"|"autodelete"|"clear"|"other",params:{guild:discord.Guild,channel:discord.GuildTextBasedChannel,user:discord.User,ticket:ODTicket,compiler:ODTranscriptCompiler,reason:string|null},workers:"opendiscord:transcript-error-continue"},
+ "opendiscord:transcript-html-visit":{source:"channel"|"creator-dm"|"participant-dm"|"active-admin-dm"|"every-admin-dm"|"other",params:{guild:discord.Guild,channel:discord.GuildTextBasedChannel,user:discord.User,ticket:ODTicket,compiler:ODTranscriptCompiler<{url:string,availableUntil:Date},{auth:string}>,result:ODTranscriptCompilerCompileResult<{url:string,availableUntil:Date}>},workers:"opendiscord:transcript-html-visit"},
+ "opendiscord:transcript-error-retry":{source:"slash"|"text"|"ticket-message"|"reopen-message"|"close-message"|"autoclose-message"|"autodelete"|"clear"|"other",params:{guild:discord.Guild,channel:discord.GuildTextBasedChannel,user:discord.User,ticket:ODTicket,compiler:ODTranscriptCompiler,reason:string|null},workers:"opendiscord:transcript-error-retry"},
+ "opendiscord:transcript-error-continue":{source:"slash"|"text"|"ticket-message"|"reopen-message"|"close-message"|"autoclose-message"|"autodelete"|"clear"|"other",params:{guild:discord.Guild,channel:discord.GuildTextBasedChannel,user:discord.User,ticket:ODTicket,compiler:ODTranscriptCompiler,reason:string|null},workers:"opendiscord:transcript-error-continue"},
"opendiscord:clear-continue":{source:"slash"|"text"|"other",params:{guild:discord.Guild,channel:discord.GuildTextBasedChannel,user:discord.User,filter:ODTicketClearFilter,list:string[]},workers:"opendiscord:clear-continue"},
}
@@ -170,7 +170,7 @@ export class ODDropdown_Default,result:ODTranscriptCompilerCompileResult},workers:"opendiscord:text-transcript"}
+ "opendiscord:text-transcript":{source:"channel"|"creator-dm"|"participant-dm"|"active-admin-dm"|"every-admin-dm"|"other",params:{guild:discord.Guild,channel:discord.GuildTextBasedChannel,user:discord.User,ticket:ODTicket,compiler:ODTranscriptCompiler,result:ODTranscriptCompilerCompileResult},workers:"opendiscord:text-transcript"}
}
/**## ODFileManager_Default `default_class`
@@ -275,10 +275,10 @@ export interface ODEmbedManagerIds_Default {
"opendiscord:blacklist-dm":{source:"slash"|"text"|"other",params:{guild:discord.Guild,channel:discord.TextBasedChannel,user:discord.User,mode:"add"|"remove",data:discord.User,reason:string|null},workers:"opendiscord:blacklist-dm"},
"opendiscord:blacklist-logs":{source:"slash"|"text"|"other",params:{guild:discord.Guild,channel:discord.TextBasedChannel,user:discord.User,mode:"add"|"remove",data:discord.User,reason:string|null},workers:"opendiscord:blacklist-logs"},
- "opendiscord:transcript-text-ready":{source:"channel"|"creator-dm"|"participant-dm"|"active-admin-dm"|"every-admin-dm"|"other",params:{guild:discord.Guild,channel:discord.GuildTextBasedChannel,user:discord.User,ticket:ODTicket,compiler:ODTranscriptCompiler<{contents:string}>,result:ODTranscriptCompilerCompileResult<{contents:string}>},workers:"opendiscord:transcript-text-ready"},
- "opendiscord:transcript-html-ready":{source:"channel"|"creator-dm"|"participant-dm"|"active-admin-dm"|"every-admin-dm"|"other",params:{guild:discord.Guild,channel:discord.GuildTextBasedChannel,user:discord.User,ticket:ODTicket,compiler:ODTranscriptCompiler<{url:string}>,result:ODTranscriptCompilerCompileResult<{url:string}>},workers:"opendiscord:transcript-html-ready"},
- "opendiscord:transcript-html-progress":{source:"channel"|"other",params:{guild:discord.Guild,channel:discord.GuildTextBasedChannel,user:discord.User,ticket:ODTicket,compiler:ODTranscriptCompiler<{url:string}>,remaining:number},workers:"opendiscord:transcript-html-progress"},
- "opendiscord:transcript-error":{source:"slash"|"text"|"ticket-message"|"reopen-message"|"close-message"|"autoclose-message"|"autodelete"|"clear"|"other",params:{guild:discord.Guild,channel:discord.GuildTextBasedChannel,user:discord.User,ticket:ODTicket,compiler:ODTranscriptCompiler,reason:string|null},workers:"opendiscord:transcript-error"},
+ "opendiscord:transcript-text-ready":{source:"channel"|"creator-dm"|"participant-dm"|"active-admin-dm"|"every-admin-dm"|"other",params:{guild:discord.Guild,channel:discord.GuildTextBasedChannel,user:discord.User,ticket:ODTicket,compiler:ODTranscriptCompiler<{contents:string},null>,result:ODTranscriptCompilerCompileResult<{contents:string}>},workers:"opendiscord:transcript-text-ready"},
+ "opendiscord:transcript-html-ready":{source:"channel"|"creator-dm"|"participant-dm"|"active-admin-dm"|"every-admin-dm"|"other",params:{guild:discord.Guild,channel:discord.GuildTextBasedChannel,user:discord.User,ticket:ODTicket,compiler:ODTranscriptCompiler<{url:string,availableUntil:Date},{auth:string}>,result:ODTranscriptCompilerCompileResult<{url:string,availableUntil:Date}>},workers:"opendiscord:transcript-html-ready"},
+ "opendiscord:transcript-html-progress":{source:"channel"|"other",params:{guild:discord.Guild,channel:discord.GuildTextBasedChannel,user:discord.User,ticket:ODTicket,compiler:ODTranscriptCompiler<{url:string,availableUntil:Date},{auth:string}>,remaining:number},workers:"opendiscord:transcript-html-progress"},
+ "opendiscord:transcript-error":{source:"slash"|"text"|"ticket-message"|"reopen-message"|"close-message"|"autoclose-message"|"autodelete"|"clear"|"other",params:{guild:discord.Guild,channel:discord.GuildTextBasedChannel,user:discord.User,ticket:ODTicket,compiler:ODTranscriptCompiler,reason:string|null},workers:"opendiscord:transcript-error"},
"opendiscord:reaction-role":{source:"panel-button"|"other",params:{guild:discord.Guild,user:discord.User,role:ODRole,result:ODRoleUpdateResult[]},workers:"opendiscord:reaction-role"},
"opendiscord:clear-verify-message":{source:"slash"|"text"|"other",params:{guild:discord.Guild,channel:discord.GuildTextBasedChannel,user:discord.User,filter:ODTicketClearFilter,list:string[]},workers:"opendiscord:clear-verify-message"},
@@ -406,10 +406,10 @@ export interface ODMessageManagerIds_Default {
"opendiscord:blacklist-dm":{source:"slash"|"text"|"other",params:{guild:discord.Guild,channel:discord.TextBasedChannel,user:discord.User,mode:"add"|"remove",data:discord.User,reason:string|null},workers:"opendiscord:blacklist-dm"},
"opendiscord:blacklist-logs":{source:"slash"|"text"|"other",params:{guild:discord.Guild,channel:discord.TextBasedChannel,user:discord.User,mode:"add"|"remove",data:discord.User,reason:string|null},workers:"opendiscord:blacklist-logs"},
- "opendiscord:transcript-text-ready":{source:"channel"|"creator-dm"|"participant-dm"|"active-admin-dm"|"every-admin-dm"|"other",params:{guild:discord.Guild,channel:discord.GuildTextBasedChannel,user:discord.User,ticket:ODTicket,compiler:ODTranscriptCompiler<{contents:string}>,result:ODTranscriptCompilerCompileResult<{contents:string}>},workers:"opendiscord:transcript-text-ready"},
- "opendiscord:transcript-html-ready":{source:"channel"|"creator-dm"|"participant-dm"|"active-admin-dm"|"every-admin-dm"|"other",params:{guild:discord.Guild,channel:discord.GuildTextBasedChannel,user:discord.User,ticket:ODTicket,compiler:ODTranscriptCompiler<{url:string}>,result:ODTranscriptCompilerCompileResult<{url:string}>},workers:"opendiscord:transcript-html-ready"},
- "opendiscord:transcript-html-progress":{source:"channel"|"other",params:{guild:discord.Guild,channel:discord.GuildTextBasedChannel,user:discord.User,ticket:ODTicket,compiler:ODTranscriptCompiler<{url:string}>,remaining:number},workers:"opendiscord:transcript-html-progress"},
- "opendiscord:transcript-error":{source:"slash"|"text"|"ticket-message"|"reopen-message"|"close-message"|"autoclose-message"|"autodelete"|"clear"|"other",params:{guild:discord.Guild,channel:discord.GuildTextBasedChannel,user:discord.User,ticket:ODTicket,compiler:ODTranscriptCompiler,reason:string|null},workers:"opendiscord:transcript-error"},
+ "opendiscord:transcript-text-ready":{source:"channel"|"creator-dm"|"participant-dm"|"active-admin-dm"|"every-admin-dm"|"other",params:{guild:discord.Guild,channel:discord.GuildTextBasedChannel,user:discord.User,ticket:ODTicket,compiler:ODTranscriptCompiler<{contents:string},null>,result:ODTranscriptCompilerCompileResult<{contents:string}>},workers:"opendiscord:transcript-text-ready"},
+ "opendiscord:transcript-html-ready":{source:"channel"|"creator-dm"|"participant-dm"|"active-admin-dm"|"every-admin-dm"|"other",params:{guild:discord.Guild,channel:discord.GuildTextBasedChannel,user:discord.User,ticket:ODTicket,compiler:ODTranscriptCompiler<{url:string,availableUntil:Date},{auth:string}>,result:ODTranscriptCompilerCompileResult<{url:string,availableUntil:Date}>},workers:"opendiscord:transcript-html-ready"},
+ "opendiscord:transcript-html-progress":{source:"channel"|"other",params:{guild:discord.Guild,channel:discord.GuildTextBasedChannel,user:discord.User,ticket:ODTicket,compiler:ODTranscriptCompiler<{url:string,availableUntil:Date},{auth:string}>,remaining:number},workers:"opendiscord:transcript-html-progress"},
+ "opendiscord:transcript-error":{source:"slash"|"text"|"ticket-message"|"reopen-message"|"close-message"|"autoclose-message"|"autodelete"|"clear"|"other",params:{guild:discord.Guild,channel:discord.GuildTextBasedChannel,user:discord.User,ticket:ODTicket,compiler:ODTranscriptCompiler,reason:string|null},workers:"opendiscord:transcript-error"},
"opendiscord:reaction-role":{source:"panel-button"|"other",params:{guild:discord.Guild,user:discord.User,role:ODRole,result:ODRoleUpdateResult[]},workers:"opendiscord:reaction-role"},
"opendiscord:clear-verify-message":{source:"slash"|"text"|"other",params:{guild:discord.Guild,channel:discord.GuildTextBasedChannel,user:discord.User,filter:ODTicketClearFilter,list:string[]},workers:"opendiscord:clear-verify-message"},
diff --git a/src/core/api/main.ts b/src/core/api/main.ts
index bcbc801..2252838 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.3"))
+ this.versions.add(ODVersion.fromString("opendiscord:version","v4.0.4"))
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 96633ff..4719a21 100644
--- a/src/core/api/modules/base.ts
+++ b/src/core/api/modules/base.ts
@@ -560,8 +560,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.3"})
- else newConfig.headers = {"User-Agent":"OpenDiscordBots-OpenTicket/4.0.3"}
+ if (newConfig.headers) Object.assign(newConfig.headers,{"User-Agent":"OpenDiscordBots-OpenTicket/4.0.4"})
+ else newConfig.headers = {"User-Agent":"OpenDiscordBots-OpenTicket/4.0.4"}
this.config = newConfig
}
@@ -615,8 +615,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.3"})
- else newConfig.headers = {"User-Agent":"OpenDiscordBots-OpenTicket/4.0.3"}
+ if (newConfig.headers) Object.assign(newConfig.headers,{"User-Agent":"OpenDiscordBots-OpenTicket/4.0.4"})
+ else newConfig.headers = {"User-Agent":"OpenDiscordBots-OpenTicket/4.0.4"}
this.config = newConfig
}
diff --git a/src/core/api/openticket/transcript.ts b/src/core/api/openticket/transcript.ts
index 9e86382..b5e6e55 100644
--- a/src/core/api/openticket/transcript.ts
+++ b/src/core/api/openticket/transcript.ts
@@ -15,7 +15,7 @@ import * as discord from "discord.js"
*
* The 2 default built-in transcript generators are: `opendiscord:html-compiler` & `opendiscord:text-compiler`.
*/
-export class ODTranscriptManager extends ODManager> {
+export class ODTranscriptManager extends ODManager> {
/**The manager responsible for collecting all messages in a channel. */
collector: ODTranscriptCollector
/**Alias for the client manager. */
@@ -31,12 +31,12 @@ export class ODTranscriptManager extends ODManager> {
/**## ODTranscriptCompilerInitFunction `type`
* This function will initiate/prepare the transcript system for an incoming transcript.
*/
-export type ODTranscriptCompilerInitFunction = (ticket:ODTicket, channel:discord.TextChannel, user:discord.User) => (ODTranscriptCompilerInitResult)|Promise
+export type ODTranscriptCompilerInitFunction = (ticket:ODTicket, channel:discord.TextChannel, user:discord.User) => (ODTranscriptCompilerInitResult)|Promise>
/**## ODTranscriptCompilerCompileFunction `type`
* This function will generate/compile the transcript itself.
*/
-export type ODTranscriptCompilerCompileFunction = (ticket:ODTicket, channel:discord.TextChannel, user:discord.User) => ODTranscriptCompilerCompileResult|Promise>
+export type ODTranscriptCompilerCompileFunction = (ticket:ODTicket, channel:discord.TextChannel, user:discord.User, initData:InitData) => ODTranscriptCompilerCompileResult|Promise>
/**## ODTicketClearFilter `type`
* This function will finish, clear-up & shut-down the transcript system. This will also initiate the sending of the messages to all recipients.
@@ -46,13 +46,15 @@ export type ODTranscriptCompilerReadyFunction = (result:ODT
/**## ODTranscriptCompilerInitResult `interface`
* This is the result which is returned by the `init()` function.
*/
-export interface ODTranscriptCompilerInitResult {
+export interface ODTranscriptCompilerInitResult {
/**Was the initialization successfull? */
success:boolean,
/**When not successfull, what was the reason? This will also be shown to the user. */
errorReason:string|null,
/**An optional message which will be sent while the transcript is being generated. */
- pendingMessage:ODMessageBuildResult|null
+ pendingMessage:ODMessageBuildResult|null,
+ /**An optional object containing data from the init() function which can be used in the compiler. */
+ initData:InitData,
}
/**## ODTranscriptCompilerCompileResult `interface`
@@ -98,15 +100,15 @@ export interface ODTranscriptCompilerReadyResult {
*
* These functions should be defined when creating this compiler. Existing compilers already exist for html & text transcripts.
*/
-export class ODTranscriptCompiler extends ODManagerData {
+export class ODTranscriptCompiler extends ODManagerData {
/*Initialise the system every time a transcript is created. Returns optional "pending" message to display while the transcript is being compiled. */
- init: ODTranscriptCompilerInitFunction|null
+ init: ODTranscriptCompilerInitFunction|null
/*Compile or create the transcript. Returns data to give to the ready() function for message creation. */
- compile: ODTranscriptCompilerCompileFunction|null
+ compile: ODTranscriptCompilerCompileFunction|null
/*Unload the system & create the final transcript message that will be sent. */
ready: ODTranscriptCompilerReadyFunction|null
- constructor(id:ODValidId, init?:ODTranscriptCompilerInitFunction, compile?:ODTranscriptCompilerCompileFunction, ready?:ODTranscriptCompilerReadyFunction|null){
+ constructor(id:ODValidId, init?:ODTranscriptCompilerInitFunction, compile?:ODTranscriptCompilerCompileFunction, ready?:ODTranscriptCompilerReadyFunction|null){
super(id)
this.init = init ?? null
this.compile = compile ?? null
@@ -119,8 +121,8 @@ export class ODTranscriptCompiler extends ODManagerData {
* It's used to generate typescript declarations for this class.
*/
export interface ODTranscriptCompilerIds {
- "opendiscord:html-compiler":ODTranscriptCompiler<{url:string}>,
- "opendiscord:text-compiler":ODTranscriptCompiler<{contents:string}>,
+ "opendiscord:html-compiler":ODTranscriptCompiler<{url:string,availableUntil:Date},{auth:string}>,
+ "opendiscord:text-compiler":ODTranscriptCompiler<{contents:string},null>,
}
/**## ODTranscriptManager_Default `default_class`
@@ -131,16 +133,16 @@ export interface ODTranscriptCompilerIds {
*/
export class ODTranscriptManager_Default extends ODTranscriptManager {
get(id:QuestionId): ODTranscriptCompilerIds[QuestionId]
- get(id:ODValidId): ODTranscriptCompiler|null
+ get(id:ODValidId): ODTranscriptCompiler|null
- get(id:ODValidId): ODTranscriptCompiler|null {
+ get(id:ODValidId): ODTranscriptCompiler|null {
return super.get(id)
}
remove(id:QuestionId): ODTranscriptCompilerIds[QuestionId]
- remove(id:ODValidId): ODTranscriptCompiler|null
+ remove(id:ODValidId): ODTranscriptCompiler|null
- remove(id:ODValidId): ODTranscriptCompiler|null {
+ remove(id:ODValidId): ODTranscriptCompiler|null {
return super.remove(id)
}
@@ -698,7 +700,7 @@ export interface ODTranscriptReactionData extends ODTranscriptEmojiData {
* The structure of the data sent to the Open Ticket HTML Transcripts v2 API.
*/
export interface ODTranscriptHtmlV2Data {
- version:"2",
+ version:"2.1",
otversion:string,
language:string,
style:{
@@ -734,25 +736,33 @@ export interface ODTranscriptHtmlV2Data {
ticket:{
name:string,
id:string,
+
guildname:string,
guildid:string,
guildinvite:string|false,
- creatorname:string,
- creatorid:string,
+ createdname:string|false,
+ createdid:string|false,
+ closedname:string|false,
+ closedid:string|false,
+ claimedname:string|false,
+ claimedid:string|false,
+ pinnedname:string|false,
+ pinnedid:string|false,
+ deletedname:string|false,
+ deletedid:string|false,
- closedbyname:string,
- closedbyid:string,
+ createdpfp:string|false,
+ closedpfp:string|false,
+ claimedpfp:string|false,
+ pinnedpfp:string|false,
+ deletedpfp:string|false,
- claimedname:string,
- claimedid:string,
-
- creatorpfp:string,
- closedbypfp:string,
- claimedpfp:string,
-
- closedtime:number,
- openedtime:number,
+ createdtime:number|false,
+ closedtime:number|false,
+ claimedtime:number|false,
+ pinnedtime:number|false,
+ deletedtime:number|false,
components:{
messages:number,
@@ -916,22 +926,9 @@ export interface ODTranscriptHtmlV2Data {
*/
export interface ODTranscriptHtmlV2Response {
status:"success"|"error",
- id:string,
+ type:"transcript",
+ url:string,
+ availableUntil:number, //UNIMPLEMENTED
time:number,
- estimated:{
- lastdump: number,
- processtime:number,
- waittime:number
- },
- transcriptstatus:{
- value:2,
- data:{
- fetchedmsgs:true,
- uploaded:true,
- inqueue:true,
- processed:false,
- waiting:false,
- available:false
- }
- }
+ id:string
}
\ No newline at end of file
diff --git a/src/core/startup/migration.ts b/src/core/startup/migration.ts
index 63354fb..d7a1720 100644
--- a/src/core/startup/migration.ts
+++ b/src/core/startup/migration.ts
@@ -19,5 +19,8 @@ export const migrations = [
new utilities.ODVersionMigration(api.ODVersion.fromString("opendiscord:version","v4.0.2"),async () => {},async () => {}),
//MIGRATE TO v4.0.3
- new utilities.ODVersionMigration(api.ODVersion.fromString("opendiscord:version","v4.0.3"),async () => {},async () => {})
+ 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 () => {})
]
\ No newline at end of file
diff --git a/src/data/openticket/transcriptLoader.ts b/src/data/openticket/transcriptLoader.ts
index c3e1b50..3d7148f 100644
--- a/src/data/openticket/transcriptLoader.ts
+++ b/src/data/openticket/transcriptLoader.ts
@@ -5,7 +5,8 @@ const collector = opendiscord.transcripts.collector
const messages = opendiscord.builders.messages
const transcriptConfig = opendiscord.configs.get("opendiscord:transcripts")
const textConfig = transcriptConfig.data.textTranscriptStyle
-const htmlVersion = Buffer.from("b3BlbnRpY2tldFRSQU5TQ1JJUFQxMjM0","base64").toString("utf8")
+const htmlVersion = Buffer.from("eW91LXNob3VsZG50LWJlLWxvb2tpbmctYXQtdGhpcy0tLWZvci1tb3JlLWluZm8tY29tbWEtc2VuZC1hLW1lc3NhZ2UtdG8tZGpqMTIzZGo=","base64").toString("utf8")
+const htmlDomain = atob("dC5kai1kai5iZQ==")
export const replaceHtmlTranscriptMentions = async (text:string) => {
const mainServer = opendiscord.client.mainServer
@@ -34,17 +35,30 @@ export const replaceHtmlTranscriptMentions = async (text:string) => {
return defaultroletext
}
+/**
+ * This function is used to authenticate with the HTML Transcript API.
+ * It is NOT the token of the bot but an internal AUTH TOKEN from the API.
+ *
+ * Questions? Visit our discord server: https://discord.dj-dj.be
+ */
+function transcriptAuth(_A:{salt:number,secret:string}){
+ const _B = Buffer.from(_A.secret,"hex");const _C = Math["floor"](new Date().getTime()/(30*1000)).toString();const _D = Buffer.from(_C);const _E = Buffer.alloc(_D["length"]);_D.forEach((v,i) => {_E[i] = v ^ _B[i % _B["length"]];});return btoa(JSON.stringify({salt:_A.salt,secret:_A.secret,token:_E.toString("hex")}))
+}
+
export const loadAllTranscriptCompilers = async () => {
class ODHTTPHtmlPostRequest extends api.ODHTTPPostRequest {
- constructor(domain:string, htmlFinal:api.ODTranscriptHtmlV2Data){
- super("https://"+domain+"/transcripts/upload?auth="+htmlVersion+"&version=2",true,{
- body:JSON.stringify(htmlFinal)
+ constructor(transcriptAuth:string,htmlFinal:api.ODTranscriptHtmlV2Data){
+ super("https://"+htmlDomain+"/api/v2/upload?auth="+htmlVersion+"&token="+transcriptAuth,true,{
+ body:JSON.stringify(htmlFinal),
+ headers:{
+ "Content-Type":"application/json"
+ }
})
}
}
//TEXT COMPILER
- opendiscord.transcripts.add(new api.ODTranscriptCompiler<{contents:string}>("opendiscord:text-compiler",undefined,async (ticket,channel,user) => {
+ opendiscord.transcripts.add(new api.ODTranscriptCompiler<{contents:string},null>("opendiscord:text-compiler",undefined,async (ticket,channel,user) => {
//COMPILE
const rawMessages = await collector.collectAllMessages(ticket)
if (!rawMessages) return {ticket,channel,user,success:false,errorReason:"Unable to collect messages! Channel not found!",messages:null,data:null}
@@ -173,27 +187,51 @@ export const loadAllTranscriptCompilers = async () => {
}))
//HTML COMPILER
- opendiscord.transcripts.add(new api.ODTranscriptCompiler<{url:string}>("opendiscord:html-compiler",async (ticket,channel,user) => {
+ opendiscord.transcripts.add(new api.ODTranscriptCompiler<{url:string,availableUntil:Date},{auth:string}|null>("opendiscord:html-compiler",async (ticket,channel,user) => {
//INIT
- const req = new api.ODHTTPGetRequest("https://apis.dj-dj.be/transcripts/status.json",false)
+ const req = new api.ODHTTPGetRequest(atob("aHR0cHM6Ly90LmRqLWRqLmJlL2FwaS92Mi9pbml0"),false)
const res = await req.run()
- if (!res || res.status != 200 || !res.body){
- opendiscord.debugfile.writeNote("HTML Transcripts Error => status: "+res.status+", body:\n"+res.body)
- process.emit("uncaughtException",new api.ODSystemError("HTML Transcripts INIT_COMMUNICATON error! (check otdebug.txt for details)"))
- return {success:false,errorReason:"HTML Transcripts are currently unavailable!",pendingMessage:null}
+ //PENDING MESSAGE (not required anymore) => await messages.getSafe("opendiscord:transcript-html-progress").build("channel",{guild:channel.guild,channel,user,ticket,compiler:opendiscord.transcripts.get("opendiscord:html-compiler"),remaining:16000})
+ if (res.status == 200 && res.body){
+ const data: {salt:number,secret:string} = JSON.parse(atob(res.body))
+ return {success:true,errorReason:null,pendingMessage:null,initData:{auth:transcriptAuth(data)}}
}
- try{
- const data = JSON.parse(res.body)
- if (!data || data["v2"] != "online") return {success:false,errorReason:"HTML Transcripts are currently unavailable due to maintenance!",pendingMessage:null}
- }catch{
- opendiscord.debugfile.writeNote("HTML Transcripts Error => unable to parse status! body:\n"+res.body)
- process.emit("uncaughtException",new api.ODSystemError("HTML Transcripts INIT_STATUS_PARSE error! (check otdebug.txt for details)"))
- return {success:false,errorReason:"HTML Transcripts are currently unavailable due to JSON parse error!",pendingMessage:null}
+ else{
+ if (res.status == 503){
+ opendiscord.debugfile.writeNote("HTML Transcripts Error => status: "+res.status+", body:\n"+res.body)
+ process.emit("uncaughtException",new api.ODSystemError("HTML Transcripts INIT_COMMUNICATON_503 error! (check otdebug.txt for details)"))
+ return {success:false,errorReason:"The HTML Transcripts are currently unreachable. Please try again later.",pendingMessage:null,initData:null}
+
+ }else if (res.status == 429){
+ opendiscord.debugfile.writeNote("HTML Transcripts Error => status: "+res.status+", body:\n"+res.body)
+ process.emit("uncaughtException",new api.ODSystemError("HTML Transcripts INIT_COMMUNICATON_429 error! (check otdebug.txt for details)"))
+ return {success:false,errorReason:"The HTML Transcripts are currently unreachable because the bot is ratelimited. Please try again in a few minutes.",pendingMessage:null,initData:null}
+
+ }else if (res.status == 403){
+ opendiscord.debugfile.writeNote("HTML Transcripts Error => status: "+res.status+", body:\n"+res.body)
+ process.emit("uncaughtException",new api.ODSystemError("HTML Transcripts INIT_COMMUNICATON_403 error! (check otdebug.txt for details)"))
+ return {success:false,errorReason:"The HTML Transcripts are unreachable because the bot has been banned from using the API. If you don't know why, please contact us at https://discord.dj-dj.be",pendingMessage:null,initData:null}
+
+ }else if (res.status == 500){
+ opendiscord.debugfile.writeNote("HTML Transcripts Error => status: "+res.status+", body:\n"+res.body)
+ process.emit("uncaughtException",new api.ODSystemError("HTML Transcripts INIT_COMMUNICATON_500 error! (check otdebug.txt for details)"))
+ return {success:false,errorReason:"Something went wrong while compiling the HTML Transcripts, please report this error at https://discord.dj-dj.be",pendingMessage:null,initData:null}
+
+ }else if (res.status == 413){
+ opendiscord.debugfile.writeNote("HTML Transcripts Error => status: "+res.status+", body:\n"+res.body)
+ process.emit("uncaughtException",new api.ODSystemError("HTML Transcripts INIT_COMMUNICATON_413 error! (check otdebug.txt for details)"))
+ return {success:false,errorReason:"Unable to upload transcript, file size is too large (Max 5MB)!",pendingMessage:null,initData:null}
+
+ }else{
+ opendiscord.debugfile.writeNote("HTML Transcripts Error => status: "+res.status+", body:\n"+res.body)
+ process.emit("uncaughtException",new api.ODSystemError("HTML Transcripts INIT_COMMUNICATON_UNKNOWN error! (check otdebug.txt for details)"))
+ return {success:false,errorReason:"Something went wrong while compiling the HTML Transcripts, please report this error at https://discord.dj-dj.be",pendingMessage:null,initData:null}
+ }
}
- return {success:true,errorReason:null,pendingMessage:await messages.getSafe("opendiscord:transcript-html-progress").build("channel",{guild:channel.guild,channel,user,ticket,compiler:opendiscord.transcripts.get("opendiscord:html-compiler"),remaining:16000})}
- },async (ticket,channel,user) => {
+ },async (ticket,channel,user,initData) => {
//COMPILE
+ if (!initData) return {ticket,channel,user,success:false,errorReason:"Could not authenticate with HTML Transcript API.",messages:null,data:null}
const rawMessages = await collector.collectAllMessages(ticket)
if (!rawMessages) return {ticket,channel,user,success:false,errorReason:"Unable to collect messages! Channel not found!",messages:null,data:null}
const messages = await collector.convertMessagesToTranscriptData(rawMessages)
@@ -350,18 +388,14 @@ export const loadAllTranscriptCompilers = async () => {
const dsf = transcriptConfig.data.htmlTranscriptStyle.favicon
const creator = await opendiscord.tickets.getTicketUser(ticket,"creator")
- const claimer = await opendiscord.tickets.getTicketUser(ticket,"claimer")
const closer = await opendiscord.tickets.getTicketUser(ticket,"closer")
+ const claimer = await opendiscord.tickets.getTicketUser(ticket,"claimer")
+ const pinner = await opendiscord.tickets.getTicketUser(ticket,"pinner")
const htmlFinal: api.ODTranscriptHtmlV2Data = {
- version:"2",
+ version:"2.1",
otversion:opendiscord.versions.get("opendiscord:version").toString(true),
- bot:{
- name:opendiscord.client.client.user.displayName,
- id:opendiscord.client.client.user.id,
- pfp:opendiscord.client.client.user.displayAvatarURL({extension:"png"}),
- },
- language:opendiscord.languages.getLanguageMetadata()?.language ?? "english",
+ language:opendiscord.languages.getLanguageMetadata()?.language.toLowerCase() ?? "english",
style:{
background:{
backgroundData:(dsb.backgroundImage == "") ? dsb.backgroundColor : dsb.backgroundImage,
@@ -387,30 +421,44 @@ export const loadAllTranscriptCompilers = async () => {
enableCustomFavicon:dsf.enableCustomFavicon
}
},
+ bot:{
+ name:opendiscord.client.client.user.displayName,
+ id:opendiscord.client.client.user.id,
+ pfp:opendiscord.client.client.user.displayAvatarURL({extension:"png"}),
+ },
ticket:{
name:channel.name,
id:channel.id,
guildname:channel.guild.name,
guildid:channel.guild.id,
- guildinvite:"",
+ guildinvite:false,
- creatorname:(creator ? creator.displayName : ""),
- creatorid:(creator ? creator.id : ""),
- creatorpfp:(creator ? creator.displayAvatarURL() : "https://transcripts.dj-dj.be/favicon.png"),
+ createdname:(creator ? creator.displayName : false),
+ createdid:(creator ? creator.id : false),
+ createdpfp:(creator ? creator.displayAvatarURL() : false),
- //closer is ticket deleter (small bug)
- closedbyname:user.displayName,
- closedbyid:user.id,
- closedbypfp:user.displayAvatarURL(),
+ closedname:(closer ? closer.displayName : false),
+ closedid:(closer ? closer.id : false),
+ closedpfp:(closer ? closer.displayAvatarURL() : false),
- //claiming is currently unused
- claimedname:(claimer ? claimer.displayName : ""),
- claimedid:(claimer ? claimer.id : ""),
- claimedpfp:(claimer ? claimer.displayAvatarURL() : "https://transcripts.dj-dj.be/favicon.png"),
-
- closedtime:new Date().getTime(),
- openedtime:ticket.get("opendiscord:opened-on").value ?? new Date().getTime(),
+ claimedname:(claimer ? claimer.displayName : false),
+ claimedid:(claimer ? claimer.id : false),
+ claimedpfp:(claimer ? claimer.displayAvatarURL() : false),
+
+ pinnedname:(pinner ? pinner.displayName : false),
+ pinnedid:(pinner ? pinner.id : false),
+ pinnedpfp:(pinner ? pinner.displayAvatarURL() : false),
+
+ deletedname:user.displayName,
+ deletedid:user.id,
+ deletedpfp:user.displayAvatarURL(),
+
+ createdtime:ticket.get("opendiscord:opened-on").value ?? false,
+ closedtime:ticket.get("opendiscord:closed-on").value ?? false,
+ claimedtime:ticket.get("opendiscord:claimed-on").value ?? false,
+ pinnedtime:ticket.get("opendiscord:pinned-on").value ?? false,
+ deletedtime:new Date().getTime(),
//role colors are currently unused
roleColors:[],
@@ -440,39 +488,71 @@ export const loadAllTranscriptCompilers = async () => {
},
customFavicon:{
enabled:dsf.enableCustomFavicon,
- image:(dsf.imageUrl) ? dsf.imageUrl : "https://transcripts.dj-dj.be/favicon.png"
+ image:(dsf.imageUrl) ? dsf.imageUrl : "https://t.dj-dj.be/favicon.png"
},
additionalFlags:[]
}
}
- const req = new ODHTTPHtmlPostRequest("apis.dj-dj.be",htmlFinal)
+ const req = new ODHTTPHtmlPostRequest(initData.auth,htmlFinal)
const res = await req.run()
+
//check status
- if (!res || res.status != 200 || !res.body){
- //ratelimit error
- if (res.status == 429) return {ticket,channel,user,success:false,errorReason:"Failed to upload HTML Transcripts! (Ratelimit)\nTry again in a few minutes!",messages,data:null}
-
- //unknown status error
- opendiscord.debugfile.writeNote("HTML Transcripts Error => status: "+res.status+", body:\n"+res.body)
- return {ticket,channel,user,success:false,errorReason:"Failed to upload HTML Transcripts! (Unknown Error)",messages,data:null}
- }
- //check body
- try{
+ if (res.status == 200 && res.body){
+ //check body
var data: api.ODTranscriptHtmlV2Response = JSON.parse(res.body)
if (!data || data["status"] != "success"){
opendiscord.debugfile.writeNote("HTML Transcripts Error => status: "+res.status+", body:\n"+res.body)
- return {ticket,channel,user,success:false,errorReason:"Failed to upload HTML Transcripts! (Server 500 Error)",messages,data:null}}
- }catch{
- opendiscord.debugfile.writeNote("HTML Transcripts Error => status: "+res.status+", body:\n"+res.body)
- return {ticket,channel,user,success:false,errorReason:"Failed to upload HTML Transcripts! (JSON parse error)",messages,data:null}
- }
+ process.emit("uncaughtException",new api.ODSystemError("HTML Transcripts COMPILE_JSON_STATUS error! (check otdebug.txt for details)"))
+ return {ticket,channel,user,success:false,errorReason:"TFailed to read the response of the HTML Transcripts server.",messages:null,data:null}
+ }
- const url = "https://transcripts.dj-dj.be/v2/"+data.time+"_"+data.id+".html"
- return {ticket,channel,user,success:true,errorReason:null,messages,data:{url}}
+ return {
+ ticket,channel,user,
+ success:true,
+ errorReason:null,
+ messages,
+ data:{
+ url:data.url,
+ availableUntil:new Date(data.availableUntil)
+ }
+ }
+
+ }else{
+ if (res.status == 503){
+ opendiscord.debugfile.writeNote("HTML Transcripts Error => status: "+res.status+", body:\n"+res.body)
+ process.emit("uncaughtException",new api.ODSystemError("HTML Transcripts COMPILE_COMMUNICATON_503 error! (check otdebug.txt for details)"))
+ return {ticket,channel,user,success:false,errorReason:"The HTML Transcripts are currently unreachable. Please try again later.",messages:null,data:null}
+
+ }else if (res.status == 429){
+ opendiscord.debugfile.writeNote("HTML Transcripts Error => status: "+res.status+", body:\n"+res.body)
+ process.emit("uncaughtException",new api.ODSystemError("HTML Transcripts COMPILE_COMMUNICATON_429 error! (check otdebug.txt for details)"))
+ return {ticket,channel,user,success:false,errorReason:"The HTML Transcripts are currently unreachable because the bot is ratelimited. Please try again in a few minutes.",messages:null,data:null}
+
+ }else if (res.status == 403){
+ opendiscord.debugfile.writeNote("HTML Transcripts Error => status: "+res.status+", body:\n"+res.body)
+ process.emit("uncaughtException",new api.ODSystemError("HTML Transcripts COMPILE_COMMUNICATON_403 error! (check otdebug.txt for details)"))
+ return {ticket,channel,user,success:false,errorReason:"The HTML Transcripts are unreachable because the bot has been banned from using the API. If you don't know why, please contact us at https://discord.dj-dj.be",messages:null,data:null}
+
+ }else if (res.status == 500){
+ opendiscord.debugfile.writeNote("HTML Transcripts Error => status: "+res.status+", body:\n"+res.body)
+ process.emit("uncaughtException",new api.ODSystemError("HTML Transcripts COMPILE_COMMUNICATON_500 error! (check otdebug.txt for details)"))
+ return {ticket,channel,user,success:false,errorReason:"Something went wrong while compiling the HTML Transcripts, please report this error at https://discord.dj-dj.be",messages:null,data:null}
+
+ }else if (res.status == 413){
+ opendiscord.debugfile.writeNote("HTML Transcripts Error => status: "+res.status+", body:\n"+res.body)
+ process.emit("uncaughtException",new api.ODSystemError("HTML Transcripts COMPILE_COMMUNICATON_413 error! (check otdebug.txt for details)"))
+ return {ticket,channel,user,success:false,errorReason:"Unable to upload transcript, file size is too large (Max 5MB)!",messages:null,data:null}
+
+ }else{
+ opendiscord.debugfile.writeNote("HTML Transcripts Error => status: "+res.status+", body:\n"+res.body)
+ process.emit("uncaughtException",new api.ODSystemError("HTML Transcripts COMPILE_COMMUNICATON_UNKNOWN error! (check otdebug.txt for details)"))
+ return {ticket,channel,user,success:false,errorReason:"Something went wrong while compiling the HTML Transcripts, please report this error at https://discord.dj-dj.be",messages:null,data:null}
+ }
+ }
},async (result) => {
//READY
- await utilities.timer(16000) //wait until transcript is ready
+ //WAIT UNTIL READY (not required anymore) => await utilities.timer(16000)
return {
channelMessage:await messages.getSafe("opendiscord:transcript-html-ready").build("channel",{guild:result.channel.guild,channel:result.channel,user:result.user,ticket:result.ticket,result,compiler:opendiscord.transcripts.get("opendiscord:html-compiler")}),
creatorDmMessage:await messages.getSafe("opendiscord:transcript-html-ready").build("creator-dm",{guild:result.channel.guild,channel:result.channel,user:result.user,ticket:result.ticket,result,compiler:opendiscord.transcripts.get("opendiscord:html-compiler")}),
diff --git a/src/index.ts b/src/index.ts
index 64d1f17..15a9cb0 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -20,7 +20,7 @@
INFORMATION:
============
- Open Ticket v4.0.3 - © DJdj Development
+ Open Ticket v4.0.4 - © DJdj Development
support us: https://github.com/sponsors/DJj123dj
discord: https://discord.dj-dj.be