Compare commits

...
726 Commits
Author SHA1 Message Date
Nyo 57d420a9f4 Update supportbot.yml 2026-05-12 16:31:37 +02:00
Nyo f8cc08ba3e Bump version from 26.0.0-prerelease-1 to 26.1.1 2026-05-12 16:31:23 +02:00
Nyo 60d5c4cb1f Change event name from 'ready' to 'clientReady' 2026-05-12 16:30:29 +02:00
Nyo 0288e2f4de Normalize channel, role, and category name comparisons 2026-05-12 16:30:12 +02:00
Nyo 33d5a79759 Refactor image handling in buildModernComponents
Refactored the buildModernComponents function to use MediaGalleryBuilder for image handling instead of TextDisplayBuilder. Cleaned up code formatting and removed unnecessary whitespace.
2026-05-12 16:29:54 +02:00
1tzEmerald 30b89a3cf9 Update supportbot.yml 2026-04-25 22:31:11 +01:00
1tzEmerald 427dc2d040 Merge pull request #209 from Emerald-Services/Dev-(26.1)
26.1
2026-04-25 21:57:00 +01:00
1tzEmerald 033f32d596 26.1 Dev-6
- Further Dashboard Improvements
- Bug Fixes
2026-04-21 13:37:39 +01:00
1tzEmerald d5fa42b55d Merge pull request #206 from Emerald-Services/26.0
26.0
2026-03-27 16:45:39 +00:00
1tzEmerald 4bb35b1e50 Update account setup instructions for SupportBot AI 2026-03-27 16:31:40 +00:00
1tzEmerald d451857d7b Update SupportBot version in configuration file 2026-03-27 16:31:07 +00:00
1tzEmerald 78b804176a 26.0 2026-03-27 16:25:59 +00:00
1tzEmerald 15b780ab62 26.0-build-2 2026-03-11 18:58:15 +00:00
1tzEmerald 9448c4e3d6 26.0-build-1 2026-03-10 20:02:43 +00:00
1tzEmerald 4af9759700 Update SupportBot version to v8.5 2026-02-14 13:32:59 +00:00
1tzEmerald 835cbbe937 Delete package-lock.json 2026-02-14 13:32:10 +00:00
1tzEmerald 491bb9ba65 . 2026-02-14 13:14:05 +00:00
1tzEmerald ced29535f9 Merge pull request #201 from Emerald-Services/8.5
8.5 Update
2026-02-14 13:11:56 +00:00
1tzEmerald d99e9a105b 8.5 Update
Added TicketRename command
2026-02-14 13:05:07 +00:00
1tzEmerald c72c7c5c34 Merge pull request #200 from Emerald-Services/1tzemerald-patch-3
Delete .idea directory
2026-02-03 16:37:22 +00:00
1tzEmerald 23960bc30d Delete .idea directory 2026-02-03 16:37:08 +00:00
1tzEmerald abb48c281b Merge branch 'release' of https://github.com/Emerald-Services/SupportBot into release 2026-02-03 16:33:08 +00:00
1tzEmerald 7acb825713 Added rename command 2026-02-03 16:33:02 +00:00
1tzEmerald dd2f329485 Merge pull request #199 from Emerald-Services/1tzemerald-patch-2
Update Node.JS version for SupportBot 8.x
2025-11-22 12:52:33 +00:00
1tzEmerald 75577ec0bd Update Node.JS version for SupportBot 8.x 2025-11-22 12:52:23 +00:00
1tzEmerald 7366bcda71 Merge pull request #198 from Emerald-Services/1tzemerald-patch-1
Change support status for SupportBot 7.7.3
2025-11-22 12:51:59 +00:00
1tzEmerald 23e43cfad3 Change support status for SupportBot 7.7.3
Updated support status for SupportBot versions.
2025-11-22 12:51:47 +00:00
Nyo ad9a8085aa Merge pull request #197 from Emerald-Services/ItsNyoty-patch-1
Fix link format for BuiltByBit in README.md
2025-09-30 18:50:12 +02:00
Nyo 2f23e8f23d Fix link format for BuiltByBit in README.md 2025-09-30 18:49:52 +02:00
1tzEmerald 4c07b8a236 Merge pull request #196 from Emerald-Services/dev
8.4.1 guilldMemberAdd update.
2025-09-25 13:16:42 +01:00
1tzEmerald 571bd586fa 8.4.1 guilldMemberAdd update.
Added if statement to .setAccentColor allowing you to remove the color from the config.
2025-09-25 13:16:20 +01:00
1tzEmerald eac2d88873 Merge pull request #195 from Emerald-Services/dev
8.4.1 small fix
2025-09-25 13:10:23 +01:00
1tzEmerald 93c793f393 Merge branch 'dev' of https://github.com/Emerald-Services/SupportBot into dev 2025-09-25 13:09:09 +01:00
1tzEmerald 1aa97b63f9 8.4.1 small fix 2025-09-25 13:09:00 +01:00
1tzEmerald c1b76a2b84 Merge pull request #194 from Emerald-Services/dev
8.4 from Dev to Release
2025-09-23 23:26:30 +01:00
1tzEmerald a1429aa723 Merge branch 'release' into dev 2025-09-23 23:26:13 +01:00
1tzEmerald 2de7c7b19c 8.4 2025-09-23 23:23:19 +01:00
1tzEmerald 7383bd2c48 8.4-DEV-2
Added Buttons to WelcomeMessage
Added Components v2 Support for Welcome Message
Added improved logging system
2025-09-22 18:36:04 +01:00
1tzEmerald a05d65099b 8.4 DEV 1
Changed JSON to SQLlite
Added Suggestion Forums
Added /suggestadmin
2025-09-20 23:09:22 +01:00
1tzEmerald c6db929d12 8.4-Dev 1
Added Suggestions mode switch
2025-08-07 13:54:35 +01:00
1tzEmerald dc88f6c51a Merge pull request #186 from chorimethod/release
Added "InvalidChannel" message (required by suggest.js), fixed a double quote that was preventing the bot to start correctly.
2025-07-14 16:37:45 +01:00
Nyo d69fb0e26d Update supportbot.yml 2025-05-22 20:30:06 +02:00
chorisancio3d 4b2d53d3f4 Added "InvalidChannel" message (required by suggest.js)
Fixed a double quote that was preventing the bot to start correctly.
2025-02-03 21:43:03 -03:00
1tzEmerald e3fa8b6d72 Merge pull request #185 from Emerald-Services/dev
Update close.js
2024-11-10 13:31:17 +00:00
1tzEmerald 5c6a9f7306 Update close.js 2024-11-10 13:30:42 +00:00
1tzEmerald 71e33dbf66 Update close.js 2024-11-10 13:30:27 +00:00
1tzEmerald d468ab1575 Delete Data/Profiles directory 2024-11-10 13:18:50 +00:00
1tzEmerald 74482af471 Merge pull request #184 from Emerald-Services/dev
Dev
2024-11-09 13:04:16 +00:00
1tzEmerald 0b8b092cb9 Update profile.js 2024-11-09 13:03:55 +00:00
1tzEmerald 3cdfaef942 Update profile.js 2024-11-09 13:03:41 +00:00
1tzEmerald fcf441a190 Update close.js 2024-11-09 02:46:35 +00:00
1tzEmerald 5a1c4ad99c Update close.js 2024-11-09 02:46:25 +00:00
1tzEmerald d9cb72f22e Update close.js 2024-11-09 02:44:48 +00:00
1tzEmerald 58eb37124e Update close.js 2024-11-09 02:44:39 +00:00
1tzEmerald afeeda3a8d Merge pull request #183 from Emerald-Services/dev
Dev
2024-11-09 02:38:20 +00:00
1tzEmerald fece90d2bd Update close.js 2024-11-09 02:37:26 +00:00
1tzEmerald 357a85fa3d Update close.js 2024-11-09 02:37:14 +00:00
1tzEmerald f34158caa6 Update close.js 2024-11-09 02:32:52 +00:00
1tzEmerald 1bb343e49a Update ticket.js 2024-11-09 02:32:28 +00:00
1tzEmerald dffa5d4161 Update close.js 2024-11-09 02:32:06 +00:00
1tzEmerald 13590b08a8 Update ticket.js 2024-11-09 01:07:16 +00:00
1tzEmerald 6e14ce209d Merge pull request #182 from Emerald-Services/dev
8.3 Dev -> Release
2024-11-09 00:45:40 +00:00
1tzEmerald 72b8c2247e Merge branch 'release' into dev 2024-11-09 00:45:28 +00:00
1tzEmerald 925504a928 Merge branch 'dev' of https://github.com/Emerald-Services/SupportBot into dev 2024-11-09 00:37:53 +00:00
1tzEmerald 236d67707f 8.3 Update 2024-11-09 00:37:51 +00:00
1tzEmerald 753f432c95 Merge pull request #179 from Emerald-Services/1tzemerald-patch-4
Update package.json
2024-10-11 15:04:37 +01:00
1tzEmerald c824bc51b2 Update package.json 2024-10-11 15:03:47 +01:00
1tzEmerald 39ee540b55 Merge pull request #177 from Emerald-Services/dev
8.2
2024-10-11 15:00:05 +01:00
1tzEmerald 903b214051 Merge branch 'release' into dev 2024-10-11 14:59:50 +01:00
1tzEmerald ac0daf5fe7 8.2 2024-10-10 19:14:45 +01:00
ItsNyoty 80e38a07e9 Merge pull request #175 from Emerald-Services/ItsNyoty-patch-1
Update README.md
2024-09-19 13:06:05 +02:00
ItsNyoty d2598e09f7 Update README.md 2024-09-19 13:05:26 +02:00
ItsNyoty 28aab47150 Update README.md 2024-09-19 13:04:44 +02:00
1tzEmerald 81bda67ae4 Merge pull request #172 from Emerald-Services/1tzemerald-patch-3
Update supportbot.yml
2024-07-30 17:58:41 +01:00
1tzEmerald 25bbd1ff85 Update supportbot.yml 2024-07-30 17:58:01 +01:00
1tzEmerald 164d695a5f Merge pull request #171 from Emerald-Services/1tzemerald-patch-2
Create 0000000000000000.json
2024-07-30 17:57:33 +01:00
1tzEmerald 57e4a3e77c Create 0000000000000000.json 2024-07-30 17:57:12 +01:00
1tzEmerald a6ac532b2b Merge pull request #169 from Emerald-Services/dev
8.0.1 Dev -> Release Branch
2024-07-30 17:47:13 +01:00
1tzEmerald 4f14722e14 8.0.1 Update 2024-07-30 17:45:35 +01:00
1tzEmerald 9a6eece7a1 v8.1 2024-07-09 22:49:49 +01:00
1tzEmerald fd65d0a9a7 8.1-BETA 2024-07-03 13:46:57 +01:00
ItsNyoty 48500fe8a4 Update README.md 2024-07-03 13:42:46 +02:00
1tzEmerald 8d8d9e4bee 8.0.1 Bug Fix 2024-06-13 18:01:41 +01:00
1tzEmerald dcbddf9f23 8.0.1 - Bug Fix 2024-06-13 17:36:44 +01:00
1tzEmerald 7449c0a61a License files 2024-06-12 12:55:45 +01:00
1tzEmerald c95b8ccb32 SupportBot 8.0 2024-06-12 12:54:31 +01:00
1tzEmerald 2c5bfe8e33 Merge pull request #135 from ItsNyoty/patch-1
Update messages.yml
2022-09-05 13:42:52 +01:00
ItsNyoty a3bbd97333 Update messages.yml
TicketExists wasn't defined before
2022-08-29 14:58:01 +02:00
1tzEmerald 4ea488951d Delete oldconfig.yml 2022-08-12 01:38:07 +01:00
1tzEmerald 481424d5a6 Update LICENSE.md 2022-08-12 01:37:49 +01:00
1tzEmerald fe82e96cc1 Update LICENSE.md 2022-08-12 01:37:31 +01:00
1tzEmerald 976258c959 Delete .gitignore 2022-08-12 01:37:14 +01:00
1tzEmerald 83cf0689e2 Delete .DS_Store 2022-08-12 01:37:00 +01:00
ItzEmerald c911cb4423 v8.0 New configuration files 2022-08-12 01:35:36 +01:00
ItzEmerald 4eadef8b65 8.0 Dev 1.2
Reworked configuration files & completed upgrade to V14
2022-08-11 19:19:29 +01:00
ItzEmerald 4e081358ff v8.0-Dev-1.1 2022-07-23 07:50:12 +01:00
ItzEmerald 209ec0b435 v8.0 - Dev-1 2022-07-22 13:19:05 +01:00
Xiled Emerald 6d363abb54 Merge pull request #129 from SypherRed/dev
Better looking readme
2022-07-01 22:19:03 +01:00
SypherRed 6f8b84aeda Update README.md 2022-07-01 23:16:16 +02:00
SypherRed 5b8c5da33a Update README.md 2022-07-01 23:14:01 +02:00
Xiled Emerald b6ef0f95cb Merge pull request #126 from SypherRed/release
Muted Role check and issue fix
2022-06-30 15:49:14 +01:00
SypherRed cce1480a42 remove empty declaration
AboutMe was removed in a previous version.
2022-06-29 13:12:56 +02:00
ItzEmerald 44fbe9f2d6 FINAL 7.7 2022-06-28 03:15:52 +01:00
ItzEmerald 29db6c7d67 7.7 FINAL BETA 2022-06-28 03:14:54 +01:00
SypherRed 26e9b56961 Issue fix with Muted Role check
Fixed the issue to recognize a Muted Role and made changes to ready.js accordingly
2022-06-27 19:03:34 +02:00
SypherRed 979271cfb5 beta push of muted check
push of a check if author has a muted role on ticket opening, if so, decline the interaction

Also either check for missing role or not
2022-06-23 20:58:03 +02:00
ItzEmerald 69f0b00ed3 7.7 2022-06-23 00:05:08 +01:00
ItzEmerald c1a1839457 7.7 BETA 3 2022-06-22 23:30:59 +01:00
Xiled Emerald dd4b53800e Merge pull request #124 from Emerald-Services/add-license-1
Create LICENSE.md
2022-06-22 23:05:38 +01:00
Xiled Emerald 1fc94528fc Merge pull request #123 from SypherRed/release
embed fix and updates
2022-06-22 23:05:25 +01:00
SypherRed bb1a817980 fix previous push of embed
fixed the if-statement of embed
2022-06-22 20:59:45 +02:00
SypherRed 53305acbc7 Fixed embed command
Added a check if the field options are used, if not leave it ignored and don't add some.

This was fixed due to ticket-0038.
2022-06-22 18:21:25 +02:00
Xiled Emerald d0f1bae0bd Create LICENSE.md 2022-06-22 02:24:19 +01:00
SypherRed c0cf3b1bb7 Update several files
* added to .gitignore ".DS_Store"

* changed commented head in "suggest.js" and "translate.js"

* Removed "AboutMe" due it to being unfunctional and can be set in the Developer Portal

* Removed the icon in "ticket-panel.yml"

* Updated dependencies and changed version to match current
2022-06-21 09:54:22 +02:00
Xiled Emerald ce67b668d5 Update Client.js 2022-06-21 01:42:59 +01:00
Xiled Emerald 3273cfd0e1 Update help.js 2022-06-21 01:41:53 +01:00
Xiled Emerald fd992a6514 Update supportbot.yml 2022-06-21 01:41:17 +01:00
Xiled Emerald 550d681fe1 Merge pull request #122 from RandomTomato/release
Added 3 new settings in supportbot.yml for more customization
2022-06-21 01:39:35 +01:00
ItzEmerald 7d29226953 BETA 2 - V7.7 2022-06-21 01:38:22 +01:00
BuildTools 38da72ca91 Added 3 new settings in supportbot.yml for more customization 2022-06-18 11:19:12 +09:30
Xiled Emerald eab11361cb Update ticket-panel-id.json 2022-06-16 22:30:13 +01:00
Xiled Emerald b281bba36f Merge pull request #120 from Emerald-Services/beta
7.6 Release
2022-06-16 22:26:50 +01:00
ItzEmerald 5e38573aed 7.6 2022-06-16 22:12:14 +01:00
ItzEmerald da7b6d487c 7.6-Pre1
Whats New?
  - Ability to add as many departments as you need (Don't go to crazy 😂 )
  - Merged Sypher's Translate & UserInfo Addon into Features

------------

  - Add a role automatically when a user joins the server
  - Announce a welcome message with full cusomtization
  - Announce a leave message with full cusomtization
  - Added "ephermal" to majority messages.

Install modules use - npm install
2022-06-16 02:31:58 +01:00
Xiled Emerald 6bf4e5f4bb Update README.md 2022-06-14 23:02:12 +01:00
Xiled Emerald 213f532a3c Merge pull request #114 from Emerald-Services/dev
7.5 push
2022-02-27 04:37:24 +00:00
ItzEmerald 45bd88e4d2 7.5 commit 2022-02-27 04:30:15 +00:00
Xiled Emerald 4eb8658459 Update supportbot.yml 2022-02-27 00:39:36 +00:00
Noah b37118fee2 Fix addon handler 2022-02-25 21:57:54 -06:00
Noah 026caba68a Fix setFooters 2022-02-25 21:55:33 -06:00
Noah 2003f8801a Fixed ticket perms 2022-02-25 21:51:22 -06:00
Noah 473bacf13a Removed Guild 2022-02-17 19:57:37 -06:00
Noah 8b3f2bc61a Fix missing user or subuser 2022-02-17 19:57:11 -06:00
Noah 3aa373c33c fix bad code 2022-02-11 23:47:06 -06:00
Noah 9b6263e583 Fix DM help menu 2022-02-11 23:41:02 -06:00
Noah 3e066d08ce New Departments 2022-02-11 23:34:38 -06:00
Noah aa48e28162 Fix Typos 2022-02-04 20:00:31 -06:00
Noah dc660ed94a Bug Fixes 2022-02-04 17:56:11 -06:00
Noah e02ecf9553 Bug fixes 2022-02-04 17:55:02 -06:00
Noah 23acc0926f Fix BitField Error 2022-02-04 17:49:02 -06:00
Xiled Emerald 3fc1cd18d5 Merge pull request #109 from Emerald-Services/dev
7.4.2 Pull Request
2022-02-03 17:26:54 +00:00
Noah ebe29b403e Prettier 2022-01-30 00:07:04 -06:00
Noah dcba3312dd Misc 2022-01-29 23:57:10 -06:00
Noah 7fddeeec37 Change Max to 100 2022-01-10 17:48:31 -06:00
Noah b5341b023f Fix embed command 2021-12-29 10:20:29 -06:00
Noah bbb7443ef2 Fix suggest command 2021-12-28 19:06:35 -06:00
Noah 22df347bb9 Merge pull request #108 from astranger1k/dev
Updated Documentation URLs + Added invite URL to log upon launch.
2021-12-23 09:18:47 -06:00
Kieran Davies 9aed6b8f35 Updated Documentation URLs + Added invite URL to log upon launch. 2021-12-23 11:48:51 +00:00
Noah 9e7ec9f1bd 7.4.2 2021-12-19 13:06:32 -06:00
Noah 373f43eac5 Channel can now be id or name 2021-12-19 13:03:33 -06:00
Noah 6c91b2791a Fix users can't send messages 2021-12-19 13:02:43 -06:00
Noah bde62a431f Merge branch 'dev' into release 2021-12-18 22:59:41 -06:00
Noah 615a074540 move filter 2021-12-18 22:59:05 -06:00
Noah 09b335ac46 Update ticket.js 2021-12-18 22:42:51 -06:00
Noah 2701880c77 Merge pull request #106 from Emerald-Services/dev
v7.4.1 Release
2021-12-18 22:37:29 -06:00
Noah 24c8f2fb38 v7.4.1 2021-12-18 22:28:08 -06:00
Noah c3ec158ac3 Fix id 2021-12-18 22:23:18 -06:00
Noah b3690222d0 Fixed id 2021-12-18 22:18:05 -06:00
Noah 4d7583785b Fixed ticket id 2021-12-18 22:14:11 -06:00
Noah 17ad1a15db Delete .DS_Store 2021-12-18 21:32:21 -06:00
Noah 4c89de9e76 Merge pull request #103 from Emerald-Services/dev
v7.4 Release
2021-12-18 21:31:56 -06:00
Noah 5f25af41f9 Merge branch 'release' into dev 2021-12-18 21:30:53 -06:00
Noah 3a3ee357fc Update packages 2021-12-18 21:17:06 -06:00
Noah 08a6d27903 Change to ephemeral 2021-12-18 20:56:30 -06:00
Noah 33f7675aac Added Max Ticket Count + Timeout 2021-12-18 20:54:01 -06:00
Noah 1178a0a611 Add StaffOnly close option 2021-12-18 19:39:59 -06:00
Noah 96ded77bec Fixed perms bug 2021-12-18 19:24:39 -06:00
Noah e83ca8cb2b add guild 2021-12-18 18:58:02 -06:00
Noah e507176d39 New addon handler 2021-12-18 18:57:45 -06:00
Noah 4e554b8bee rename slashCommandOptions to options, and permission to permissions 2021-12-18 18:57:26 -06:00
Noah bc649caa99 remove unused code 2021-12-18 18:56:25 -06:00
Noah f7a4c7b616 rename var + remove unused code 2021-12-18 18:56:02 -06:00
Noah 2c7be5882c Added getRole, getChannel, getCategory functions 2021-12-15 00:19:40 -06:00
Noah 6107d268f7 Fixed close + Send transcript to subusers 2021-12-14 18:04:38 -06:00
Noah 7760699155 Update node.js.yml 2021-12-04 21:30:48 -06:00
Noah acf349c72e Fix test mode 2021-12-04 21:26:55 -06:00
Noah 8096e5b882 Add npm test 2021-12-04 21:25:02 -06:00
Noah 873cfc7dc2 Merge branch 'dev' of https://github.com/Emerald-Services/SupportBot into dev 2021-12-04 21:22:10 -06:00
Noah 038174bc7e temp 2021-12-04 21:22:08 -06:00
Noah 14881096bb Update node.js.yml 2021-12-04 21:22:07 -06:00
Noah ed1905d8f4 Added test mode 2021-12-04 21:19:51 -06:00
Noah 72c0a2efa3 Update node.js.yml 2021-12-04 21:07:27 -06:00
Noah e599d48713 Update node.js.yml 2021-12-04 21:05:36 -06:00
Noah 7f44634d4f Delete prettier.yml 2021-12-04 21:04:47 -06:00
Noah 44170caac6 Update supportbot.yml 2021-12-04 21:01:34 -06:00
Noah adedfadd92 Prettier 2021-12-04 20:58:19 -06:00
Noah 6b01d0c8fe Possibly fix /close? 2021-12-04 20:57:23 -06:00
Noah d4d96f59ab Update 2021-12-04 20:25:49 -06:00
Noah a1bf7ed6bd Fix syntax 2021-12-04 20:25:35 -06:00
Noah 306e20efc9 Merge pull request #99 from DarkerInker/patch-1
wrong way to send embeds
2021-12-04 20:21:07 -06:00
Noah f593f6e0a8 Update close.js 2021-12-04 20:20:55 -06:00
DarkerInker 74646a4318 wrong way to send embeds
You are using the old way to send embeds. I'm not sure how you forgot about this one area but everyone makes mistakes :D
2021-12-02 13:52:07 -06:00
Noah 8bfcba8832 Merge pull request #97 from SypherRed/dev
fixed help command
2021-11-28 23:35:31 -06:00
SypherRed 4ba5621a4d Merge branch 'dev' into dev 2021-11-28 14:55:48 +01:00
N0ahMC 1f928324c2 Prettified Code! 2021-11-26 19:18:15 +00:00
Noah 3771872cd2 Update prettier.yml 2021-11-26 13:17:57 -06:00
Noah f359a60343 Update node.js.yml 2021-11-26 13:16:15 -06:00
Noah f53afd7bc9 Create prettier.yml 2021-11-26 13:13:15 -06:00
Noah e7dcc2ab29 Update help.js 2021-11-26 12:56:21 -06:00
SypherRed 0118b9e591 fixed help command 2021-11-25 01:51:56 +01:00
Noah ffe42f9777 Update ticket.js 2021-11-24 18:14:07 -06:00
Noah 5a467599e9 Update hello.js 2021-11-24 00:15:16 -06:00
Noah c56e78484a Update dependencies 2021-11-23 20:29:22 -06:00
Noah 1ee0d4a09e Update close.js 2021-11-23 18:09:06 -06:00
Noah ffdce5820b Fix close button 2021-11-23 18:08:45 -06:00
Noah 9fed504f37 Fixed /close 2021-11-23 17:37:25 -06:00
Noah 6c5799be0d Fix ID 2021-11-23 17:32:57 -06:00
Noah b6747a0340 Made warning ephemeral 2021-11-23 16:51:28 -06:00
Noah cd6df02e30 Changed TicketLog_Title 2021-11-23 15:50:56 -06:00
Noah edbef6a36f Fixed close command 2021-11-23 15:49:37 -06:00
Noah b6a0016f5f Changed TicketData Structure 2021-11-23 15:48:45 -06:00
Noah e740c17837 Update package-lock.json 2021-11-21 18:42:24 -06:00
Noah 7eb949f109 Better finds 2021-11-21 18:42:18 -06:00
Noah 02394e310d Exit if joins or leaves guild 2021-11-17 19:04:38 -06:00
Noah ef83832819 Added missing role and channel check 2021-11-17 19:04:20 -06:00
Noah a82101ab30 Register commands in Guild 2021-11-17 19:03:35 -06:00
Noah 007c78930e Added Guild to config 2021-11-17 19:03:11 -06:00
Noah 300c83512c Fixed token, and changed version for future 2021-11-11 17:18:30 -06:00
Noah b674872c56 Fixed Archive Bug 2021-11-10 21:41:12 -06:00
Noah 12a7680275 Fix spelling 2021-11-10 21:23:07 -06:00
Noah c9cf7c942b Prettier 2021-11-10 21:22:08 -06:00
Noah 8e0326c8f8 Removed HelpMenu 2021-11-10 21:21:50 -06:00
Noah 13972119a8 Update package-lock.json 2021-11-10 21:21:05 -06:00
Noah acf165a119 Add Button Emoji 2021-11-10 21:18:49 -06:00
Xiled Emerald bdff7c6069 Update supportbot.yml 2021-11-07 21:39:53 +00:00
Xiled Emerald e2e3376c87 Merge pull request #91 from Emerald-Services/dev
Dev
2021-10-29 23:38:32 +01:00
Xiled Emerald 3c613088e5 Delete supportbot.yml 2021-10-29 23:38:18 +01:00
Xiled Emerald 7e9ece50a0 Update issue templates 2021-10-29 22:40:12 +01:00
Xiled Emerald af81b6536a Update issue templates 2021-10-29 22:38:13 +01:00
ItzEmerald 4cd3ecf81f 7.3 2021-10-29 19:12:11 +01:00
Noah 31f6b9e08e Fix suggestions 2021-10-28 19:08:06 -05:00
Noah 02de920cb3 Update package.json 2021-10-28 18:39:06 -05:00
Noah 84c0905297 Update version numbers 2021-10-28 18:07:43 -05:00
Noah 250583f859 Delete commands directory 2021-10-28 18:04:26 -05:00
Noah ee7d42196d Create remove.js 2021-10-28 18:03:51 -05:00
Noah a397de2b9f Create close.js 2021-10-28 18:03:27 -05:00
Noah 0610df9400 Create add.js 2021-10-28 18:03:06 -05:00
Noah ed583deb31 Updated css 2021-10-27 20:44:10 -05:00
Noah e039048fc6 Updated role defaults 2021-10-27 20:24:26 -05:00
Noah f2ea9650c4 Renamed file 2021-10-27 20:24:10 -05:00
Noah 1e89057006 Added font 2021-10-27 20:19:33 -05:00
Noah 019bb4842f Fixed bug 2021-10-27 20:19:27 -05:00
Noah 4cb45beded Fixed bug 2021-10-27 20:18:06 -05:00
Noah 8a2059f087 Fixed suggest command bug 2021-10-27 20:05:45 -05:00
Noah a6b105a2e1 Updated config defaults 2021-10-27 19:48:00 -05:00
Noah 6c14a6a06c Rename 2021-10-27 19:39:07 -05:00
Noah cddd5d0026 Moved configs from Data to Configs 2021-10-27 19:30:10 -05:00
Noah 78dea91e1d Prettier 2021-10-27 19:20:10 -05:00
Xiled Emerald 3df591ec52 Update supportbot.yml 2021-10-25 23:19:07 +01:00
Xiled Emerald 1c4032caa6 Create suggest.js 2021-10-25 23:18:28 +01:00
Noah 465c422171 Update README.md 2021-10-25 00:16:00 -05:00
Noah 284e8dc6f5 Fixed spelling 2021-10-25 00:15:54 -05:00
Noah 3fc905c82e Update supportbot.yml 2021-10-25 00:03:28 -05:00
Noah 55a42b88ae Ran prettier 2021-10-25 00:02:23 -05:00
Noah bd26162e4a Fixed bug 2021-10-25 00:02:17 -05:00
Xiled Emerald 62e7e33406 Update Client.js 2021-10-25 00:13:27 +01:00
Xiled Emerald 2f0ddcec3f Merge pull request #77 from 1tzemerald/SupportBot-BETA
SupportBot 7.1 merge to main branch
2021-10-24 22:56:37 +01:00
Xiled Emerald 7cdfa68e0e Delete supportbot-config.yml 2021-10-24 22:56:14 +01:00
Xiled Emerald f8939a964d Delete .DS_Store 2021-10-24 22:54:15 +01:00
Xiled Emerald 7830e5dda5 Add files via upload 2021-10-24 22:48:25 +01:00
Xiled Emerald 6aa2f22294 Create ready.js 2021-10-24 22:47:42 +01:00
Xiled Emerald 50b14e3d44 Add files via upload 2021-10-24 22:46:36 +01:00
Xiled Emerald e09c2192c2 Delete events directory 2021-10-24 22:45:44 +01:00
Xiled Emerald b725d2cc62 Delete messageReactionAdd.js 2021-10-24 22:44:51 +01:00
Xiled Emerald abf3f617a4 Delete ticket.js 2021-10-24 22:44:29 +01:00
Xiled Emerald 1eda7e66fe Delete ping.js 2021-10-24 22:44:11 +01:00
ItzEmerald b5000531c4 Merge branch 'SupportBot-BETA' of https://github.com/1tzemerald/SupportBot into SupportBot-BETA 2021-10-24 22:42:49 +01:00
ItzEmerald d4f95e752b SupportBot-7.2-Release 2021-10-24 22:41:46 +01:00
Noah e31c611f70 Removed prefix 2021-10-23 20:17:58 -05:00
Noah 085481bee6 Spelling Mistakes 2021-10-23 20:15:07 -05:00
Noah cf610fbe49 Ran prettier 2021-10-23 20:12:04 -05:00
Noah b681eb3cd2 Create .gitignore 2021-10-23 20:10:49 -05:00
Noah f8ffdf0e81 Delete node_modules 2021-10-23 20:10:16 -05:00
Noah ba38bce1da Updated structures 2021-10-23 20:09:15 -05:00
Noah 3a39b05fe4 Updated packages 2021-10-23 20:08:55 -05:00
Noah 27d2982b28 Removed text commands 2021-10-23 20:07:37 -05:00
Noah 33e4d97be5 Updated for slash commands 2021-10-23 20:04:02 -05:00
Xiled Emerald 654064d7c5 Create messageReactionAdd.js 2021-10-23 22:44:59 +01:00
Noah aeb0da9e0d Removed console.log 2021-10-23 16:26:07 -05:00
Noah cb1a2fe067 Fixed Slash commands 2021-10-23 16:23:02 -05:00
ItzEmerald 85667ddfad 7.2 pre-3 2021-10-21 19:28:23 +01:00
Alexersion 7ad5016966 Unneeded workspace updates removed. 2021-10-13 11:12:08 -04:00
ItzEmerald 45c3315fd0 Update .DS_Store 2021-10-07 20:46:20 +01:00
ItzEmerald c5f550dd00 Pre-2 2021-10-07 20:46:18 +01:00
ItzEmerald 37c870c7ab SupportBot Pre-7.2
SupportBot Build for DiscordJS 13
2021-10-04 20:41:05 +01:00
Xiled Emerald 155b768f73 Update supportbot-config.yml 2021-10-04 13:56:30 +01:00
ItzEmerald 09f0873f27 SupportBot 7.3 2021-10-04 13:54:30 +01:00
ItzEmerald 19a12f6c8f SupportBot 7.2 2021-09-11 15:29:21 +01:00
Xiled Emerald 79a498d1d6 Update transcript.js 2021-08-07 16:19:13 +01:00
ItzEmerald 12a03c36f3 SupportBot 7.1 Release
Features all-new ticket system with new reaction technology enabling you to delete & lock tickets with one-click!
2021-08-06 16:34:15 +01:00
ItzEmerald ddc8bcab9b Pre-2 2021-08-05 13:40:19 +01:00
ItzEmerald 35dacfd48a Merge branch 'master' of https://github.com/1tzemerald/SupportBot 2021-08-05 13:39:48 +01:00
ItzEmerald 611cef34ab 7.1-Pre-2 2021-08-05 13:39:44 +01:00
Xiled Emerald 8a8f9fe890 Update SupportTickets.json 2021-08-05 01:07:16 +01:00
Xiled Emerald 5a65b70c80 Update ticketreaction.yml 2021-08-05 01:07:04 +01:00
Xiled Emerald 8bea3faa1f Update TicketID.json 2021-08-05 01:06:53 +01:00
ItzEmerald 4125954d53 7.1 Pre-1
Revamp of ticket system
2021-08-05 01:03:58 +01:00
Xiled Emerald 3d9c5a729e Create SupportBot_ENG.yml 2021-08-01 16:21:47 +01:00
Xiled Emerald 51d775ea6d Delete supportbot-config_GER.yml 2021-08-01 16:20:25 +01:00
Xiled Emerald e461c47c4b Delete supportbot-config_FR.yml 2021-08-01 16:20:19 +01:00
Xiled Emerald bbdb38e45a Delete supportbot-config_ES.yml 2021-07-31 15:33:37 +01:00
Xiled Emerald 083e047aec Delete supportbot-config_ENG.yml 2021-07-31 15:33:30 +01:00
Xiled Emerald 84e0b504ab Delete .DS_Store 2021-06-30 21:33:35 +01:00
Xiled Emerald bedff6832c Update supportbot-config.yml 2021-06-30 21:33:16 +01:00
ItzEmerald 6c29e04de2 7.0 2021-06-30 21:30:41 +01:00
ItzEmerald ba674323e1 Update help.js 2021-06-15 21:05:38 +01:00
ItzEmerald 6d756a161e Update help.js 2021-06-15 21:04:32 +01:00
ItzEmerald 66a5cd95ec Update README.md 2021-06-15 19:56:39 +01:00
ItzEmerald 9f70648264 Update suggest.js 2021-06-15 19:10:17 +01:00
ItzEmerald b975b79691 Update removeUser.js 2021-06-15 19:10:07 +01:00
ItzEmerald 3cab896954 Update purge.js 2021-06-15 19:09:58 +01:00
ItzEmerald b9680e5b35 Update ping.js 2021-06-15 19:09:46 +01:00
ItzEmerald 43a003ca7d Update newticket.js 2021-06-15 19:09:35 +01:00
ItzEmerald fbe1cf2009 Update links.js 2021-06-15 19:09:23 +01:00
ItzEmerald fdee61cc11 Update kick.js 2021-06-15 19:09:06 +01:00
ItzEmerald 8b51200d9c Update help.js 2021-06-15 19:08:56 +01:00
ItzEmerald 0631ab536a Update close.js 2021-06-15 19:08:46 +01:00
ItzEmerald 0d76e76519 Update botSay.js 2021-06-15 19:07:42 +01:00
ItzEmerald 9e9f83d211 Update blacklistUser.js 2021-06-15 19:07:26 +01:00
ItzEmerald 0829d477d9 Update ban.js 2021-06-15 19:07:10 +01:00
ItzEmerald 1b7109fa23 Update announce.js 2021-06-15 19:06:58 +01:00
ItzEmerald 366669ccd8 Update addUser.js 2021-06-15 19:06:40 +01:00
ItzEmerald e05edd89fa Update ready.js 2021-06-15 18:09:24 +01:00
ItzEmerald a405df66c9 Update message.js 2021-06-15 18:09:06 +01:00
ItzEmerald 28a57ead9f Update index.js 2021-06-15 18:08:32 +01:00
ItzEmerald 72bfacae75 Merge pull request #68 from DuAnti7423/master
Boolean Changes, help menu fix, raw Event, ID Support added
2021-05-24 12:48:25 +01:00
DuAnti7423 10f8821b3b Random Stuff
idk why github thinks i changed something
2021-05-23 10:45:00 +02:00
DuAnti7423 92a3745ce1 Update supportbot-config.yml
Added HelpMenu_WithKey Option.
Boolean Changes
2021-05-23 10:44:00 +02:00
DuAnti7423 aff7ff1451 Update ready.js
ID Support, Boolean Changes
2021-05-23 10:41:15 +02:00
DuAnti7423 9e63e0ff09 Create raw.js
Added Raw-Event, probably fixxed the ticketreaction isnt 100% workin
2021-05-23 10:41:05 +02:00
DuAnti7423 2c5ebd8620 Update messageReactionAdd.js
ID Support, Boolean Changes
2021-05-23 10:40:37 +02:00
DuAnti7423 e6d63db3a9 Update guildMemberRemove.js
ID Support, Boolean Changes
2021-05-23 10:40:32 +02:00
DuAnti7423 2cc316aafb Update guildMemberAdd.js
ID Support, Boolean Changes
2021-05-23 10:40:28 +02:00
DuAnti7423 4f25cfa0dd Update suggest.js
ID Support, Boolean Changes
2021-05-23 10:40:20 +02:00
DuAnti7423 0385de3882 Update removeUser.js
ID Support, Boolean Changes
2021-05-23 10:40:16 +02:00
DuAnti7423 2e1253c54e Update purge.js
ID Support, Boolean Changes
2021-05-23 10:40:10 +02:00
DuAnti7423 14df15caeb Update ping.js
ID Support, Boolean Changes
2021-05-23 10:40:03 +02:00
DuAnti7423 af481a2ec8 Update newticket.js
ID Support, Boolean Changes

Fixxed everyone permissions on ticket creation
2021-05-23 10:39:58 +02:00
DuAnti7423 96c1d80844 Update links.js
ID Support, Boolean Changes
2021-05-23 10:39:42 +02:00
DuAnti7423 57ea2e25bd Update kick.js
ID Support, Boolean Changes
2021-05-23 10:39:36 +02:00
DuAnti7423 cd17b0a6d7 Update help.js
ID Support, Boolean Changes
2021-05-23 10:39:31 +02:00
DuAnti7423 c5dd8823f6 Update close.js
ID Support, Boolean Changes
2021-05-23 10:39:24 +02:00
DuAnti7423 c27f16f753 Update botSay.js
ID Support, Boolean Changes
2021-05-23 10:39:18 +02:00
DuAnti7423 4842610229 Update blacklistUser.js
ID Support, Boolean Changes
2021-05-23 10:39:13 +02:00
DuAnti7423 bd33669dba Update ban.js
ID Support, Boolean Changes
2021-05-23 10:39:08 +02:00
DuAnti7423 e81684d322 Update announce.js
ID Support, Boolean Changes
2021-05-23 10:39:03 +02:00
DuAnti7423 8209dfa26c Update addUser.js
ID Support, Boolean Changes
2021-05-23 10:38:55 +02:00
DuAnti7423 0a82c62a4e boolean changes
workin on suggestion #67  from pat2381
2021-05-22 23:41:39 +02:00
DuAnti7423 4399dfe6b8 Fixxed a copy error
replaced reactionUser with user cause reactionUser was defined in the ticket command
2021-05-22 23:38:32 +02:00
DuAnti7423 defd0cc78c Merge branch 'master' of https://github.com/DuAnti7423/SupportBot 2021-05-22 23:13:25 +02:00
DuAnti7423 fd5fc8294c update help.js
Fixxed a bug with staffcommands show
2021-05-22 23:13:16 +02:00
ItzEmerald 10823b416c Update package.json 2021-05-14 15:46:23 +01:00
ItzEmerald 4490920ac6 Update index.js 2021-05-14 15:46:08 +01:00
ItzEmerald e0b8ad4a32 Update supportbot-config.yml 2021-05-14 15:45:49 +01:00
ItzEmerald e11063832b Merge pull request #65 from DuAnti7423/master
Blacklist Command
2021-05-12 15:35:56 +01:00
DuAnti7423 d598fdd753 updated help.js 2021-05-09 00:25:30 +02:00
DuAnti7423 157b93239a Added Logging to Blacklist 2021-05-08 23:55:57 +02:00
DuAnti7423 3d7058dccd Merge branch 'master' of https://github.com/DuAnti7423/SupportBot 2021-05-08 23:44:12 +02:00
DuAnti7423 1ec654d1ea Blacklist Command
Added Blacklist Command
Added configoption
2021-05-08 23:42:35 +02:00
ItzEmerald 8ce2d4269d Merge pull request #62 from DuAnti7423/master
Blacklist Role
2021-05-07 15:09:46 +01:00
DuAnti7423 49e8aa7869 Blacklist Role
Added Blacklist Role, via ID or Name
2021-04-17 22:15:59 +02:00
ItzEmerald 0827f55d43 Update guildMemberAdd.js 2021-03-31 01:21:34 +01:00
ItzEmerald ba6ff8c342 Update node.js.yml 2021-03-31 00:28:35 +01:00
ItzEmerald c0b7dc2737 Create node.js.yml 2021-03-31 00:27:10 +01:00
ItzEmerald ab6abd453b Delete node_modules directory 2021-03-30 20:20:33 +01:00
ItzEmerald 77921aca75 Update ready.js 2021-03-30 20:18:37 +01:00
ItzEmerald a8f91c4814 Update messageReactionAdd.js 2021-03-30 20:12:29 +01:00
ItzEmerald 7780fa792c Updated 2021-03-27 16:58:27 +00:00
ItzEmerald 41e4c376ec Merge branch 'master' of https://github.com/1tzemerald/SupportBot 2021-03-27 16:22:37 +00:00
ItzEmerald 09aad61cfe SB-6.3-BETA 2
Added Moderation
Added Node Modules
2021-03-27 16:22:19 +00:00
ItzEmerald 31ac81428f Update ready.js 2021-03-24 20:56:57 +00:00
ItzEmerald 60daab82d2 Merge branch 'master' of https://github.com/1tzemerald/SupportBot 2021-03-24 16:26:21 +00:00
ItzEmerald e7a0544004 Added Image to ReactionPanel 2021-03-24 16:25:16 +00:00
ItzEmerald ff0364bba8 Update supportbot-config_FR.yml 2021-03-17 16:04:41 +00:00
ItzEmerald a3b64be351 Update supportbot-config_ES.yml 2021-03-17 16:03:52 +00:00
ItzEmerald eae370e346 Update README.md 2021-03-17 14:36:11 +00:00
ItzEmerald 0d86b50a83 Update supportbot-config_ENG.yml 2021-03-17 14:35:45 +00:00
ItzEmerald 543b9028a3 Update supportbot-config_ES.yml 2021-03-17 14:35:15 +00:00
ItzEmerald 867f12d11f Update supportbot-config_FR.yml 2021-03-17 14:33:13 +00:00
ItzEmerald 462781ea6a Update supportbot-config_GER.yml 2021-03-17 14:31:37 +00:00
ItzEmerald c300ab6459 Update supportbot-config.yml 2021-03-11 18:57:27 +00:00
ItzEmerald 448d8f3007 Update ready.js 2021-03-11 18:55:33 +00:00
ItzEmerald faa53b0af1 Create supportbot-config_ENG.yml 2021-03-03 19:42:29 +00:00
ItzEmerald 8e53b8d9a6 Rename supportbot-config_GN.yml to supportbot-config_GER.yml 2021-03-03 19:41:36 +00:00
ItzEmerald 5678567baa Create supportbot-config_GN.yml 2021-03-03 19:37:39 +00:00
ItzEmerald 1c30f73bb1 Create supportbot-config_FR.yml 2021-03-03 18:36:02 +00:00
ItzEmerald bd3dbc3033 Rename supportbot-config.y_ES.yml to supportbot-config_ES.yml 2021-03-03 00:39:41 +00:00
ItzEmerald 3c312ab8d3 Create supportbot-config.y_ES.yml
Spanish
2021-03-03 00:39:20 +00:00
ItzEmerald 7284785db0 Delete eyeroe.md 2021-02-13 16:25:53 +00:00
ItzEmerald 4e543ea490 Update messageReactionAdd.js 2021-02-13 16:25:28 +00:00
ItzEmerald 4d3540126f Update eyeroe.md 2021-02-08 15:34:02 +00:00
ItzEmerald 6c29f0d792 Create eyeroe.md 2021-02-08 15:33:44 +00:00
wxip c85df7c40f Update ready.js 2021-02-05 21:39:16 +02:00
wxip 4f6ff575ce Quick Fix
Hopefully fixes `INVALID_TYPE` error on GuildMemberAdd event.
2021-02-05 21:26:21 +02:00
ItzEmerald aaf3890f71 Update guildMemberAdd.js 2021-02-05 16:15:51 +00:00
ItzEmerald 4f9837d991 Merge branch 'master' of https://github.com/1tzemerald/SupportBot 2021-02-04 12:54:29 +00:00
ItzEmerald 2e2eb008c6 Language PRE-01 2021-02-04 12:54:19 +00:00
ItzEmerald fa7074bb59 Update messageReactionAdd.js 2021-02-02 17:56:13 +00:00
ItzEmerald 18a7def050 Delete package-lock.json 2021-02-02 17:55:00 +00:00
ItzEmerald 40e9cf5fe5 Update messageReactionAdd.js 2021-02-02 17:52:07 +00:00
ItzEmerald 6ce049a57e Update supportbot-config.yml 2021-02-02 17:26:31 +00:00
ItzEmerald d4c4eac710 Merge branch 'master' of https://github.com/1tzemerald/SupportBot 2021-02-02 17:15:36 +00:00
ItzEmerald 28ec96e5e8 SB-6.1-PRE 2021-02-02 17:15:24 +00:00
ItzEmerald a20fe8eb06 Update ticketreaction.yml 2021-02-02 17:02:35 +00:00
ItzEmerald 7d1d9b881d Merge branch 'master' of https://github.com/1tzemerald/SupportBot 2021-02-02 17:02:03 +00:00
ItzEmerald c116e6cbb0 SB-6.1-PRE 2021-02-02 17:01:58 +00:00
ItzEmerald a3ebf0a33b Delete .DS_Store 2021-02-02 16:19:13 +00:00
ItzEmerald ea6ef022e7 Delete .DS_Store 2021-02-02 16:19:02 +00:00
ItzEmerald 683e29196a Update README.md 2021-02-02 16:18:34 +00:00
ItzEmerald 71694d7082 Update README.md 2021-02-02 16:18:14 +00:00
ItzEmerald c5d5656fb6 Update supportbot-config.yml 2021-02-02 16:09:23 +00:00
ItzEmerald b1fdbee5f8 Merge branch 'master' of https://github.com/1tzemerald/SupportBot 2021-02-02 16:08:10 +00:00
ItzEmerald 70405a1cd0 SB-6.1-PRE
Ticket Reaction Create
2021-02-02 16:07:28 +00:00
ItzEmerald 3d7e81169f Delete node_modules directory 2021-02-02 15:54:24 +00:00
ItzEmerald fa7c8c7219 Update supportbot-config.yml 2021-02-02 13:51:48 +00:00
ItzEmerald 358a25f522 SB-6.1-PRE 2021-02-02 13:50:53 +00:00
ItzEmerald 690169a409 Update LICENSE 2021-02-02 09:44:58 +00:00
ItzEmerald 0ec4cc5a51 Merge pull request #49 from 1tzemerald/add-license-1
Create LICENSE
2021-02-02 00:27:27 +00:00
ItzEmerald 0b7dbaf368 Create LICENSE 2021-02-02 00:27:04 +00:00
ItzEmerald 940c445182 Delete LICENSE 2021-02-01 23:19:47 +00:00
ItzEmerald d8a90c9aa5 Update LICENSE 2021-01-28 14:41:17 +00:00
ItzEmerald 89ee8fceca Merge pull request #47 from 1tzemerald/SupportBot
Support bot
2020-12-30 18:59:41 +00:00
ItzEmerald 68b55a2d33 Delete jo 2020-12-30 18:59:23 +00:00
ItzEmerald 8cc2e7747f Delete supportbot-crowdin.yml 2020-12-30 18:59:11 +00:00
ItzEmerald 4e6ac3a294 Update Crowdin configuration file 2020-12-30 18:57:19 +00:00
ItzEmerald 732e22ea7b Create jo 2020-12-30 18:55:57 +00:00
ItzEmerald ac0d9981f8 Delete supportbot-crowdin.yml 2020-12-30 18:49:11 +00:00
ItzEmerald 23f7310760 Create supportbot-crowdin.yml 2020-12-30 18:48:56 +00:00
ItzEmerald 02a9ce6bac Update messageReactionAdd.js 2020-12-24 16:35:33 +00:00
ItzEmerald 069665358f Update README.md 2020-12-24 15:32:42 +00:00
ItzEmerald 2cf6d69127 Merge branch 'master' of https://github.com/1tzemerald/SupportBot 2020-12-24 15:19:50 +00:00
ItzEmerald 870435061d Updated 2020-12-24 15:19:02 +00:00
Kieran Davies 53ad906491 Create .gitignore 2020-12-18 14:26:16 +00:00
Kieran Davies 01399e343b Update messageReactionAdd.js 2020-12-18 13:59:36 +00:00
Kieran Davies a0bdec4c42 Update messageReactionAdd.js 2020-12-18 13:51:51 +00:00
Kieran Davies 914f2057d8 Update messageReactionAdd.js 2020-12-18 13:51:03 +00:00
Kieran Davies ed9b9dca79 Update messageReactionAdd.js 2020-12-18 13:46:16 +00:00
ItzEmerald f6d4383ff6 6.1 PRE-0.2 2020-12-18 13:37:56 +00:00
ItzEmerald b6ccf30ae4 Update supportbot-config.yml 2020-12-11 22:12:21 +00:00
ItzEmerald 48e44a0d38 Update supportbot-config.yml 2020-12-11 22:12:02 +00:00
ItzEmerald 735998b48c Delete messageReactionRemove.js 2020-12-11 22:11:25 +00:00
ItzEmerald d94eefddb7 Delete messageReactionAdd.js 2020-12-11 22:11:07 +00:00
ItzEmerald 5a65b4df17 Update ready.js 2020-12-11 21:45:10 +00:00
ItzEmerald 15a839a310 Update message.js 2020-12-11 21:44:56 +00:00
ItzEmerald 9730c61962 Update guildMemberRemove.js 2020-12-11 21:44:31 +00:00
ItzEmerald 1805c041a6 Update guildMemberRemove.js 2020-12-11 21:44:20 +00:00
ItzEmerald f0bde93d5f Update guildMemberAdd.js 2020-12-11 21:43:58 +00:00
ItzEmerald 1ed7412f92 Update index.js 2020-12-11 21:43:36 +00:00
ItzEmerald 1f5ea2d25b Update suggest.js 2020-12-11 21:42:34 +00:00
ItzEmerald ff4c8f0e85 Update removeUser.js 2020-12-11 21:42:20 +00:00
ItzEmerald 5c3dd878b8 Update ping.js 2020-12-11 21:42:04 +00:00
ItzEmerald 20f0d91c75 Update newticket.js 2020-12-11 21:41:36 +00:00
ItzEmerald 894e48756f Update links.js 2020-12-11 21:41:13 +00:00
ItzEmerald aef199b292 Update help.js 2020-12-11 21:39:23 +00:00
ItzEmerald 9b884cd941 Update close.js 2020-12-11 21:39:09 +00:00
ItzEmerald b22d813cee Update botSay.js 2020-12-11 21:38:45 +00:00
ItzEmerald 0981566cbe Update announce.js 2020-12-11 21:38:31 +00:00
ItzEmerald 0647aa435a Update addUser.js 2020-12-11 21:38:13 +00:00
ItzEmerald 58179f98e9 Update index.js 2020-12-11 13:45:00 +00:00
ItzEmerald 05fe62536b Update supportbot-config.yml 2020-12-11 13:44:46 +00:00
ItzEmerald 241d41e220 Update supportbot-config.yml 2020-12-11 13:43:53 +00:00
ItzEmerald 34d6134c24 Update supportbot-config.yml 2020-12-11 13:43:17 +00:00
ItzEmerald 702d1d1998 Add files via upload 2020-12-11 13:42:27 +00:00
ItzEmerald e43a5fd5a3 Delete unhandledRejection.js 2020-12-10 11:34:01 +00:00
ItzEmerald 4ed9a7b7f5 Create README.md 2020-12-10 11:33:38 +00:00
ItzEmerald d8ba76e395 Delete README.md 2020-12-10 11:32:00 +00:00
ItzEmerald 448004abca Delete SUMMARY.md 2020-12-10 11:31:50 +00:00
ItzEmerald 7b0db34fb1 Delete image.png 2020-12-10 11:30:46 +00:00
ItzEmerald a7e7d5b372 Delete mit-license.md 2020-12-10 11:30:19 +00:00
ItzEmerald 9768628e8b Delete terms-and-conditions.md 2020-12-10 11:30:10 +00:00
ItzEmerald 6c0328b2fd Delete README.md 2020-12-09 11:11:59 +00:00
ItzEmerald 6bf7d879e2 Delete hosting-provider.md 2020-12-09 11:11:50 +00:00
ItzEmerald f25490f1ad Delete ubuntu-installation.md 2020-12-09 11:11:43 +00:00
ItzEmerald 31eee78535 Delete README.md 2020-12-09 11:11:30 +00:00
ItzEmerald 4ed2aff1b7 Create unhandledRejection.js 2020-12-09 11:10:06 +00:00
ItzEmerald 6f05545be6 Delete changelog.md 2020-12-09 11:06:55 +00:00
ItzEmerald dfec8a0e4f Delete download.md 2020-12-09 11:06:33 +00:00
ItzEmerald 47b730111b Delete untitled.md 2020-12-09 11:06:26 +00:00
ItzEmerald 59ba27c36f Delete creating-your-own-addon.md 2020-12-09 11:06:17 +00:00
ItzEmerald b501164c38 Delete README.md 2020-12-09 11:06:08 +00:00
Itz Emerald 1b795087bf GitBook: [master] one page modified 2020-12-07 15:50:30 +00:00
Itz Emerald 7063edc10f GitBook: [master] one page modified 2020-12-07 15:50:11 +00:00
Itz Emerald c02abcb760 GitBook: [master] one page modified 2020-12-07 15:48:42 +00:00
Itz Emerald 2d1a20dcc6 GitBook: [master] one page modified 2020-12-07 15:48:27 +00:00
Itz Emerald 65156d4b20 GitBook: [master] 14 pages and one asset modified 2020-11-28 20:03:35 +00:00
ItzEmerald 951cedb190 Update LICENSE 2020-09-27 01:18:01 +01:00
ItzEmerald 11442f320d Update index.js 2020-09-27 01:14:37 +01:00
ItzEmerald 33df21f656 Update supportbot-config.yml 2020-09-27 01:13:56 +01:00
ItzEmerald 19ab208678 Merge pull request #40 from real2two/patch-1
Add "Delete Messages" options on the configuration file.
2020-09-27 01:06:29 +01:00
ItzEmerald 59b9651575 Merge pull request #42 from real2two/patch-3
Fix prefix on playing status.
2020-09-27 01:06:06 +01:00
ItzEmerald c1c1f1767a Merge pull request #44 from 1tzemerald/dependabot/npm_and_yarn/node-fetch-2.6.1
Bump node-fetch from 2.6.0 to 2.6.1
2020-09-27 01:05:42 +01:00
dependabot[bot] dda8a5180c Bump node-fetch from 2.6.0 to 2.6.1
Bumps [node-fetch](https://github.com/bitinn/node-fetch) from 2.6.0 to 2.6.1.
- [Release notes](https://github.com/bitinn/node-fetch/releases)
- [Changelog](https://github.com/node-fetch/node-fetch/blob/master/docs/CHANGELOG.md)
- [Commits](https://github.com/bitinn/node-fetch/compare/v2.6.0...v2.6.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-09-27 00:04:16 +00:00
ItzEmerald 34d558412f Update package.json 2020-09-27 01:02:51 +01:00
ItzEmerald be77ee1903 Update newticket.js 2020-09-27 01:00:54 +01:00
ItzEmerald fc571d6c73 Update README.md 2020-09-09 14:04:46 +01:00
Two 7ca5a97535 Update supportbot-config.yml 2020-08-02 10:25:12 -04:00
ItzEmerald 730239ba8d Merge branch 'master' of https://github.com/1tzemerald/SupportBot 2020-08-02 13:53:17 +01:00
ItzEmerald 9069e23188 GuildMemberRemove Fix 2020-08-02 13:53:14 +01:00
Two 366203fe21 Update addon-example.js 2020-07-27 10:45:25 -04:00
Two f23f15c972 Update announce.js 2020-07-27 10:44:06 -04:00
Two 8432290a70 Update botSay.js 2020-07-27 10:43:59 -04:00
Two ceddd503f8 Update close.js 2020-07-27 10:43:51 -04:00
Two 51ad35f72b Update help.js 2020-07-27 10:43:45 -04:00
Two 5631b24a14 Update links.js 2020-07-27 10:43:36 -04:00
Two f9da25643d Update newticket.js 2020-07-27 10:43:30 -04:00
Two 75bed3f5dd Update ping.js 2020-07-27 10:43:25 -04:00
Two d4576dfc21 Update removeUser.js 2020-07-27 10:43:17 -04:00
Two 31bad3c2e5 Update suggest.js 2020-07-27 10:43:11 -04:00
Two a3c0e81e04 Update addUser.js 2020-07-27 10:42:53 -04:00
Two b5cf721efb Update supportbot-config.yml 2020-07-27 10:42:39 -04:00
Two 95063398aa Update message.js 2020-07-27 10:39:25 -04:00
ItzEmerald 2da25c5566 Update README.md 2020-07-26 12:57:08 +01:00
ItzEmerald a72c1ab380 Merge pull request #39 from 1tzemerald/SupportBot-6.0
Support bot 6.0
2020-07-23 20:20:32 +01:00
ItzEmerald 87b9301e20 Update help.js 2020-07-23 20:16:32 +01:00
ItzEmerald d0a6bed727 Delete BotSay.js 2020-07-23 17:40:31 +01:00
ItzEmerald 29881fbf28 Merge branch 'SupportBot-6.0' of https://github.com/1tzemerald/SupportBot into SupportBot-6.0 2020-07-15 18:42:13 +01:00
ItzEmerald 4f05ad6546 SupportBot 6.0 BETA 1 2020-07-15 18:42:07 +01:00
doge 36fc9aae6c Update removeUser.js 2020-07-15 12:05:39 -04:00
doge fb3f87c685 Update addUser.js 2020-07-15 12:05:24 -04:00
doge a4c0eeb9b3 Update addUser.js 2020-07-15 11:57:32 -04:00
doge c64f249fd0 Update removeUser.js 2020-07-15 11:57:14 -04:00
doge 48b542293f Update addUser.js 2020-07-15 11:56:52 -04:00
doge 95e92970c9 Update removeUser.js 2020-07-15 11:44:17 -04:00
doge afdb16da07 Update addUser.js 2020-07-15 11:44:01 -04:00
doge 0a230cfab9 fix remove 2020-07-15 11:37:58 -04:00
doge c752a07ad0 fix adduser 2020-07-15 11:37:17 -04:00
ItzEmerald cc5a6b7317 Update BotSay.js 2020-07-15 02:20:05 +01:00
ItzEmerald d93991ad86 Merge branch 'SupportBot-6.0' of https://github.com/1tzemerald/SupportBot into SupportBot-6.0 2020-07-15 02:20:03 +01:00
ItzEmerald 5c98376a8c RolePerms Update 2020-07-15 02:16:15 +01:00
ItzEmerald 28699f0ff0 Updated 2020-07-14 19:42:46 +01:00
ItzEmerald e3576b17b1 Updated 2020-07-14 19:17:40 +01:00
ItzEmerald 17c49b2b03 Merge branch 'SupportBot-6.0' of https://github.com/1tzemerald/SupportBot into SupportBot-6.0 2020-07-11 13:19:19 +01:00
ItzEmerald dcc00d8d1f Update 2020-07-11 13:17:57 +01:00
ItzEmerald 05a772eee2 Create removeUser.js 2020-07-10 20:56:40 +01:00
ItzEmerald 59dd291dc6 Update addUser.js 2020-07-10 20:55:02 +01:00
ItzEmerald f0a791e354 Update README.md 2020-07-10 20:48:41 +01:00
ItzEmerald 94db6cff7b Create addUser.js 2020-07-10 18:55:03 +01:00
ItzEmerald 72a02bf6d2 Close.js updated 2020-07-04 00:54:34 +01:00
ItzEmerald cf99209887 Close Ticket 2020-06-24 09:50:14 +01:00
ItzEmerald ff7ed49905 guildMemberRemove added 2020-06-21 15:56:16 +01:00
ItzEmerald ecd17a51df guildMemberAdd Updated 2020-06-21 12:36:48 +01:00
ItzEmerald 63b08f8c12 guildMemberAdd Updated 2020-06-20 16:10:27 +01:00
ItzEmerald 3077772aff Merge branch 'SupportBot-6.0' of https://github.com/1tzemerald/SupportBot into SupportBot-6.0 2020-06-20 15:46:18 +01:00
ItzEmerald f40aa9ed14 push 2020-06-20 13:02:46 +01:00
ItzEmerald 4ae6dc3a69 Update guildMemberAdd.js 2020-06-20 00:18:17 +01:00
ItzEmerald bdb8389d8d Merge branch 'SupportBot-6.0' of https://github.com/1tzemerald/SupportBot into SupportBot-6.0 2020-06-20 00:11:02 +01:00
ItzEmerald f7254c7ec7 Push 2020-06-20 00:10:38 +01:00
ItzEmerald 3701156362 Merge pull request #35 from real2two/patch-20
Update newticket.js
2020-06-19 23:42:03 +01:00
Two 575d25f5ad Update newticket.js 2020-06-16 21:54:40 -04:00
Two 698b82c7d3 Update newticket.js 2020-06-15 21:29:31 -04:00
ItzEmerald eaa9da6d2e 6.0-Dev Edition 2020-06-15 23:58:37 +01:00
ItzEmerald ca7294a0e3 Delete supportbot-config.yml 2020-06-15 23:47:10 +01:00
ItzEmerald 5281ffce60 overwrite Permissions to updateOverwrite 2020-06-12 23:30:34 +01:00
ItzEmerald 2f84fd3b33 overwritePermissions to updateOverwrite 2020-06-12 23:30:01 +01:00
ItzEmerald bef270da74 Update LICENSE 2020-05-19 00:40:47 +01:00
ItzEmerald bdf839ffca Merge pull request #31 from 1tzemerald/add-license-1
Create LICENSE
2020-05-10 00:42:44 +01:00
ItzEmerald b1b2ead0d8 Create LICENSE 2020-05-10 00:42:31 +01:00
ItzEmerald 0b74473c64 Delete LICENSE 2020-05-10 00:40:43 +01:00
lynxgian 2fb189cf5c updated Readme.md 2020-05-07 19:32:16 -04:00
lynxgian 24a29639e9 Update README.md 2020-05-07 19:30:53 -04:00
ItzEmerald 50258dc359 Update index.js 2020-04-21 20:20:42 +01:00
ItzEmerald d9c6b7698f Update index.js 2020-04-21 19:37:28 +01:00
ItzEmerald f042f34ae2 Update index.js 2020-04-21 19:24:15 +01:00
ItzEmerald c087edc14f Update suggest.js 2020-04-18 22:49:03 +01:00
ItzEmerald d96ccc3265 Update add.js 2020-04-17 02:59:25 +01:00
ItzEmerald 018ef19efd Update remove.js 2020-04-17 02:56:10 +01:00
ItzEmerald 159317a15a Update remove.js 2020-04-17 02:55:25 +01:00
ItzEmerald 34583c96bf Update add.js 2020-04-17 02:54:20 +01:00
ItzEmerald 887d3d3ab4 Update ticket.js 2020-04-17 02:48:38 +01:00
ItzEmerald f2de39de33 Updated 5.2 2020-04-16 16:43:16 +01:00
ItzEmerald 8173c31a60 Update supportbot-config.yml 2020-04-15 16:18:31 +01:00
ItzEmerald 80a2871741 Update ping.js 2020-04-15 15:08:13 +01:00
ItzEmerald 3b37e9c420 Updated say.js
Updated RichEmbed to MessageEmbed
2020-04-15 15:07:20 +01:00
ItzEmerald 730ba561bc Update index.js 2020-04-15 15:05:56 +01:00
ItzEmerald 4d7ddc9d6f Update ping.js 2020-04-14 22:45:51 +01:00
ItzEmerald 680f71a602 Merge pull request #15 from real2two/patch-14
Changed all RichEmbed to MessageEmbed.
2020-04-08 17:53:50 +01:00
ItzEmerald 170a7b50b9 Merge pull request #16 from real2two/patch-13
Changed all RichEmbed to MessageEmbed.
2020-04-08 17:53:14 +01:00
ItzEmerald 805c48c1bb Merge pull request #17 from real2two/patch-15
Changed all RichEmbed to MessageEmbed.
2020-04-08 17:53:03 +01:00
ItzEmerald 7d92ed51bb Merge pull request #18 from real2two/patch-16
Changed all RichEmbed to MessageEmbed.
2020-04-08 17:52:49 +01:00
ItzEmerald f849897f29 Merge pull request #19 from real2two/patch-10
Changed all RichEmbed to MessageEmbed.
2020-04-08 17:52:32 +01:00
ItzEmerald 75e0f1ad1e Merge pull request #20 from real2two/patch-11
Changed all RichEmbed to MessageEmbed.
2020-04-08 17:52:15 +01:00
ItzEmerald 2f015aff2b Merge pull request #21 from real2two/patch-12
Changed all RichEmbed to MessageEmbed.
2020-04-08 17:52:03 +01:00
ItzEmerald bb322adb2f Merge pull request #22 from real2two/patch-7
Changed all RichEmbed to MessageEmbed.
2020-04-08 17:51:14 +01:00
ItzEmerald 6ee0981885 Merge pull request #23 from real2two/patch-8
Changed all RichEmbed to MessageEmbed.
2020-04-08 17:51:02 +01:00
ItzEmerald 877fb0f201 Merge pull request #24 from real2two/patch-9
Changed all RichEmbed to MessageEmbed.
2020-04-08 17:50:39 +01:00
ItzEmerald ded4b9094a Merge pull request #25 from real2two/patch-4
Changed all RichEmbed to MessageEmbed.
2020-04-08 17:50:07 +01:00
ItzEmerald 36ab931998 Merge pull request #26 from real2two/patch-5
Changed all RichEmbed to MessageEmbed.
2020-04-08 17:49:54 +01:00
ItzEmerald 20baddfcca Merge pull request #27 from real2two/patch-6
Changed all RichEmbed to MessageEmbed.
2020-04-08 17:49:36 +01:00
ItzEmerald d180c147db Merge pull request #28 from real2two/patch-1
Changed all RichEmbed to MessageEmbed.
2020-04-08 17:49:20 +01:00
ItzEmerald 86fa91cc52 Merge pull request #29 from real2two/patch-2
Changed all RichEmbed to MessageEmbed.
2020-04-08 17:48:53 +01:00
ItzEmerald b8c12a0307 Merge pull request #30 from real2two/patch-3
Changed all RichEmbed to MessageEmbed.
2020-04-08 17:48:24 +01:00
Two eff2f9c195 Changed all RichEmbed to MessageEmbed.
This is order to add discord.js v12 support.
2020-04-06 18:15:27 -04:00
Two 8a8597afef Changed all RichEmbed to MessageEmbed.
This is order to add discord.js v12 support.
2020-04-06 18:15:23 -04:00
Two 067e619488 Changed all RichEmbed to MessageEmbed.
This is order to add discord.js v12 support.
2020-04-06 18:15:17 -04:00
Two f7f8bc8c55 Changed all RichEmbed to MessageEmbed.
This is order to add discord.js v12 support.
2020-04-06 18:15:07 -04:00
Two 0c71fd7e59 Changed all RichEmbed to MessageEmbed.
This is order to add discord.js v12 support.
2020-04-06 18:15:06 -04:00
Two 5b2bd21c06 Changed all RichEmbed to MessageEmbed.
This is order to add discord.js v12 support.
2020-04-06 18:14:57 -04:00
Two 9ac68f68e2 Changed all RichEmbed to MessageEmbed.
This is order to add discord.js v12 support.
2020-04-06 18:14:42 -04:00
Two aa32f00b0d Changed all RichEmbed to MessageEmbed.
This is order to add discord.js v12 support.
2020-04-06 18:14:35 -04:00
Two bd5f5dffad Changed all RichEmbed to MessageEmbed.
This is order to add discord.js v12 support.
2020-04-06 18:14:28 -04:00
Two 645ad63f4f Changed all RichEmbed to MessageEmbed.
This is order to add discord.js v12 support.
2020-04-06 18:14:23 -04:00
Two c83c6afecc Changed all RichEmbed to MessageEmbed.
This is order to add discord.js v12 support.
2020-04-06 18:14:18 -04:00
Two 689a191d4c Changed all RichEmbed to MessageEmbed.
This is order to add discord.js v12 support.
2020-04-06 18:14:10 -04:00
Two 5767ba0de5 Changed all RichEmbed to MessageEmbed.
This is order to add discord.js v12 support.
2020-04-06 18:13:57 -04:00
Two cdf78f2598 Changed all RichEmbed to MessageEmbed.
This is order to add discord.js v12 support.
2020-04-06 18:13:51 -04:00
Two d23f46ad9e Changed all RichEmbed to MessageEmbed.
This is order to add discord.js v12 support.
2020-04-06 18:11:48 -04:00
Two 8453fa5007 Changed all RichEmbed to MessageEmbed.
This is order to add discord.js v12 support.
2020-04-06 18:10:32 -04:00
ItzEmerald 0bd990a9e3 updated index.js 2020-03-31 09:57:39 +01:00
ItzEmerald 9c8ee1471b updated version number 2020-03-31 09:56:09 +01:00
ItzEmerald 87262e82a3 Update forceclose.js 2020-03-31 00:15:10 +01:00
ItzEmerald 953db88ed2 Update close.js 2020-03-31 00:14:47 +01:00
doge a44bb949eb Merge pull request #13 from 1tzemerald/version-5.2
Update README.md
2020-03-12 20:28:49 -04:00
doge 9d11369059 Update README.md 2020-03-12 20:28:02 -04:00
ItzEmerald 8c92f39349 Delete package-lock.json 2020-02-23 13:13:31 +00:00
ItzEmerald bce9d733d3 Update package.json 2020-02-23 13:13:12 +00:00
ItzEmerald 525c216401 Update suggest.js 2020-02-09 13:14:10 +00:00
ItzEmerald c145e9f11d Update README.md 2020-02-04 10:42:59 +00:00
ItzEmerald 53700003f1 Update README.md 2020-02-04 10:41:12 +00:00
ItzEmerald 03094a4c35 Update README.md 2020-02-04 10:39:09 +00:00
ItzEmerald 934ebed24f Update ticket.js 2020-02-02 12:06:04 +00:00
ItzEmerald 9f469e1637 Update supportbot-config.yml 2020-01-30 21:03:17 +00:00
ItzEmerald 77fe39774d Update close.js 2020-01-30 21:02:35 +00:00
ItzEmerald 186d688ec8 Delete setup.js 2020-01-30 20:56:37 +00:00
ItzEmerald de3181b5c7 Update tickets.json 2020-01-29 21:43:06 +00:00
ItzEmerald 6d53234f7a Update supportbot-config.yml 2020-01-29 21:42:37 +00:00
ItzEmerald b0d3673f4b Update close.js 2020-01-29 21:41:56 +00:00
ItzEmerald e40083f585 Add files via upload 2020-01-29 21:40:44 +00:00
ItzEmerald f7b702fa29 Update ticket.js 2020-01-29 20:06:28 +00:00
ItzEmerald 5089a19a56 Update TicketNumber.js 2020-01-29 20:05:34 +00:00
ItzEmerald d77e9842aa Update TicketNumber.js 2020-01-29 19:59:44 +00:00
ItzEmerald 88ae76a25a Update ticket.js 2020-01-29 19:59:14 +00:00
ItzEmerald 9b0b0d10a1 Update ticket.js 2020-01-29 19:08:00 +00:00
ItzEmerald 68340a8b02 Create tickets.json 2020-01-29 18:59:22 +00:00
ItzEmerald d14f0966d5 Update TicketNumber.js 2020-01-29 18:58:58 +00:00
ItzEmerald e4b83f28c4 Update TicketNumber.js 2020-01-29 18:57:22 +00:00
ItzEmerald 1925deec90 Create TicketNumber.js 2020-01-29 18:55:32 +00:00
ItzEmerald e9ba960b29 Delete utils 2020-01-29 18:52:23 +00:00
ItzEmerald 821f0f5b60 Create utils 2020-01-29 18:52:13 +00:00
ItzEmerald 8fa8915673 Update README.md 2020-01-29 18:34:02 +00:00
ItzEmerald 5405aa469e Update README.md 2020-01-29 18:33:42 +00:00
ItzEmerald cfa50b4e8c Update README.md 2020-01-29 18:33:17 +00:00
ItzEmerald c5014baeb4 Update README.md 2020-01-29 18:32:09 +00:00
ItzEmerald c14f120ec2 Update README.md 2020-01-29 18:27:10 +00:00
ItzEmerald b72fcf39da Update help.js 2020-01-26 23:53:53 +00:00
ItzEmerald 6da3b0cba0 Update README.md 2020-01-26 22:47:39 +00:00
ItzEmerald 752387a02d Update README.md 2020-01-26 22:47:05 +00:00
ItzEmerald 32d3e1b957 Update README.md 2020-01-26 22:46:47 +00:00
ItzEmerald a029dff202 Update README.md 2020-01-26 22:44:45 +00:00
ItzEmerald 89e1b85a56 Delete settings.json 2020-01-26 22:38:25 +00:00
ItzEmerald 4350eb709c Delete old.json 2020-01-26 22:38:13 +00:00
ItzEmerald 2b1b6e916e Updated SupportBot
Pre-Release - 5.1.0
2020-01-26 22:35:45 +00:00
ItzEmerald 3f6f9045bd Update announce.js 2020-01-25 16:59:35 +00:00
ItzEmerald 8294496faa Update add.js 2020-01-25 16:56:56 +00:00
ItzEmerald 9f58118ecd Update supportbot-config.yml 2020-01-25 16:51:30 +00:00
ItzEmerald 3ba9d42587 Delete terminal.sh 2020-01-25 14:20:08 +00:00
ItzEmerald e496a5f3d0 Delete terminal.bat 2020-01-25 14:19:45 +00:00
ItzEmerald 04e2bb29b0 Update supportbot-config.yml 2020-01-25 14:09:40 +00:00
ItzEmerald 131a7a015c Update supportbot-config.yml 2020-01-25 14:03:20 +00:00
ItzEmerald 6f430f5f14 Create supportbot-config.yml 2020-01-25 13:57:23 +00:00
ItzEmerald 0154c106ef updated index.js 2020-01-25 13:55:33 +00:00
ItzEmerald 04de6e6fc0 Update index.js 2020-01-25 13:48:02 +00:00
ItzEmerald 2b17e5f842 Update index.js 2020-01-25 13:42:44 +00:00
ItzEmerald 0dc8c1e68a updated announce.js
cleaned up the code + updated the command executed message
2020-01-25 13:37:25 +00:00
ItzEmerald 67b291eb09 Update add.js 2020-01-25 13:30:13 +00:00
ItzEmerald d7865a5a4e Update add.js 2020-01-25 13:28:01 +00:00
ItzEmerald d1809587a8 Updated add.js
Cleaned and updated the code within the file alongside the console.log for executing the command.
2020-01-25 13:20:44 +00:00
ItzEmerald 64ec4dfd53 Update LICENSE 2020-01-22 22:44:36 +00:00
ItzEmerald 6e07d21a3d Create someaddon.json 2020-01-22 22:42:10 +00:00
ItzEmerald 018e47bd53 Update default-addon.js 2020-01-22 22:41:33 +00:00
ItzEmerald 065a2e9347 Update help.js 2020-01-05 21:37:08 +00:00
ItzEmerald b53307c7fd Update ticket.js 2020-01-05 16:33:31 +00:00
ItzEmerald e4cc0d960e Update ticket.js 2020-01-05 15:33:23 +00:00
ItzEmerald 3336824df7 Update close.js 2020-01-05 15:22:50 +00:00
TommyTran732 166173d53c Update entrypoint.sh 2020-01-03 04:40:13 -05:00
TommyTran732 45da2d7924 Create entrypoint.sh 2020-01-02 11:51:19 -05:00
TommyTran732 af14a65ef5 Create Dockerfile 2020-01-02 11:50:14 -05:00
ItzEmerald 9049a4b9ad Update rename.js 2019-12-11 18:17:00 +00:00
ItzEmerald 2f4873ab9a Update settings.json 2019-12-07 13:08:34 +00:00
ItzEmerald 0fb25d71dc Update rename.js 2019-12-03 23:24:43 +00:00
ItzEmerald 34b6901434 Update remove.js 2019-12-03 23:24:22 +00:00
ItzEmerald a90b43aba3 Update add.js 2019-12-03 23:24:01 +00:00
ItzEmerald 0ac5c2c300 Update forceclose.js 2019-12-03 23:23:33 +00:00
ItzEmerald 6290fee7bd Update close.js 2019-12-03 23:22:54 +00:00
ItzEmerald 320992f3fa Update ticket.js 2019-12-03 23:17:47 +00:00
ItzEmerald bd714f0c93 Update ticket.js 2019-12-03 23:15:52 +00:00
ItzEmerald 45d3867c1f Update ticket.js 2019-12-03 23:13:56 +00:00
ItzEmerald deafa66565 Update settings.json 2019-12-03 23:13:02 +00:00
ItzEmerald ce8fcdaa7a Update settings.json 2019-12-03 23:11:58 +00:00
ItzEmerald b83965c144 Update ticket.js 2019-12-03 23:10:41 +00:00
ItzEmerald 2505a8cab8 Created MIT License 2019-12-03 21:41:34 +00:00
ItzEmerald 21e598bb31 Delete LICENSE 2019-12-03 21:39:11 +00:00
ItzEmerald ee2f3c0dfc Created GNU License 2019-12-03 21:32:00 +00:00
ItzEmerald 197bda14b8 Update rename.js 2019-11-29 22:34:57 +00:00
ItzEmerald d416c2e421 Update README.md 2019-11-18 16:12:28 +00:00
ItzEmerald 6bc2e669e4 Update README.md 2019-11-18 16:12:13 +00:00
ItzEmerald 9accb65256 Update README.md 2019-11-18 16:11:23 +00:00
ItzEmerald d9212584ca Update README.md 2019-11-18 16:10:19 +00:00
ItzEmerald 1a7effb422 Update README.md 2019-11-18 16:09:37 +00:00
ItzEmerald 1480435f15 Update index.js 2019-11-18 15:53:02 +00:00
ItzEmerald 64c6a97657 Update index.js 2019-11-18 15:49:36 +00:00
ItzEmerald 7ae2ff9837 Update settings.json 2019-11-18 15:49:21 +00:00
ItzEmerald f19dec405d Updated settings.json 2019-11-18 15:29:33 +00:00
ItzEmerald bbd4e9d162 Update ticket.js 2019-11-17 22:24:05 +00:00
ItzEmerald 58deff0869 Updated close.js
Added ticket transcripts
2019-11-17 21:27:13 +00:00
ItzEmerald 628632f43e Update forceclose.js 2019-11-15 21:54:32 +00:00
ItzEmerald 436586117c Update close.js 2019-11-15 21:53:39 +00:00
ItzEmerald 7234ec728c Update close.js 2019-11-15 20:43:29 +00:00
ItzEmerald fc4d68be39 Update forceclose.js 2019-11-15 20:31:58 +00:00
ItzEmerald bcf2df4bff Update close.js 2019-11-15 20:27:10 +00:00
ItzEmerald 70a469a951 Update settings.json
Added settings for transcripts
2019-11-15 20:25:43 +00:00
ItzEmerald 981995cb32 Merge pull request #7 from iJosGCS/patch-1
Update close.js
2019-11-15 20:00:14 +00:00
Joseph Gonzalo 406c7d368b Update close.js 2019-11-15 13:58:24 -06:00
ItzEmerald 5c266d8b8d Update README.md 2019-11-01 20:27:24 +00:00
Joseph Gonzalo 4f5b94a491 Update README.md 2019-10-17 17:08:13 -06:00
ItzEmerald 284c83cc1d Update help.js 2019-09-28 17:30:57 +01:00
RedstoneGamez 23f06af202 Update README.md 2019-09-07 14:59:59 -03:00
Emerald 82be317595 Updated ticket.js
Support v4.2
2019-08-17 00:00:48 +01:00
ItzEmerald a43c76529f Delete temp.js 2019-08-16 23:54:13 +01:00
Emerald 26065c2a5c Merge remote-tracking branch 'origin/master' 2019-08-16 23:52:15 +01:00
ItzEmerald 6b1dfe01cf 4.2 2019-08-16 23:51:18 +01:00
ItzEmerald 72443fb7c6 Update README.md 2019-08-10 11:52:08 +01:00
ItzEmerald 28cad23746 Update README.md 2019-08-10 11:51:02 +01:00
Joseph Gonzalo ebc0d4b137 Update settings.json 2019-08-04 20:44:02 -06:00
Joseph Gonzalo 4b198acda7 Update README.md 2019-08-04 20:43:22 -06:00
Joseph Gonzalo b84c3c75a5 Bug fixes 2019-08-04 20:42:35 -06:00
ItzEmerald de0ec97d9b Update 4.0.1
Bug Fixes:

Announcements displaying “undefined” above the announcement message instead of a role.

Tickets not allowing users to talk
2019-08-04 00:12:49 +01:00
75 changed files with 10683 additions and 1441 deletions

No files matched your search

-2
View File
@@ -1,2 +0,0 @@
# Auto detect text files and perform LF normalization
* text=auto
-23
View File
@@ -1,23 +0,0 @@
---
name: Bug report
about: Create a bug report to help us improve SupportBot.
title: "[BUG]"
labels: bug
assignees: EmeraldRusher
---
**Describe the bug**
A clear and concise description of the bug you found and how you found it.
**How did you find it**
Please could explain what you did to find the bug?
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Additional context**
Feel free to notify with us with anything else about the problem here.
-76
View File
@@ -1,76 +0,0 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
# nyc test coverage
.nyc_output
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules/
jspm_packages/
# TypeScript v1 declaration files
typings/
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# dotenv environment variables file
.env
# parcel-bundler cache (https://parceljs.org/)
.cache
# next.js build output
.next
# nuxt.js build output
.nuxt
# vuepress build output
.vuepress/dist
# Serverless directories
.serverless
# FuseBox cache
.fusebox/
+360
View File
@@ -0,0 +1,360 @@
const express = require('express');
const cors = require('cors');
const fs = require('fs');
const os = require('os');
const yaml = require('js-yaml');
const YAML = require('yaml');
const db = require('../Structures/Database.js');
class APIServer {
constructor(client) {
this.client = client;
this.app = express();
try {
const apiCfg = yaml.load(fs.readFileSync('./Configs/api.yml', 'utf8')).API;
this.config = apiCfg;
} catch (e) {
console.error('[API] Failed to load api.yml, defaulting to disabled.');
this.config = { Enabled: false };
}
if (!this.config.Enabled) return;
this.app.use(cors());
this.app.use(express.json());
this.app.use((req, res, next) => {
const authHeader = req.headers.authorization;
if (!authHeader || authHeader !== `Bearer ${this.config.SecretKey}`) {
return res.status(401).json({ error: 'Unauthorized. Invalid Secret Key.' });
}
next();
});
this.setupRoutes();
}
start(port) {
const listenPort = port || this.config.Port || 3000;
this.app.listen(listenPort, () => {
console.log(`[API] Server running on port ${listenPort}`);
});
}
setupRoutes() {
this.app.get('/api/stats', async (req, res) => {
try {
if (!this.client.user) {
return res.json({ success: false, error: 'Bot is still starting up.' });
}
let userCount = 0;
this.client.guilds.cache.forEach(guild => {
userCount += guild.memberCount;
});
const allTickets = db.getAllTickets() || [];
const openTickets = allTickets.filter(t => t.open).length;
const closedTickets = allTickets.filter(t => !t.open).length;
const totalMem = os.totalmem();
const freeMem = os.freemem();
const usedMem = totalMem - freeMem;
const ramPercent = Math.round((usedMem / totalMem) * 100);
const cpuLoad = os.loadavg()[0].toFixed(2);
res.json({
success: true,
data: {
bot: {
username: this.client.user.username,
id: this.client.user.id,
avatar: this.client.user.displayAvatarURL(),
version: require('../package.json').version,
ping: this.client.ws.ping,
uptime: process.uptime(),
},
servers: this.client.guilds.cache.size,
users: userCount,
tickets: {
total: allTickets.length,
open: openTickets,
closed: closedTickets
},
hosting: {
ram_used: (usedMem / 1024 / 1024 / 1024).toFixed(2) + ' GB',
ram_total: (totalMem / 1024 / 1024 / 1024).toFixed(2) + ' GB',
ram_percent: ramPercent,
cpu_load: cpuLoad,
uptime: Math.floor(os.uptime() / 86400) + ' Days'
}
}
});
} catch (err) {
console.error('[API] Error fetching stats:', err);
res.status(500).json({ success: false, error: 'Internal Server Error' });
}
});
this.app.get('/api/configs/:file', (req, res) => {
const validFiles = ['supportbot', 'ticket-panel', 'commands', 'messages', 'supportbot-ai'];
const file = req.params.file;
if (!validFiles.includes(file)) return res.status(400).json({ success: false, error: 'Invalid file' });
try {
const configData = fs.readFileSync(`./Configs/${file}.yml`, 'utf8');
res.json({ success: true, data: configData });
} catch (err) {
res.status(500).json({ success: false, error: 'Failed to read config' });
}
});
this.app.put('/api/configs/raw', (req, res) => {
const validFiles = ['supportbot', 'ticket-panel', 'commands', 'messages', 'supportbot-ai'];
const file = req.body.filename;
const content = req.body.content;
if (!validFiles.includes(file)) return res.status(400).json({ success: false, error: 'Invalid file' });
try {
fs.writeFileSync(`./Configs/${file}.yml`, content);
res.json({ success: true });
} catch (err) {
res.status(500).json({ success: false, error: 'Failed to write config' });
}
});
this.app.get('/api/configs/json/:file', (req, res) => {
const validFiles = ['supportbot', 'ticket-panel', 'commands', 'messages', 'supportbot-ai'];
const file = req.params.file;
if (!validFiles.includes(file)) return res.status(400).json({ success: false, error: 'Invalid file' });
try {
const configData = yaml.load(fs.readFileSync(`./Configs/${file}.yml`, 'utf8'));
res.json({ success: true, data: configData });
} catch (err) {
res.status(500).json({ success: false, error: 'Failed to parse config' });
}
});
this.app.post('/api/configs/update-fields/multi', (req, res) => {
const updates = req.body;
if (!updates || typeof updates !== 'object') return res.status(400).json({ success: false, error: 'Invalid updates' });
try {
for (const [keyPath, value] of Object.entries(updates)) {
const [fileName, path] = keyPath.split(':');
const fileContent = fs.readFileSync(`./Configs/${fileName}.yml`, 'utf8');
const doc = YAML.parseDocument(fileContent);
const keys = path.split('.');
doc.setIn(keys, value);
fs.writeFileSync(`./Configs/${fileName}.yml`, doc.toString());
}
res.json({ success: true });
} catch (err) {
console.error('[API] Update failed:', err);
res.status(500).json({ success: false, error: err.message });
}
});
this.app.post('/api/addons/install', async (req, res) => {
const { url, filename } = req.body;
if (!url || !filename) return res.status(400).json({ success: false, error: 'Missing url or filename' });
try {
const axios = require('axios');
const response = await axios({
method: 'get',
url: url,
responseType: 'stream'
});
// Ensure Addons directory exists
if (!fs.existsSync('./Addons')) {
fs.mkdirSync('./Addons');
}
const writer = fs.createWriteStream(`./Addons/${filename}`);
response.data.pipe(writer);
writer.on('finish', () => {
res.json({ success: true, message: `Addon ${filename} installed successfully.` });
});
writer.on('error', (err) => {
console.error('[API] Download failed:', err);
res.status(500).json({ success: false, error: 'Failed to write addon file' });
});
} catch (err) {
console.error('[API] Addon install failed:', err);
res.status(500).json({ success: false, error: 'Failed to download addon' });
}
});
this.app.post('/api/addons/push', (req, res) => {
const { filename, content } = req.body;
if (!filename || !content) return res.status(400).json({ success: false, error: 'Missing filename or content' });
const sanitizedFilename = filename.replace(/[^a-z0-9_.-]/gi, '_');
try {
if (!fs.existsSync('./Addons')) {
fs.mkdirSync('./Addons');
}
fs.writeFileSync(`./Addons/${sanitizedFilename}`, content);
res.json({ success: true, message: `Addon ${sanitizedFilename} deployed successfully.` });
} catch (err) {
console.error('[API] Push failed:', err);
res.status(500).json({ success: false, error: 'Failed to write addon file' });
}
});
// --- Nexus Updater API ---
this.app.post('/api/system/update', async (req, res) => {
const { url, version } = req.body;
if (!url) return res.status(400).json({ success: false, error: 'Missing update URL' });
try {
const axios = require('axios');
const { execSync } = require('child_process');
const path = require('path');
console.log(`[Updater] Starting update to ${version || 'latest'}...`);
// 1. Download
const tempZip = `./update_${Date.now()}.zip`;
const response = await axios({ method: 'get', url: url, responseType: 'stream' });
const writer = fs.createWriteStream(tempZip);
response.data.pipe(writer);
await new Promise((resolve, reject) => {
writer.on('finish', resolve);
writer.on('error', reject);
});
// 2. Extract to temp dir
const tempDir = `./temp_update_${Date.now()}`;
if (!fs.existsSync(tempDir)) fs.mkdirSync(tempDir);
const isWindows = process.platform === 'win32';
try {
if (isWindows) {
execSync(`powershell -Command "Expand-Archive -Path '${tempZip}' -DestinationPath '${tempDir}' -Force"`);
} else {
execSync(`unzip -o "${tempZip}" -d "${tempDir}"`);
}
} catch (e) {
throw new Error(`Extraction failed. Ensure ${isWindows ? 'PowerShell' : 'unzip'} is installed. ${e.message}`);
}
// Identify inner directory (sometimes zips contain a root folder)
let sourcePath = tempDir;
const items = fs.readdirSync(tempDir);
if (items.length === 1 && fs.statSync(path.join(tempDir, items[0])).isDirectory()) {
sourcePath = path.join(tempDir, items[0]);
}
// 3. Smart Config Merge
const configFiles = ['supportbot', 'commands', 'messages', 'ticket-panel', 'supportbot-ai'];
configFiles.forEach(cf => {
const currentPath = `./Configs/${cf}.yml`;
const newPath = path.join(sourcePath, 'Configs', `${cf}.yml`);
if (fs.existsSync(currentPath) && fs.existsSync(newPath)) {
const currentCfg = yaml.load(fs.readFileSync(currentPath, 'utf8'));
const newCfg = yaml.load(fs.readFileSync(newPath, 'utf8'));
const merge = (target, source) => {
for (const key of Object.keys(source)) {
if (source[key] instanceof Object && !Array.isArray(source[key]) && target[key]) {
merge(target[key], source[key]);
} else if (target[key] === undefined) {
target[key] = source[key];
console.log(`[Updater] Added missing key: ${key} to ${cf}.yml`);
}
}
};
merge(currentCfg, newCfg);
fs.writeFileSync(currentPath, YAML.stringify(currentCfg));
}
});
// 4. Overwrite Core Folders
const coreFolders = ['API', 'Commands', 'Events', 'Structures'];
coreFolders.forEach(folder => {
const src = path.join(sourcePath, folder);
if (fs.existsSync(src)) {
if (isWindows) {
execSync(`xcopy "${src}" ".\\${folder}" /E /I /Y`);
} else {
execSync(`cp -R "${src}/"* "./${folder}/"`);
}
}
});
// 5. Update package.json (version only)
const newPkgPath = path.join(sourcePath, 'package.json');
if (fs.existsSync(newPkgPath)) {
const currentPkg = JSON.parse(fs.readFileSync('./package.json', 'utf8'));
const newPkg = JSON.parse(fs.readFileSync(newPkgPath, 'utf8'));
currentPkg.version = newPkg.version;
fs.writeFileSync('./package.json', JSON.stringify(currentPkg, null, 2));
}
fs.unlinkSync(tempZip);
if (isWindows) {
execSync(`rmdir /s /q "${tempDir}"`);
} else {
execSync(`rm -rf "${tempDir}"`);
}
res.json({ success: true, message: 'Update installed successfully. Bot is restarting...' });
// Reboot
setTimeout(() => process.exit(0), 1000);
} catch (err) {
console.error('[Updater] Update failed:', err);
res.status(500).json({ success: false, error: err.message });
}
});
// --- Transcript API ---
this.app.get('/api/system/transcripts', (req, res) => {
const transcriptDir = './Data/Transcripts';
try {
if (!fs.existsSync(transcriptDir)) {
return res.json({ success: true, data: [] });
}
const files = fs.readdirSync(transcriptDir);
const transcripts = files
.filter(f => f.endsWith('-transcript.html'))
.map(f => {
const stats = fs.statSync(`${transcriptDir}/${f}`);
return {
id: f.replace('-transcript.html', ''),
filename: f,
createdAt: stats.mtime
};
})
.sort((a, b) => b.createdAt - a.createdAt);
res.json({ success: true, data: transcripts });
} catch (err) {
res.status(500).json({ success: false, error: 'Failed to list transcripts' });
}
});
this.app.get('/api/system/transcripts/:id', (req, res) => {
const id = req.params.id.replace(/[^0-9]/g, ''); // Sanitize ID
const filePath = `./Data/Transcripts/${id}-transcript.html`;
try {
if (!fs.existsSync(filePath)) {
return res.status(404).json({ success: false, error: 'Transcript not found' });
}
const content = fs.readFileSync(filePath, 'utf8');
res.json({ success: true, data: content });
} catch (err) {
res.status(500).json({ success: false, error: 'Failed to read transcript' });
}
});
}
}
module.exports = APIServer;
+26
View File
@@ -0,0 +1,26 @@
const Discord = require("discord.js");
const fs = require("fs");
const yaml = require("js-yaml");
const { Command } = require('../Structures/Addon.js'); // Adjust the path as needed
const supportbot = yaml.load(fs.readFileSync("./Configs/supportbot.yml", "utf8"));
module.exports = new Command({
name: "addon",
description: "This is a sample addon!",
options: [],
permissions: ["Administrator"],
async run(interaction) {
let disableCommand = true;
const PingEmbed = new Discord.EmbedBuilder()
.setDescription(
`This is a sample addon.\n\nPong! \`${interaction.client.ws.ping} ms\``
)
.setColor(supportbot.Embed.Colours.General);
interaction.reply({
embeds: [PingEmbed],
});
},
});
+122
View File
@@ -0,0 +1,122 @@
// SupportBot | Emerald Services
// AI Command (Consolidated)
const fs = require("fs");
const { ApplicationCommandOptionType, ApplicationCommandType, EmbedBuilder, MessageFlags } = require("discord.js");
const yaml = require("js-yaml");
const supportbot = yaml.load(fs.readFileSync("./Configs/supportbot.yml", "utf8"));
const cmdconfig = yaml.load(fs.readFileSync("./Configs/commands.yml", "utf8"));
const supportbotai = yaml.load(fs.readFileSync("./Configs/supportbot-ai.yml", "utf8"));
const Command = require("../../Structures/Command.js");
const AIDatabase = require("../../Structures/AIDatabase.js");
module.exports = new Command({
name: cmdconfig.AI?.Command || "ai",
description: cmdconfig.AI?.Description || "Manage SupportBot AI settings and memory.",
type: ApplicationCommandType.ChatInput,
options: [
{
name: cmdconfig.AI?.Train?.Command || "train",
description: cmdconfig.AI?.Train?.Description || "Train the AI by adding knowledge to its database.",
type: ApplicationCommandOptionType.Subcommand,
options: [
{
name: "content",
description: "The text/knowledge you want the bot to learn",
type: ApplicationCommandOptionType.String,
required: true,
},
],
},
{
name: cmdconfig.AI?.Knowledge?.Command || "knowledge",
description: cmdconfig.AI?.Knowledge?.Description || "Manage the AI knowledge base.",
type: ApplicationCommandOptionType.SubcommandGroup,
options: [
{
name: cmdconfig.AI?.Knowledge?.Clear?.Command || "clear",
description: cmdconfig.AI?.Knowledge?.Clear?.Description || "Clear all trained knowledge from the AI.",
type: ApplicationCommandOptionType.Subcommand,
},
],
},
{
name: cmdconfig.AI?.Memory?.Command || "memory",
description: cmdconfig.AI?.Memory?.Description || "Manage the AI conversational memory.",
type: ApplicationCommandOptionType.SubcommandGroup,
options: [
{
name: cmdconfig.AI?.Memory?.Clear?.Command || "clear",
description: cmdconfig.AI?.Memory?.Clear?.Description || "Clear recent conversation memory for this channel.",
type: ApplicationCommandOptionType.Subcommand,
},
],
},
],
permissions: cmdconfig.AI?.Permission || ["Administrator"],
async run(interaction) {
if (!supportbotai.Enabled) {
return interaction.reply({
content: "SupportBot AI is currently disabled.",
flags: MessageFlags.Ephemeral,
});
}
const subcommandGroup = interaction.options.getSubcommandGroup(false);
const subcommand = interaction.options.getSubcommand(false);
try {
if (subcommand === "train" || subcommand === cmdconfig.AI?.Train?.Command) {
const content = interaction.options.getString("content");
AIDatabase.addKnowledge({
sourceType: "user_command",
sourceName: interaction.user.tag,
title: "Trained Knowledge",
content: content,
});
const SuccessEmbed = new EmbedBuilder()
.setDescription(`✅ **Knowledge Added!**\n\nThe AI has learned the following information:\n\`\`\`${content}\`\`\``)
.setColor(supportbot.Embed.Colours.Success);
return interaction.reply({ embeds: [SuccessEmbed], flags: MessageFlags.Ephemeral });
}
if (subcommandGroup === (cmdconfig.AI?.Knowledge?.Command || "knowledge")) {
if (subcommand === (cmdconfig.AI?.Knowledge?.Clear?.Command || "clear")) {
AIDatabase.clearKnowledge();
const SuccessEmbed = new EmbedBuilder()
.setDescription(`✅ **Knowledge Cleared!**\n\nAll manually trained knowledge has been wiped from the database.`)
.setColor(supportbot.Embed.Colours.Success);
return interaction.reply({ embeds: [SuccessEmbed], flags: MessageFlags.Ephemeral });
}
}
if (subcommandGroup === (cmdconfig.AI?.Memory?.Command || "memory")) {
if (subcommand === (cmdconfig.AI?.Memory?.Clear?.Command || "clear")) {
AIDatabase.clearConversations(interaction.channel.id);
const SuccessEmbed = new EmbedBuilder()
.setDescription(`✅ **Memory Cleared!**\n\nThe AI's recent conversation memory in this channel has been wiped. It will no longer remember previous messages sent here.`)
.setColor(supportbot.Embed.Colours.Success);
return interaction.reply({ embeds: [SuccessEmbed], flags: MessageFlags.Ephemeral });
}
}
} catch (error) {
console.error("AI Command Error:", error);
const ErrorEmbed = new EmbedBuilder()
.setDescription(`❌ **Error:** Failed to process the AI command.`)
.setColor(supportbot.Embed.Colours.Error);
return interaction.reply({ embeds: [ErrorEmbed], flags: MessageFlags.Ephemeral });
}
},
});
+62
View File
@@ -0,0 +1,62 @@
const fs = require("fs");
const Discord = require("discord.js");
const yaml = require("js-yaml");
const supportbot = yaml.load(fs.readFileSync("./Configs/supportbot.yml", "utf8"));
const cmdconfig = yaml.load(fs.readFileSync("./Configs/commands.yml", "utf8"));
const Command = require("../../Structures/Command.js");
module.exports = new Command({
name: cmdconfig.Help.Command,
description: cmdconfig.Help.Description,
type: Discord.ApplicationCommandType.ChatInput,
options: [],
permissions: cmdconfig.Help.Permission,
async run(interaction) {
const { getRole } = interaction.client;
let SupportStaff = await getRole(supportbot.Roles.StaffMember.Staff, interaction.guild);
let Admin = await getRole(supportbot.Roles.StaffMember.Admin, interaction.guild);
if (!SupportStaff || !Admin) {
return interaction.reply(
"Some roles seem to be missing!\nPlease check for errors when starting the bot."
);
}
// Separate regular commands and addon commands
let botCommands = "";
let addonCommands = "";
interaction.client.commands.forEach((command) => {
if (command.permissions) {
if (command.addon) {
addonCommands += `\`${command.name}\` `;
} else {
botCommands += `\`${command.name}\` `;
}
}
});
// Create embed
const HelpEmbed1 = new Discord.EmbedBuilder()
.setTitle(supportbot.General.Name + " Commands")
.setThumbnail(interaction.user.displayAvatarURL())
.setColor(supportbot.Embed.Colours.General)
.addFields({
name: "🖥️ Commands\n",
value: botCommands || "No commands available.",
inline: false,
});
HelpEmbed1.setFooter({
text: supportbot.Embed.Footer,
iconURL: interaction.user.displayAvatarURL(),
});
interaction.reply({
flags: Discord.MessageFlags.Ephemeral,
embeds: [HelpEmbed1],
});
},
});
+51
View File
@@ -0,0 +1,51 @@
// SupportBot | Emerald Services
// Info Command
const fs = require("fs");
const Discord = require("discord.js");
const yaml = require("js-yaml");
const supportbot = yaml.load(
fs.readFileSync("./Configs/supportbot.yml", "utf8")
);
const cmdconfig = yaml.load(
fs.readFileSync("./Configs/commands.yml", "utf8")
);
const msgconfig = yaml.load(
fs.readFileSync("./Configs/messages.yml", "utf8")
);
const Command = require("../../Structures/Command.js");
module.exports = new Command({
name: cmdconfig.Info.Command,
description: cmdconfig.Info.Description,
options: [],
permissions: cmdconfig.Info.Permission,
async run(interaction) {
let disableCommand = true;
const InfoButton = new Discord.ButtonBuilder()
.setLabel(msgconfig.Info.Button)
.setURL(msgconfig.Info.URL)
.setStyle("Link");
const inforow = new Discord.ActionRowBuilder().addComponents(InfoButton);
const InfoEmbed = new Discord.EmbedBuilder()
.setURL(msgconfig.Info.URL)
.setTitle(msgconfig.Info.Title)
.setDescription(msgconfig.Info.Description)
.setColor(msgconfig.Info.Colour)
interaction.reply({
embeds: [InfoEmbed],
components: [inforow],
});
},
});
+34
View File
@@ -0,0 +1,34 @@
// SupportBot | Emerald Services
// Ping Command
const fs = require("fs");
const Discord = require("discord.js");
const yaml = require("js-yaml");
const supportbot = yaml.load(
fs.readFileSync("./Configs/supportbot.yml", "utf8")
);
const cmdconfig = yaml.load(fs.readFileSync("./Configs/commands.yml", "utf8"));
const Command = require("../../Structures/Command.js");
module.exports = new Command({
name: cmdconfig.Ping.Command,
description: cmdconfig.Ping.Description,
options: [],
permissions: cmdconfig.Ping.Permission,
async run(interaction) {
let disableCommand = true;
const PingEmbed = new Discord.EmbedBuilder()
.setDescription(
`:ping_pong: **Ping:** \`${interaction.client.ws.ping} ms\``
)
.setColor(supportbot.Embed.Colours.General);
interaction.reply({
embeds: [PingEmbed],
});
},
});
+527
View File
@@ -0,0 +1,527 @@
const {
ModalBuilder,
TextInputBuilder,
TextInputStyle,
ApplicationCommandType,
ActionRowBuilder,
ButtonBuilder,
ButtonStyle,
ApplicationCommandOptionType,
MessageFlags,
ContainerBuilder,
TextDisplayBuilder,
SeparatorBuilder,
ThumbnailBuilder,
MediaGalleryBuilder,
MediaGalleryItemBuilder,
} = require("discord.js");
const fs = require("fs");
const yaml = require("js-yaml");
const db = require("../../Structures/Database.js");
const Command = require("../../Structures/Command.js");
const supportbot = yaml.load(fs.readFileSync("./Configs/supportbot.yml", "utf8"));
const cmdconfig = yaml.load(fs.readFileSync("./Configs/commands.yml", "utf8"));
const msgconfig = yaml.load(fs.readFileSync("./Configs/messages.yml", "utf8"));
const clockedInUsers = new Set();
function safeGetProfile(userId) {
try {
if (typeof db.getProfile !== "function") {
console.error("db.getProfile is not a function");
return {
bio: "",
timezone: "",
clockedIn: false,
};
}
const profile = db.getProfile(userId);
return {
bio: profile?.bio || "",
timezone: profile?.timezone || "",
clockedIn: Boolean(profile?.clockedIn),
};
} catch (error) {
console.error("Error getting profile:", error);
return {
bio: "",
timezone: "",
clockedIn: false,
};
}
}
function safeSetClockedIn(userId, value) {
try {
if (typeof db.setClockedIn !== "function") {
console.error("db.setClockedIn is not a function");
return false;
}
db.setClockedIn(userId, value);
return true;
} catch (error) {
console.error("Error setting clocked in status:", error);
return false;
}
}
function buildProfileContainer({
viewingUser,
viewingUserId,
bio,
timezone,
clockedIn,
isStaff,
}) {
const container = new ContainerBuilder();
if (supportbot.Embed?.Colours?.General) {
container.setAccentColor(
parseInt(String(supportbot.Embed.Colours.General).replace("#", ""), 16),
);
}
const avatarUrl = viewingUser.displayAvatarURL({ size: 128, extension: "png" });
const gallery = new MediaGalleryBuilder().addItems(
new MediaGalleryItemBuilder().setURL(avatarUrl)
);
container.addMediaGalleryComponents(gallery);
container.addTextDisplayComponents(
new TextDisplayBuilder().setContent(`## ${viewingUser.username}'s Profile`)
);
container.addSeparatorComponents(new SeparatorBuilder().setDivider(true));
container.addTextDisplayComponents(
new TextDisplayBuilder().setContent(
[
`**Bio:** ${bio || "No bio set."}`,
`**Timezone:** ${timezone || "No timezone set."}`,
...(isStaff
? [`**Clocked In:** ${clockedIn ? "✅ Clocked In" : "❌ Clocked Out"}`]
: []),
].join("\n")
)
);
return container;
}
function buildProfileButtons({ isOwnProfile, isStaff, clockedIn }) {
const row = new ActionRowBuilder();
if (isOwnProfile) {
row.addComponents(
new ButtonBuilder()
.setCustomId("editProfile")
.setLabel("Edit Profile")
.setStyle(ButtonStyle.Secondary),
);
if (isStaff) {
row.addComponents(
new ButtonBuilder()
.setCustomId("clockInOut")
.setLabel(clockedIn ? "Clock Out" : "Clock In")
.setStyle(ButtonStyle.Secondary),
);
}
}
if (isStaff && supportbot.Ticket?.ClaimTickets?.Enabled) {
row.addComponents(
new ButtonBuilder()
.setCustomId("viewTicketStats")
.setLabel("View Ticket Stats")
.setStyle(ButtonStyle.Secondary),
);
}
return row.components.length ? [row] : [];
}
function buildTicketStatsContainer(viewingUserId, ticketsClaimed, ticketsOpen, avgMinutes) {
const container = new ContainerBuilder();
if (supportbot.Embed?.Colours?.General) {
container.setAccentColor(
parseInt(String(supportbot.Embed.Colours.General).replace("#", ""), 16),
);
}
container.addTextDisplayComponents(
new TextDisplayBuilder().setContent(`# ${msgconfig.TicketStats.Title || "Ticket Stats"}`),
);
container.addSeparatorComponents(new SeparatorBuilder().setDivider(true));
container.addTextDisplayComponents(
new TextDisplayBuilder().setContent(
[
`> Ticket stats for <@${viewingUserId}>`,
``,
`**${msgconfig.TicketStats.OpenTickets || "Open Tickets"}:** ${ticketsOpen.length}`,
`**${msgconfig.TicketStats.TotalTickets || "Total Tickets"}:** ${ticketsClaimed.length}`,
`**${msgconfig.TicketStats.ResponseTime || "Average Response Time"}:** ${avgMinutes} minutes`,
].join("\n"),
),
);
return container;
}
function buildOpenTicketsContainer(ticketsOpen) {
const container = new ContainerBuilder();
if (supportbot.Embed?.Colours?.General) {
container.setAccentColor(
parseInt(String(supportbot.Embed.Colours.General).replace("#", ""), 16),
);
}
container.addTextDisplayComponents(new TextDisplayBuilder().setContent(`# Active Tickets`));
container.addSeparatorComponents(new SeparatorBuilder().setDivider(true));
container.addTextDisplayComponents(
new TextDisplayBuilder().setContent(
ticketsOpen.length ? ticketsOpen.map((t) => `<#${t.id}>`).join("\n") : "No active tickets.",
),
);
return container;
}
module.exports = new Command({
name: cmdconfig.Profile.Command,
description: cmdconfig.Profile.Description,
type: ApplicationCommandType.ChatInput,
permissions: cmdconfig.Profile.Permission,
options: [
{
name: "user",
description: "The user to view the profile of",
type: ApplicationCommandOptionType.User,
required: false,
},
],
async run(interaction) {
await interaction.deferReply({ flags: MessageFlags.Ephemeral });
try {
const viewingUser = interaction.options.getUser("user") || interaction.user;
const viewingUserId = viewingUser.id;
const interactionUserId = interaction.user.id;
const member = await interaction.guild.members.fetch(viewingUserId);
const { getRole } = interaction.client;
const Staff = await getRole(supportbot.Roles.StaffMember.Staff, interaction.guild);
const Admin = await getRole(supportbot.Roles.StaffMember.Admin, interaction.guild);
if (!Staff || !Admin) {
return interaction.editReply({
content: "Some roles seem to be missing!\nPlease check for errors when starting the bot.",
});
}
const isStaff = member.roles.cache.has(Staff.id) || member.roles.cache.has(Admin.id);
const isOwnProfile = interactionUserId === viewingUserId;
if (typeof db.ensureProfile === "function") {
db.ensureProfile(viewingUserId);
}
let { bio, timezone, clockedIn } = safeGetProfile(viewingUserId);
const profileContainer = buildProfileContainer({
viewingUser,
viewingUserId,
bio,
timezone,
clockedIn,
isStaff,
});
const buttonRows = buildProfileButtons({
isOwnProfile,
isStaff,
clockedIn,
});
await interaction.editReply({
flags: MessageFlags.IsComponentsV2,
components: [profileContainer, ...buttonRows],
});
const filter = (i) =>
[
"editProfile",
"clockInOut",
"viewTicketStats",
"showOpenTickets",
"backToStats",
"backToProfile",
].includes(i.customId) && i.user.id === interactionUserId;
const collector = interaction.channel.createMessageComponentCollector({
filter,
time: 60000,
});
collector.on("collect", async (i) => {
if (i.customId === "editProfile") {
const modal = new ModalBuilder()
.setCustomId("editProfileModal")
.setTitle("Edit Profile")
.addComponents(
new ActionRowBuilder().addComponents(
new TextInputBuilder()
.setCustomId("bio")
.setLabel("Bio")
.setStyle(TextInputStyle.Paragraph)
.setPlaceholder("Enter your bio")
.setValue(String(bio || ""))
.setRequired(false),
),
new ActionRowBuilder().addComponents(
new TextInputBuilder()
.setCustomId("timezone")
.setLabel("Timezone")
.setStyle(TextInputStyle.Short)
.setPlaceholder("Enter your timezone")
.setValue(String(timezone || ""))
.setRequired(false),
),
);
return i.showModal(modal);
}
if (i.customId === "clockInOut") {
const newStatus = !clockedIn;
const saved = safeSetClockedIn(viewingUserId, newStatus);
if (!saved) {
return i.reply({
content:
"Could not update clock in status because the profile database is not available.",
flags: MessageFlags.Ephemeral,
});
}
clockedIn = newStatus;
if (newStatus) clockedInUsers.add(viewingUserId);
else clockedInUsers.delete(viewingUserId);
const updatedProfileContainer = buildProfileContainer({
viewingUser,
viewingUserId,
bio,
timezone,
clockedIn,
isStaff,
});
const updatedButtonRows = buildProfileButtons({
isOwnProfile,
isStaff,
clockedIn,
});
await i.update({
flags: MessageFlags.IsComponentsV2,
components: [updatedProfileContainer, ...updatedButtonRows],
});
return interaction.followUp({
content: newStatus
? "You have successfully clocked in."
: "You have successfully clocked out.",
flags: MessageFlags.Ephemeral,
});
}
if (i.customId === "viewTicketStats") {
let TicketData = { tickets: [] };
try {
TicketData = JSON.parse(fs.readFileSync("./Data/TicketData.json", "utf8"));
} catch (error) {
console.error("Error reading TicketData.json:", error);
}
const ticketsClaimed = TicketData.tickets.filter((t) => t.claimedBy === viewingUserId);
const ticketsOpen = ticketsClaimed.filter((t) => t.open);
const totalTickets = ticketsClaimed.length;
let totalResponseTime = 0;
let responseCount = 0;
ticketsClaimed.forEach((t) => {
if (t.claimedAt && t.createdAt) {
totalResponseTime += new Date(t.claimedAt) - new Date(t.createdAt);
responseCount++;
}
});
const avgMinutes = responseCount
? Math.round(totalResponseTime / responseCount / 60000)
: 0;
const statsContainer = buildTicketStatsContainer(
viewingUserId,
ticketsClaimed,
ticketsOpen,
avgMinutes,
);
const statsRow = new ActionRowBuilder().addComponents(
new ButtonBuilder()
.setCustomId("showOpenTickets")
.setLabel("Show Open Tickets")
.setStyle(ButtonStyle.Secondary),
new ButtonBuilder()
.setCustomId("backToProfile")
.setLabel("Back to Profile")
.setStyle(ButtonStyle.Secondary),
);
return i.update({
flags: MessageFlags.IsComponentsV2,
components: [statsContainer, statsRow],
});
}
if (i.customId === "showOpenTickets") {
let TicketData = { tickets: [] };
try {
TicketData = JSON.parse(fs.readFileSync("./Data/TicketData.json", "utf8"));
} catch (error) {
console.error("Error reading TicketData.json:", error);
}
const ticketsOpen = TicketData.tickets.filter(
(t) => t.claimedBy === viewingUserId && t.open,
);
const openContainer = buildOpenTicketsContainer(ticketsOpen);
const backRow = new ActionRowBuilder().addComponents(
new ButtonBuilder()
.setCustomId("backToStats")
.setLabel("Back to Stats")
.setStyle(ButtonStyle.Secondary),
);
return i.update({
flags: MessageFlags.IsComponentsV2,
components: [openContainer, backRow],
});
}
if (i.customId === "backToStats") {
let TicketData = { tickets: [] };
try {
TicketData = JSON.parse(fs.readFileSync("./Data/TicketData.json", "utf8"));
} catch (error) {
console.error("Error reading TicketData.json:", error);
}
const ticketsClaimed = TicketData.tickets.filter((t) => t.claimedBy === viewingUserId);
const ticketsOpen = ticketsClaimed.filter((t) => t.open);
let totalResponseTime = 0;
let responseCount = 0;
ticketsClaimed.forEach((t) => {
if (t.claimedAt && t.createdAt) {
totalResponseTime += new Date(t.claimedAt) - new Date(t.createdAt);
responseCount++;
}
});
const avgMinutes = responseCount
? Math.round(totalResponseTime / responseCount / 60000)
: 0;
const statsContainer = buildTicketStatsContainer(
viewingUserId,
ticketsClaimed,
ticketsOpen,
avgMinutes,
);
const statsRow = new ActionRowBuilder().addComponents(
new ButtonBuilder()
.setCustomId("showOpenTickets")
.setLabel("Show Open Tickets")
.setStyle(ButtonStyle.Secondary),
new ButtonBuilder()
.setCustomId("backToProfile")
.setLabel("Back to Profile")
.setStyle(ButtonStyle.Secondary),
);
return i.update({
flags: MessageFlags.IsComponentsV2,
components: [statsContainer, statsRow],
});
}
if (i.customId === "backToProfile") {
const updatedProfileContainer = buildProfileContainer({
viewingUser,
viewingUserId,
bio,
timezone,
clockedIn,
isStaff,
});
const updatedButtonRows = buildProfileButtons({
isOwnProfile,
isStaff,
clockedIn,
});
return i.update({
flags: MessageFlags.IsComponentsV2,
components: [updatedProfileContainer, ...updatedButtonRows],
});
}
});
} catch (error) {
console.error("Error executing profile command:", error);
if (interaction.deferred || interaction.replied) {
return interaction
.editReply({
content: "An error occurred while loading the profile.",
components: [],
})
.catch(() => {});
}
return interaction
.reply({
content: "An error occurred while loading the profile.",
flags: MessageFlags.Ephemeral,
})
.catch(() => {});
}
},
});
module.exports.clockedInUsers = clockedInUsers;
+206
View File
@@ -0,0 +1,206 @@
// SupportBot | Emerald Services
// Translate Command
const fs = require("fs");
const Discord = require("discord.js");
const yaml = require("js-yaml");
const { translate } = require("@vitalets/google-translate-api");
const supportbot = yaml.load(fs.readFileSync("./Configs/supportbot.yml", "utf8"));
const cmdconfig = yaml.load(fs.readFileSync("./Configs/commands.yml", "utf8"));
const msgconfig = yaml.load(fs.readFileSync("./Configs/messages.yml", "utf8"));
const Command = require("../../Structures/Command.js");
const LANGUAGES = [
{ name: "Auto Detect", value: "auto" },
{ name: "English", value: "en" },
{ name: "Spanish", value: "es" },
{ name: "French", value: "fr" },
{ name: "German", value: "de" },
{ name: "Italian", value: "it" },
{ name: "Portuguese", value: "pt" },
{ name: "Dutch", value: "nl" },
{ name: "Polish", value: "pl" },
{ name: "Russian", value: "ru" },
{ name: "Ukrainian", value: "uk" },
{ name: "Turkish", value: "tr" },
{ name: "Arabic", value: "ar" },
{ name: "Hebrew", value: "he" },
{ name: "Hindi", value: "hi" },
{ name: "Japanese", value: "ja" },
{ name: "Korean", value: "ko" },
{ name: "Chinese (Simplified)", value: "zh-cn" },
{ name: "Chinese (Traditional)", value: "zh-tw" },
{ name: "Thai", value: "th" },
{ name: "Vietnamese", value: "vi" },
{ name: "Indonesian", value: "id" },
{ name: "Greek", value: "el" },
{ name: "Swedish", value: "sv" },
{ name: "Romanian", value: "ro" },
];
function buildContainer(title, lines = [], color = null) {
const container = new Discord.ContainerBuilder();
if (color) {
container.setAccentColor(parseInt(color.replace("#", ""), 16));
}
container.addTextDisplayComponents(new Discord.TextDisplayBuilder().setContent(`## ${title}`));
container.addSeparatorComponents(new Discord.SeparatorBuilder().setDivider(true));
container.addTextDisplayComponents(new Discord.TextDisplayBuilder().setContent(lines.join("\n")));
return container;
}
function trim(text, max = 1800) {
if (text.length <= max) return text;
return text.substring(0, max) + "...";
}
module.exports = new Command({
name: cmdconfig.Translate.Command,
description: cmdconfig.Translate.Description,
type: Discord.ApplicationCommandType.ChatInput,
options: [
{
type: Discord.ApplicationCommandOptionType.String,
name: "from",
description: "Language to translate FROM",
required: true,
choices: LANGUAGES,
},
{
type: Discord.ApplicationCommandOptionType.String,
name: "to",
description: "Language to translate TO",
required: true,
choices: LANGUAGES.filter((l) => l.value !== "auto"),
},
{
type: Discord.ApplicationCommandOptionType.String,
name: "text",
description: "Text to translate",
required: true,
},
],
permissions: cmdconfig.Translate.Permission,
async run(interaction) {
const { getRole, getChannel } = interaction.client;
const Staff = await getRole(supportbot.Roles.StaffMember.Staff, interaction.guild);
const Admin = await getRole(supportbot.Roles.StaffMember.Admin, interaction.guild);
if (!Staff || !Admin) {
return interaction.reply({
content: "Some roles seem to be missing!",
flags: Discord.MessageFlags.Ephemeral,
});
}
if (
!interaction.member.roles.cache.has(Staff.id) &&
!interaction.member.roles.cache.has(Admin.id)
) {
return interaction.reply({
flags: Discord.MessageFlags.IsComponentsV2 | Discord.MessageFlags.Ephemeral,
components: [
buildContainer(
"Invalid Permissions",
[
msgconfig.Error.IncorrectPerms,
"",
`Required role: \`${supportbot.Roles.StaffMember.Staff}\` or \`${supportbot.Roles.StaffMember.Admin}\``,
],
supportbot.Embed.Colours.Warn,
),
],
});
}
await interaction.deferReply({ flags: Discord.MessageFlags.Ephemeral });
const fromLang = interaction.options.getString("from");
const toLang = interaction.options.getString("to");
const text = interaction.options.getString("text");
const translateLog = await getChannel(supportbot.Translate?.TranslateLog, interaction.guild);
let result;
try {
result = await translate(text, {
from: fromLang === "auto" ? undefined : fromLang,
to: toLang,
});
} catch (err) {
console.error("Translate error:", err);
return interaction.editReply({
flags: Discord.MessageFlags.IsComponentsV2,
components: [
buildContainer(
"Translation Failed",
["The translation service returned an error."],
supportbot.Embed.Colours.Warn,
),
],
});
}
const detectedLanguage = result.from?.language?.iso || result.from?.language || "unknown";
const container = buildContainer(
"Translation",
[
`**Requested By:** <@${interaction.user.id}>`,
`**From:** \`${fromLang === "auto" ? detectedLanguage : fromLang}\``,
`**To:** \`${toLang}\``,
"",
"**Original Text**",
trim(text),
"",
"**Translated Text**",
trim(result.text),
],
supportbot.Embed.Colours.Success,
);
await interaction.editReply({
flags: Discord.MessageFlags.IsComponentsV2,
components: [container],
});
if (translateLog) {
const logContainer = buildContainer(
"Translation Log",
[
`User: <@${interaction.user.id}>`,
`Channel: <#${interaction.channel.id}>`,
`From: ${fromLang}`,
`To: ${toLang}`,
"",
trim(text),
"",
trim(result.text),
],
supportbot.Embed.Colours.General,
);
translateLog
.send({
flags: Discord.MessageFlags.IsComponentsV2,
components: [logContainer],
})
.catch(() => {});
}
},
});
+147
View File
@@ -0,0 +1,147 @@
const fs = require("fs");
const Discord = require("discord.js");
const yaml = require("js-yaml");
const path = require("path");
const supportbot = yaml.load(fs.readFileSync("./Configs/supportbot.yml", "utf8"));
const cmdconfig = yaml.load(fs.readFileSync("./Configs/commands.yml", "utf8"));
const msgconfig = yaml.load(fs.readFileSync("./Configs/messages.yml", "utf8"));
const Command = require("../../Structures/Command.js");
const DB = require("../../Structures/Database.js");
module.exports = new Command({
name: "suggest",
description: cmdconfig.Suggestion?.Description || "Submit a new suggestion",
type: Discord.ApplicationCommandType.ChatInput,
options: [
{
name: "text",
description: "Your suggestion text",
type: Discord.ApplicationCommandOptionType.String,
required: true
}
],
async run(interaction) {
const suggestion = interaction.options.getString("text");
const mode = supportbot.Suggestions.Mode || "Channel";
const embed = new Discord.EmbedBuilder()
.addFields(
{ name: "Suggestion", value: suggestion, inline: true },
{ name: "From", value: `<@${interaction.user.id}>` },
{ name: `${supportbot.Suggestions.UpvoteEmoji} ${supportbot.Suggestions.UpvoteTitle}`, value: "0", inline: true },
{ name: `${supportbot.Suggestions.DownvoteEmoji} ${supportbot.Suggestions.DownvoteTitle}`, value: "0", inline: true }
)
.setThumbnail(interaction.user.displayAvatarURL())
.setColor(supportbot.Embed.Colours.General);
const row = new Discord.ActionRowBuilder().addComponents(
new Discord.ButtonBuilder()
.setCustomId("upvote")
.setEmoji(supportbot.Suggestions.UpvoteEmoji)
.setStyle(supportbot.Suggestions.Buttons.Upvote),
new Discord.ButtonBuilder()
.setCustomId("downvote")
.setEmoji(supportbot.Suggestions.DownvoteEmoji)
.setStyle(supportbot.Suggestions.Buttons.Downvote),
new Discord.ButtonBuilder()
.setCustomId("removevote")
.setLabel(supportbot.Suggestions.Buttons.RemoveVote_Title)
.setStyle(supportbot.Suggestions.Buttons.RemoveVote)
);
if (mode === "Forum") {
const forum = await interaction.guild.channels
.fetch(supportbot.Suggestions.ForumChannel)
.catch(() => null);
if (!forum || forum.type !== Discord.ChannelType.GuildForum) {
return interaction.reply({
embeds: [
new Discord.EmbedBuilder()
.setTitle("⚠ Missing Forum Channel")
.setDescription(msgconfig.Error.MissingChannel)
.setColor(supportbot.Embed.Colours.Error)
],
flags: Discord.MessageFlags.Ephemeral,
});
}
const appliedTags = supportbot.Suggestions.Tags?.Created
? [supportbot.Suggestions.Tags.Created]
: [];
const thread = await forum.threads.create({
name: suggestion.slice(0, 100),
message: {
content: "\u200B",
embeds: [embed],
components: [row]
},
appliedTags,
autoArchiveDuration: Discord.ThreadAutoArchiveDuration.OneDay,
reason: "New Suggestion"
});
embed.setFooter({
text: `${supportbot.Embed.Footer} | Suggestion ID: ${thread.id}`,
iconURL: interaction.user.displayAvatarURL()
});
const starter = await thread.fetchStarterMessage();
await starter.edit({ embeds: [embed], components: [row] });
DB.add(thread.id, interaction.user.id, suggestion);
return interaction.reply({
embeds: [
new Discord.EmbedBuilder()
.setTitle(msgconfig.Suggestions.Sent_Title)
.setDescription(`${msgconfig.Suggestions.Sent}`)
.addFields({ name: 'Posted in:', value: `<#${forum.id}>` })
.setColor(supportbot.Embed.Colours.Success)
],
flags: Discord.MessageFlags.Ephemeral,
});
}
// ---------- Channel Mode ----------
const channel = await interaction.guild.channels
.fetch(supportbot.Suggestions.Channel)
.catch(() => null);
if (!channel) {
return interaction.reply({
embeds: [
new Discord.EmbedBuilder()
.setTitle("⚠ Missing Suggestion Channel")
.setDescription(msgconfig.Error.MissingChannel)
.setColor(supportbot.Embed.Colours.Error)
],
flags: Discord.MessageFlags.Ephemeral,
});
}
const message = await channel.send({ embeds: [embed], components: [row] });
embed.setFooter({
text: `${supportbot.Embed.Footer} | Suggestion ID: ${message.id}`,
iconURL: interaction.user.displayAvatarURL()
});
await message.edit({ embeds: [embed], components: [row] });
DB.add(message.id, interaction.user.id, suggestion);
return interaction.reply({
embeds: [
new Discord.EmbedBuilder()
.setTitle(msgconfig.Suggestions.Sent_Title)
.setDescription(`${msgconfig.Suggestions.Sent}`)
.addFields({ name: 'Posted in:', value: `<#${channel.id}>` })
.setColor(supportbot.Embed.Colours.Success)
],
flags: Discord.MessageFlags.Ephemeral,
});
}
});
+183
View File
@@ -0,0 +1,183 @@
const Discord = require("discord.js");
const fs = require("fs");
const yaml = require("js-yaml");
const supportbot = yaml.load(fs.readFileSync("./Configs/supportbot.yml", "utf8"));
const msgconfig = yaml.load(fs.readFileSync("./Configs/messages.yml", "utf8"));
const cmdconfig = yaml.load(fs.readFileSync("./Configs/commands.yml", "utf8"));
const SuggestionDB = require("../../Structures/Database.js");
const Command = require("../../Structures/Command.js");
module.exports = new Command({
name: cmdconfig.SuggestionAdmin.Command,
description: cmdconfig.SuggestionAdmin.Description,
type: Discord.ApplicationCommandType.ChatInput,
permissions: cmdconfig.SuggestionAdmin.Permission,
options: [
{
name: "status",
description: "New status",
type: Discord.ApplicationCommandOptionType.String,
required: true,
choices: [
{ name: "Solved", value: "Solved" },
{ name: "Denied", value: "Denied" },
{ name: "Considering", value: "Considering" }
]
},
{
name: "id",
description: "Message ID (required in Channel mode)",
type: Discord.ApplicationCommandOptionType.String,
required: false
}
],
async run(interaction) {
const status = interaction.options.getString("status");
const idOption = interaction.options.getString("id");
const mode = supportbot.Suggestions.Mode || "Channel";
const { getRole } = interaction.client;
const staffRole = await getRole(supportbot.Roles.StaffMember.Staff, interaction.guild);
const adminRole = await getRole(supportbot.Roles.StaffMember.Admin, interaction.guild);
if (
!interaction.member.roles.cache.has(staffRole?.id) &&
!interaction.member.roles.cache.has(adminRole?.id)
) {
return interaction.reply({
embeds: [
new Discord.EmbedBuilder()
.setTitle("Invalid Permissions!")
.setDescription(
`${msgconfig.Error.IncorrectPerms}\nRequired: ${supportbot.Roles.StaffMember.Staff} or ${supportbot.Roles.StaffMember.Admin}`
)
.setColor(supportbot.Embed.Colours.Warn)
],
flags: Discord.MessageFlags.Ephemeral,
});
}
if (mode === "Forum") {
const thread = interaction.channel;
if (!thread.isThread() || thread.parentId !== supportbot.Suggestions.ForumChannel) {
return interaction.reply({
embeds: [
new Discord.EmbedBuilder()
.setTitle("Not a Suggestion Thread")
.setDescription(msgconfig.Error.MissingChannel)
.setColor(supportbot.Embed.Colours.Error)
],
flags: Discord.MessageFlags.Ephemeral,
});
}
const tagMap = {
Solved: supportbot.Suggestions.Tags.Solved,
Denied: supportbot.Suggestions.Tags.Denied,
Considering: supportbot.Suggestions.Tags.Considering
};
const tagId = tagMap[status];
if (!tagId) {
return interaction.reply({
embeds: [
new Discord.EmbedBuilder()
.setTitle("Tag Missing")
.setDescription("No forum tag configured for this status.")
.setColor(supportbot.Embed.Colours.Error)
],
flags: Discord.MessageFlags.Ephemeral,
});
}
await thread.setAppliedTags([tagId]).catch(() => null);
SuggestionDB.setStatus(thread.id, status);
return interaction.reply({
embeds: [
new Discord.EmbedBuilder()
.setTitle("Suggestion Updated")
.setDescription(`Status set to **${status}**.`)
.setColor(supportbot.Embed.Colours.Success)
],
flags: Discord.MessageFlags.Ephemeral,
});
}
if (!idOption) {
return interaction.reply({
embeds: [
new Discord.EmbedBuilder()
.setTitle("Message ID Required")
.setDescription("Provide the suggestion’s message ID when in Channel mode.")
.setColor(supportbot.Embed.Colours.Error)
],
flags: Discord.MessageFlags.Ephemeral,
});
}
const channel = await interaction.guild.channels
.fetch(supportbot.Suggestions.Channel)
.catch(() => null);
if (!channel) {
return interaction.reply({
embeds: [
new Discord.EmbedBuilder()
.setTitle("Missing Suggestion Channel")
.setDescription(msgconfig.Error.MissingChannel)
.setColor(supportbot.Embed.Colours.Error)
],
flags: Discord.MessageFlags.Ephemeral,
});
}
const targetMsg = await channel.messages.fetch(idOption).catch(() => null);
if (!targetMsg) {
return interaction.reply({
embeds: [
new Discord.EmbedBuilder()
.setTitle("Message Not Found")
.setDescription("Could not fetch a suggestion with that ID.")
.setColor(supportbot.Embed.Colours.Error)
],
flags: Discord.MessageFlags.Ephemeral,
});
}
const oldEmbed = targetMsg.embeds[0];
if (!oldEmbed) {
return interaction.reply({
embeds: [
new Discord.EmbedBuilder()
.setTitle("No Embed Found")
.setDescription("The target message has no suggestion embed.")
.setColor(supportbot.Embed.Colours.Error)
],
flags: Discord.MessageFlags.Ephemeral,
});
}
const colorMap = {
Solved: supportbot.Embed.Colours.Success,
Denied: supportbot.Embed.Colours.Error,
Considering: supportbot.Embed.Colours.Warn
};
const newEmbed = Discord.EmbedBuilder.from(oldEmbed)
.setColor(colorMap[status])
.addFields({ name: "Status", value: status, inline: true });
await targetMsg.edit({ embeds: [newEmbed], components: targetMsg.components });
SuggestionDB.setStatus(idOption, status);
return interaction.reply({
embeds: [
new Discord.EmbedBuilder()
.setTitle("Suggestion Updated")
.setDescription(`Suggestion **${idOption}** marked as **${status}**.`)
.setColor(supportbot.Embed.Colours.Success)
],
flags: Discord.MessageFlags.Ephemeral,
});
}
});
+493
View File
@@ -0,0 +1,493 @@
const fs = require("fs");
const Discord = require("discord.js");
const yaml = require("js-yaml");
const db = require("../../Structures/Database.js");
const TicketManager = require("../../Structures/TicketManager.js");
const Command = require("../../Structures/Command.js");
const supportbot = yaml.load(fs.readFileSync("./Configs/supportbot.yml", "utf8"));
const cmdconfig = yaml.load(fs.readFileSync("./Configs/commands.yml", "utf8"));
const msgconfig = yaml.load(fs.readFileSync("./Configs/messages.yml", "utf8"));
function getDepartmentConfig(departmentKey) {
return supportbot.Ticket?.DepartmentSystem?.Departments?.[departmentKey] || null;
}
function getTicketUserId(ticket) {
return ticket?.user || ticket?.user_id || null;
}
function buildContainer(title, lines = []) {
const container = new Discord.ContainerBuilder();
if (supportbot.Embed?.Colours?.General) {
container.setAccentColor(
parseInt(String(supportbot.Embed.Colours.General).replace("#", ""), 16),
);
}
container.addTextDisplayComponents(new Discord.TextDisplayBuilder().setContent(`## ${title}`));
container.addSeparatorComponents(new Discord.SeparatorBuilder().setDivider(true));
if (lines.length > 0) {
container.addTextDisplayComponents(
new Discord.TextDisplayBuilder().setContent(lines.join("\n")),
);
}
return container;
}
function buildReviewSummaryContainer(ticket, rating, comment) {
const departmentConfig = ticket.department ? getDepartmentConfig(ticket.department) : null;
const departmentName = departmentConfig?.Name || ticket.department || null;
const departmentEmoji = departmentConfig?.Emoji || "🎫";
const claimedByEnabled = supportbot.Ticket?.ClaimTickets?.Enabled === true;
const claimedBy = claimedByEnabled && ticket.claimedBy ? `<@${ticket.claimedBy}>` : null;
const ticketUserId = getTicketUserId(ticket);
const lines = [
`**${msgconfig.ReviewSystem.ReviewEmbed.ReviewedByTitle}** ${ticketUserId ? `<@${ticketUserId}>` : "Unknown User"}`,
];
if (claimedBy) {
lines.unshift(`**${msgconfig.ReviewSystem.ReviewEmbed.ReviewedStaffTitle}** ${claimedBy}`);
}
if (supportbot.Ticket?.DepartmentSystem?.Enabled === true && departmentName) {
lines.push(`**Department** ${departmentEmoji} ${departmentName}`);
}
lines.push("");
lines.push(`**${msgconfig.ReviewSystem.ReviewEmbed.RatingTitle}**`);
lines.push(`${msgconfig.ReviewSystem.ReviewEmbed.ReviewEmoji.repeat(Number(rating))}`);
lines.push("");
lines.push(`**${msgconfig.ReviewSystem.ReviewEmbed.CommentTitle}**`);
lines.push(comment || "No Comment Provided");
const container = new Discord.ContainerBuilder();
if (msgconfig.ReviewSystem?.ReviewEmbed?.Color) {
container.setAccentColor(
parseInt(String(msgconfig.ReviewSystem.ReviewEmbed.Color).replace("#", ""), 16),
);
} else if (supportbot.Embed?.Colours?.General) {
container.setAccentColor(
parseInt(String(supportbot.Embed.Colours.General).replace("#", ""), 16),
);
}
container.addTextDisplayComponents(
new Discord.TextDisplayBuilder().setContent(`## ${msgconfig.ReviewSystem.ReviewEmbed.Title}`),
);
container.addSeparatorComponents(new Discord.SeparatorBuilder().setDivider(true));
container.addTextDisplayComponents(new Discord.TextDisplayBuilder().setContent(lines.join("\n")));
return container;
}
async function collectReview(interaction, ticket) {
const ticketUserId = getTicketUserId(ticket);
if (!ticketUserId) return null;
const ratingContainer = buildContainer(msgconfig.ReviewSystem.Rate.Title, [
msgconfig.ReviewSystem.Rate.Description,
"",
]);
const ratingRow = new Discord.ActionRowBuilder().addComponents(
new Discord.StringSelectMenuBuilder()
.setCustomId(`closeReviewRating:${interaction.id}`)
.setPlaceholder("Select a rating")
.addOptions([
{ label: msgconfig.ReviewSystem.Stars.One, value: "1" },
{ label: msgconfig.ReviewSystem.Stars.Two, value: "2" },
{ label: msgconfig.ReviewSystem.Stars.Three, value: "3" },
{ label: msgconfig.ReviewSystem.Stars.Four, value: "4" },
{ label: msgconfig.ReviewSystem.Stars.Five, value: "5" },
]),
);
ratingContainer.addActionRowComponents(ratingRow);
const ratingPrompt = await interaction.followUp({
flags: Discord.MessageFlags.IsComponentsV2,
components: [ratingContainer],
});
let rating = null;
try {
const ratingInteraction = await ratingPrompt.awaitMessageComponent({
componentType: Discord.ComponentType.StringSelect,
time: 120000,
filter: (i) =>
i.customId === `closeReviewRating:${interaction.id}` && i.user.id === ticketUserId,
});
rating = ratingInteraction.values[0];
await ratingInteraction.deferUpdate().catch(() => {});
} catch {
return null;
}
const commentContainer = buildContainer(msgconfig.ReviewSystem.Comment.Title, [
msgconfig.ReviewSystem.Comment.Description,
"",
]);
const commentRow = new Discord.ActionRowBuilder().addComponents(
new Discord.ButtonBuilder()
.setCustomId(`closeReviewWrite:${interaction.id}`)
.setLabel("Write Comment")
.setStyle(Discord.ButtonStyle.Secondary),
new Discord.ButtonBuilder()
.setCustomId(`closeReviewSkip:${interaction.id}`)
.setLabel("Skip Comment")
.setStyle(Discord.ButtonStyle.Danger),
);
commentContainer.addActionRowComponents(commentRow);
const commentPrompt = await interaction.followUp({
flags: Discord.MessageFlags.IsComponentsV2,
components: [commentContainer],
});
let comment = "No Comment Provided";
try {
const buttonInteraction = await commentPrompt.awaitMessageComponent({
componentType: Discord.ComponentType.Button,
time: 120000,
filter: (i) =>
(i.customId === `closeReviewWrite:${interaction.id}` ||
i.customId === `closeReviewSkip:${interaction.id}`) &&
i.user.id === ticketUserId,
});
if (buttonInteraction.customId === `closeReviewSkip:${interaction.id}`) {
await buttonInteraction.deferUpdate().catch(() => {});
return { rating, comment };
}
await buttonInteraction
.update({
flags: Discord.MessageFlags.IsComponentsV2,
components: [
buildContainer(msgconfig.ReviewSystem.Comment.Title, [
`Requested from: <@${ticketUserId}>`,
"",
"Please send your review comment in the channel now.",
"Type `no` to skip.",
]),
],
})
.catch(() => {});
const collected = await interaction.channel.awaitMessages({
max: 1,
time: 120000,
filter: (m) => m.author.id === ticketUserId,
});
const message = collected.first();
if (message) {
const rawComment = message.content?.trim();
if (rawComment && rawComment.toLowerCase() !== "no") {
comment = rawComment;
}
await message.delete().catch(() => {});
}
} catch {
return { rating, comment };
}
return { rating, comment };
}
function getTranscriptAttachmentFromResult(result) {
if (!result) return null;
if (typeof result === "string") {
return result;
}
if (result.filePath) return result.filePath;
if (result.attachment) return result.attachment;
if (result.path) return result.path;
return null;
}
async function maybeDMTranscript(interaction, ticket, transcriptResult) {
if (supportbot.Ticket?.UserManagement?.DMTranscript !== true) {
return;
}
const ticketUserId = getTicketUserId(ticket);
if (!ticketUserId) return;
const ticketUser = await interaction.client.users.fetch(ticketUserId).catch(() => null);
if (!ticketUser) return;
const attachmentPath = getTranscriptAttachmentFromResult(transcriptResult);
if (!attachmentPath) return;
try {
await ticketUser.send({
content: `Here is a copy of your ticket transcript from \`${interaction.guild.name}\`.`,
files: [attachmentPath],
});
} catch (error) {
console.error("Failed to DM transcript to user:", error);
}
}
async function collectCloseConfirmation(interaction, ticket, reason) {
const ticketUserId = getTicketUserId(ticket);
const lines = [
"Are you sure you want to close this ticket?",
"",
`**Ticket:** ${interaction.channel.name}`,
`**Reason:** ${reason || "No Reason Provided."}`,
];
if (ticketUserId) {
lines.push(`**Ticket User:** <@${ticketUserId}>`);
}
if (supportbot.Ticket?.ReviewSystem?.Enabled === true) {
lines.push("");
lines.push("A review will be requested before the ticket is closed.");
}
const confirmContainer = buildContainer("Close Confirmation", lines);
const confirmRow = new Discord.ActionRowBuilder().addComponents(
new Discord.ButtonBuilder()
.setCustomId(`confirmClose:${interaction.id}`)
.setLabel("Confirm Close")
.setStyle(Discord.ButtonStyle.Danger),
new Discord.ButtonBuilder()
.setCustomId(`cancelClose:${interaction.id}`)
.setLabel("Cancel")
.setStyle(Discord.ButtonStyle.Secondary),
);
confirmContainer.addActionRowComponents(confirmRow);
const confirmMessage = await interaction.editReply({
flags: Discord.MessageFlags.IsComponentsV2,
components: [confirmContainer],
});
try {
const buttonInteraction = await confirmMessage.awaitMessageComponent({
componentType: Discord.ComponentType.Button,
time: 120000,
filter: (i) =>
(i.customId === `confirmClose:${interaction.id}` ||
i.customId === `cancelClose:${interaction.id}`) &&
i.user.id === interaction.user.id,
});
if (buttonInteraction.customId === `cancelClose:${interaction.id}`) {
await buttonInteraction
.update({
flags: Discord.MessageFlags.IsComponentsV2,
components: [
buildContainer("Close Cancelled", ["The ticket close process has been cancelled."]),
],
})
.catch(() => {});
return false;
}
await buttonInteraction.deferUpdate().catch(() => {});
return true;
} catch {
await interaction
.editReply({
flags: Discord.MessageFlags.IsComponentsV2,
components: [buildContainer("Close Cancelled", ["The close confirmation timed out."])],
})
.catch(() => {});
return false;
}
}
async function postReview(interaction, ticket, reviewData) {
const { getChannel } = interaction.client;
const reviewChannel = await getChannel(supportbot.Ticket.ReviewSystem.Channel, interaction.guild);
if (!reviewChannel || !reviewData) return;
const reviewContainer = buildReviewSummaryContainer(
ticket,
reviewData.rating,
reviewData.comment,
);
await reviewChannel
.send({
flags: Discord.MessageFlags.IsComponentsV2,
components: [reviewContainer],
})
.catch(() => {});
}
async function handleCloseTicket(interaction, reason, ticket) {
try {
if (typeof db.updateTicketStatus === "function") {
db.updateTicketStatus(interaction.channel.id, "closed");
}
const transcriptResult = await TicketManager.createTranscript(interaction, ticket, reason);
await maybeDMTranscript(interaction, ticket, transcriptResult);
await interaction
.editReply({
flags: Discord.MessageFlags.IsComponentsV2,
components: [
buildContainer("Ticket Closed", [
`**Ticket:** ${interaction.channel.name}`,
`**Closed By:** <@${interaction.user.id}>`,
`**Reason:** ${reason || "No Reason Provided."}`,
]),
],
})
.catch(() => {});
await interaction.channel.delete().catch(() => {});
} catch (err) {
console.error("Error handling ticket close:", err);
if (interaction.deferred || interaction.replied) {
await interaction
.editReply({
content: "An error occurred while closing the ticket.",
components: [],
})
.catch(() => {});
return;
}
await interaction
.reply({
content: "An error occurred while closing the ticket.",
flags: Discord.MessageFlags.Ephemeral,
})
.catch(() => {});
}
}
module.exports = new Command({
name: cmdconfig.CloseTicket.Command,
description: cmdconfig.CloseTicket.Description,
type: Discord.ApplicationCommandType.ChatInput,
options: [
{
name: "reason",
description: "Ticket Close Reason",
type: Discord.ApplicationCommandOptionType.String,
},
],
permissions: cmdconfig.CloseTicket.Permission,
async run(interaction) {
const { getRole } = interaction.client;
if (supportbot.Ticket.Close.StaffOnly) {
const SupportStaff = await getRole(supportbot.Roles.StaffMember.Staff, interaction.guild);
const Admin = await getRole(supportbot.Roles.StaffMember.Admin, interaction.guild);
if (!SupportStaff || !Admin) {
return interaction.reply({
content: "Some roles seem to be missing! Please check for errors when starting the bot.",
flags: Discord.MessageFlags.Ephemeral,
});
}
if (
!interaction.member.roles.cache.has(SupportStaff.id) &&
!interaction.member.roles.cache.has(Admin.id)
) {
return interaction.reply({
flags: Discord.MessageFlags.IsComponentsV2 | Discord.MessageFlags.Ephemeral,
components: [
buildContainer("Invalid Permissions!", [
msgconfig.Error.IncorrectPerms,
"",
`Role Required: \`${supportbot.Roles.StaffMember.Staff}\` or \`${supportbot.Roles.StaffMember.Admin}\``,
]),
],
});
}
}
const isThread = interaction.channel.type === Discord.ChannelType.PrivateThread;
if (
(supportbot.Ticket.TicketType === "threads" && !isThread) ||
(supportbot.Ticket.TicketType === "channels" &&
interaction.channel.type !== Discord.ChannelType.GuildText)
) {
return interaction.reply({
flags: Discord.MessageFlags.IsComponentsV2 | Discord.MessageFlags.Ephemeral,
components: [
buildContainer("Invalid Channel!", [
`This command can only be used in a ${
supportbot.Ticket.TicketType === "threads" ? "ticket thread" : "ticket channel"
}.`,
]),
],
});
}
await interaction.deferReply({ flags: Discord.MessageFlags.Ephemeral });
const ticket = db.getTicket(interaction.channel.id);
if (!ticket) {
return interaction.editReply({
flags: Discord.MessageFlags.IsComponentsV2,
components: [buildContainer("No Ticket Found!", [msgconfig.Error.NoValidTicket])],
});
}
const reason = interaction.options?.getString("reason") || "No Reason Provided.";
const confirmed = await collectCloseConfirmation(interaction, ticket, reason);
if (!confirmed) {
return;
}
if (supportbot.Ticket?.ReviewSystem?.Enabled === true) {
const reviewData = await collectReview(interaction, ticket);
if (reviewData) {
await postReview(interaction, ticket, reviewData);
}
await handleCloseTicket(interaction, reason, ticket);
return;
}
await handleCloseTicket(interaction, reason, ticket);
},
});
+664
View File
@@ -0,0 +1,664 @@
const fs = require("fs");
const yaml = require("js-yaml");
const {
EmbedBuilder,
ApplicationCommandOptionType,
ApplicationCommandType,
ChannelType,
MessageFlags,
ModalBuilder,
ActionRowBuilder,
TextInputBuilder,
TextInputStyle,
} = require("discord.js");
const supportbot = yaml.load(fs.readFileSync("./Configs/supportbot.yml", "utf8"));
const msgconfig = yaml.load(fs.readFileSync("./Configs/messages.yml", "utf8"));
const cmdconfig = yaml.load(fs.readFileSync("./Configs/commands.yml", "utf8"));
const TicketManager = require("../../Structures/TicketManager.js");
const Command = require("../../Structures/Command.js");
const db = require("../../Structures/Database.js");
function getDepartments() {
return supportbot.Ticket?.DepartmentSystem?.Departments || {};
}
function getPriorities() {
return supportbot.Ticket?.PrioritySystem?.Priorities || {};
}
function prioritiesEnabled() {
return (
supportbot.Ticket?.TicketType !== "threads" &&
supportbot.Ticket?.PrioritySystem?.Enabled === true
);
}
function departmentsEnabled() {
return (
supportbot.Ticket?.TicketType !== "threads" &&
supportbot.Ticket?.DepartmentSystem?.Enabled === true
);
}
function buildTicketChannelName(ticketNumberID, priorityKey, departmentConfig) {
const defaultPrefix = supportbot.Ticket?.ChannelPrefix || supportbot.Ticket?.Channel || "ticket-";
const departmentPrefix = departmentConfig?.ChannelPrefix || defaultPrefix;
const safePrefix = String(departmentPrefix).trim() || "ticket-";
const baseName = `${safePrefix}${ticketNumberID}`;
if (!prioritiesEnabled() || !priorityKey) {
return baseName;
}
return `${baseName}-${String(priorityKey).toLowerCase()}`;
}
module.exports = new Command({
name: cmdconfig.TicketManage?.Command || "ticketmanage",
description: cmdconfig.TicketManage?.Description || "Manage tickets",
type: ApplicationCommandType.ChatInput,
permissions: cmdconfig.TicketManage?.Permission || ["ManageChannels"],
options: [
{
name: "transfer",
description: "Transfer a ticket to another department",
type: ApplicationCommandOptionType.Subcommand,
options: [
{
name: "department",
description: "Department to transfer this ticket to",
type: ApplicationCommandOptionType.String,
required: true,
choices: Object.entries(getDepartments())
.slice(0, 25)
.map(([key, dept]) => ({
name: dept.Name || key,
value: key,
})),
},
{
name: "priority",
description: "Optional new priority",
type: ApplicationCommandOptionType.String,
required: false,
choices: Object.entries(getPriorities())
.slice(0, 25)
.map(([key, priority]) => ({
name: priority.Name || key,
value: key,
})),
},
],
},
{
name: "priority",
description: "Change a ticket priority",
type: ApplicationCommandOptionType.Subcommand,
options: [
{
name: "level",
description: "New priority level",
type: ApplicationCommandOptionType.String,
required: true,
choices: Object.entries(getPriorities())
.slice(0, 25)
.map(([key, priority]) => ({
name: priority.Name || key,
value: key,
})),
},
],
},
{
name: cmdconfig.TicketManage?.ForceAdd?.Command || "forceadd",
description:
cmdconfig.TicketManage?.ForceAdd?.Description || "Force add a user to the current ticket",
type: ApplicationCommandOptionType.Subcommand,
options: [
{
name: "user",
description: "The user to add",
type: ApplicationCommandOptionType.User,
required: true,
},
],
},
{
name: cmdconfig.TicketManage?.ForceRemove?.Command || "forceremove",
description:
cmdconfig.TicketManage?.ForceRemove?.Description || "Remove a user from the current ticket",
type: ApplicationCommandOptionType.Subcommand,
options: [
{
name: "user",
description: "The user to remove",
type: ApplicationCommandOptionType.User,
required: true,
},
],
},
{
name: cmdconfig.TicketManage?.Rename?.Command || "rename",
description: cmdconfig.TicketManage?.Rename?.Description || "Rename the current ticket",
type: ApplicationCommandOptionType.Subcommand,
options: [],
},
{
name: cmdconfig.TicketManage?.Close?.Command || "close",
description: cmdconfig.TicketManage?.Close?.Description || "Close the current ticket",
type: ApplicationCommandOptionType.Subcommand,
options: [
{
name: "reason",
description: "Reason for closing the ticket",
type: ApplicationCommandOptionType.String,
required: false,
},
],
},
],
async run(interaction) {
try {
const subcommand = interaction.options.getSubcommand(false);
const ticket = db.getTicket(interaction.channel.id);
if (!ticket) {
return interaction.reply({
content: "This channel is not a ticket.",
flags: MessageFlags.Ephemeral,
});
}
const { getRole } = interaction.client;
let SupportStaff = await getRole(supportbot.Roles.StaffMember.Staff, interaction.guild);
let Admin = await getRole(supportbot.Roles.StaffMember.Admin, interaction.guild);
let Moderator = await getRole(supportbot.Roles.StaffMember.Moderator, interaction.guild);
if (!SupportStaff || !Admin || !Moderator) {
const missingRolesEmbed = new EmbedBuilder()
.setDescription(msgconfig.Error.InvalidChannel || "Required roles are missing!")
.setColor(supportbot.Embed.Colours.Warn);
return interaction.reply({
embeds: [missingRolesEmbed],
flags: MessageFlags.Ephemeral,
});
}
const NoPerms = new EmbedBuilder()
.setDescription(
msgconfig.Error.IncorrectPerms || "You do not have the correct permissions!",
)
.setColor(supportbot.Embed.Colours.Warn);
if (
!interaction.member.roles.cache.has(Admin.id) &&
!interaction.member.roles.cache.has(Moderator.id) &&
(!supportbot.Roles?.Mod?.AllowSupportStaff || !interaction.member.roles.cache.has(SupportStaff.id))
) {
return interaction.reply({
embeds: [NoPerms],
flags: MessageFlags.Ephemeral,
});
}
if (subcommand === "transfer") {
if (!departmentsEnabled()) {
return interaction.reply({
content: "Departments are disabled, or ticket mode is set to threads.",
flags: MessageFlags.Ephemeral,
});
}
if (interaction.channel.type !== ChannelType.GuildText) {
return interaction.reply({
content: "Ticket transfer only works for ticket channels.",
flags: MessageFlags.Ephemeral,
});
}
const departmentKey = interaction.options.getString("department");
const requestedPriority = interaction.options.getString("priority");
const departments = getDepartments();
const departmentConfig = departments[departmentKey];
if (!departmentConfig) {
return interaction.reply({
content: "That department does not exist.",
flags: MessageFlags.Ephemeral,
});
}
const targetCategoryId = departmentConfig.Category;
const targetRoleId = departmentConfig.Role || null;
if (!targetCategoryId) {
return interaction.reply({
content: "That department does not have a category configured.",
flags: MessageFlags.Ephemeral,
});
}
const targetCategory = interaction.guild.channels.cache.get(targetCategoryId);
if (!targetCategory) {
return interaction.reply({
content: "The target department category could not be found.",
flags: MessageFlags.Ephemeral,
});
}
let finalPriority = ticket.priority || null;
if (requestedPriority) {
finalPriority = requestedPriority;
} else if (!finalPriority && departmentConfig.DefaultPriority) {
finalPriority = departmentConfig.DefaultPriority;
}
const oldDepartmentKey = ticket.department || null;
const oldDepartmentConfig = oldDepartmentKey ? departments[oldDepartmentKey] : null;
const oldRoleId = oldDepartmentConfig?.Role || null;
await interaction.channel.setParent(targetCategory.id);
if (oldRoleId && oldRoleId !== targetRoleId) {
await interaction.channel.permissionOverwrites.delete(oldRoleId).catch(() => { });
}
if (targetRoleId) {
await interaction.channel.permissionOverwrites.create(targetRoleId, {
ViewChannel: true,
SendMessages: true,
ReadMessageHistory: true,
});
}
if (typeof db.updateTicketDepartment === "function") {
db.updateTicketDepartment(interaction.channel.id, departmentKey);
}
if (finalPriority && typeof db.updateTicketPriority === "function") {
db.updateTicketPriority(interaction.channel.id, finalPriority);
}
const ticketNumber = ticket.number || interaction.channel.name.replace(/\D/g, "");
const newChannelName = buildTicketChannelName(
ticketNumber,
finalPriority,
departmentConfig,
);
if (interaction.channel.name !== newChannelName) {
await interaction.channel.setName(newChannelName).catch(() => { });
}
const deptEmoji = departmentConfig.Emoji || "🎫";
const deptName = departmentConfig.Name || departmentKey;
let description = `> **Department:** ${deptEmoji} ${deptName}`;
if (finalPriority && prioritiesEnabled()) {
const priorityConfig = getPriorities()[finalPriority];
const priorityEmoji = priorityConfig?.Emoji || "🟡";
const priorityName = priorityConfig?.Name || finalPriority;
description += `\n> **Priority:** ${priorityEmoji} ${priorityName}`;
}
description += `\n> **Transferred By:** <@${interaction.user.id}>`;
const embed = new EmbedBuilder()
.setTitle("Ticket Updated")
.setDescription(description)
.setColor(supportbot.Embed.Colours.Success);
return interaction.reply({
embeds: [embed],
});
}
if (subcommand === "priority") {
if (!prioritiesEnabled()) {
return interaction.reply({
content: "Priority is disabled, or ticket mode is set to threads.",
flags: MessageFlags.Ephemeral,
});
}
const level = interaction.options.getString("level");
const priorityConfig = getPriorities()[level];
if (!priorityConfig) {
return interaction.reply({
content: "That priority does not exist.",
flags: MessageFlags.Ephemeral,
});
}
if (typeof db.updateTicketPriority === "function") {
db.updateTicketPriority(interaction.channel.id, level);
}
const departments = getDepartments();
const departmentConfig = ticket.department ? departments[ticket.department] : null;
const ticketNumber = ticket.number || interaction.channel.name.replace(/\D/g, "");
const newChannelName = buildTicketChannelName(ticketNumber, level, departmentConfig);
if (interaction.channel.name !== newChannelName) {
await interaction.channel.setName(newChannelName).catch(() => { });
}
const priorityEmoji = priorityConfig.Emoji || "🟡";
const priorityName = priorityConfig.Name || level;
const embed = new EmbedBuilder()
.setTitle("Ticket Updated")
.setDescription(
`> **Priority:** ${priorityEmoji} ${priorityName}\n> **Updated By:** <@${interaction.user.id}>`,
)
.setColor(supportbot.Embed.Colours.Success);
return interaction.reply({
embeds: [embed],
});
}
if (subcommand === (cmdconfig.TicketManage?.ForceAdd?.Command || "forceadd")) {
const userToAdd = interaction.options.getUser("user");
const ticketChannel = interaction.channel;
if (
(supportbot.Ticket.TicketType === "threads" && !ticketChannel.isThread()) ||
(supportbot.Ticket.TicketType === "channels" &&
ticketChannel.type !== ChannelType.GuildText)
) {
const onlyInTicket = new EmbedBuilder()
.setTitle(msgconfig.ForceAddUser.NotInTicket_Title)
.setDescription(msgconfig.ForceAddUser.NotInTicket_Description)
.setColor(supportbot.Embed.Colours.Error);
return interaction.reply({
embeds: [onlyInTicket],
flags: MessageFlags.Ephemeral,
});
}
const ticketRow = db.getTicket(ticketChannel.id);
if (!ticketRow) {
const notFound = new EmbedBuilder()
.setTitle(msgconfig.ForceAddUser.NotInTicket_Title)
.setDescription(msgconfig.ForceAddUser.NotInTicket_Description)
.setColor(supportbot.Embed.Colours.Error);
return interaction.reply({
embeds: [notFound],
flags: MessageFlags.Ephemeral,
});
}
try {
if (supportbot.Ticket.TicketType === "threads") {
const botMember = await ticketChannel.members
.fetch(interaction.client.user.id)
.catch(() => null);
if (!botMember) await ticketChannel.join();
await new Promise((res) => setTimeout(res, 1000));
await ticketChannel.members.add(userToAdd.id);
} else {
await ticketChannel.permissionOverwrites.create(userToAdd.id, {
ViewChannel: true,
SendMessages: true,
ReadMessageHistory: true,
});
}
db.addUserToTicket(ticketChannel.id, userToAdd.id);
const addedEmbed = new EmbedBuilder()
.setTitle(msgconfig.ForceAddUser.Added_Title)
.setDescription(
msgconfig.ForceAddUser.Added_Description.replace("%username%", userToAdd.username),
)
.setColor(supportbot.Embed.Colours.Success);
await interaction.reply({
embeds: [addedEmbed],
flags: MessageFlags.Ephemeral,
});
if (supportbot.Ticket?.UserManagement?.DMOnAdd !== false) {
const addedToTicketEmbed = new EmbedBuilder()
.setTitle(msgconfig.ForceAddUser.AddedToTicket_Title)
.setDescription(
msgconfig.ForceAddUser.AddedToTicket_Description.replace(
"%channel_link%",
`[${ticketChannel.name}](https://discord.com/channels/${ticketChannel.guild.id}/${ticketChannel.id})`,
),
)
.setColor(supportbot.Embed.Colours.General);
await userToAdd.send({ embeds: [addedToTicketEmbed] }).catch(() => { });
}
} catch (err) {
console.error("Error adding user to the ticket:", err);
const errorEmbed = new EmbedBuilder()
.setTitle(msgconfig.ForceAddUser.Error_Title)
.setDescription(msgconfig.ForceAddUser.Error_Adding)
.setColor(supportbot.Embed.Colours.Error);
await interaction.reply({
embeds: [errorEmbed],
flags: MessageFlags.Ephemeral,
});
}
return;
}
if (subcommand === (cmdconfig.TicketManage?.ForceRemove?.Command || "forceremove")) {
const userToRemove = interaction.options.getUser("user");
const ticketChannel = interaction.channel;
if (
(supportbot.Ticket.TicketType === "threads" && !ticketChannel.isThread()) ||
(supportbot.Ticket.TicketType === "channels" &&
ticketChannel.type !== ChannelType.GuildText)
) {
const onlyInTicket = new EmbedBuilder()
.setTitle(msgconfig.RemoveUser.NotInTicket_Title)
.setDescription(msgconfig.RemoveUser.NotInTicket_Description)
.setColor(supportbot.Embed.Colours.Error);
return interaction.reply({
embeds: [onlyInTicket],
flags: MessageFlags.Ephemeral,
});
}
try {
if (supportbot.Ticket.TicketType === "threads") {
await ticketChannel.members.remove(userToRemove.id);
} else {
await ticketChannel.permissionOverwrites.delete(userToRemove.id);
}
db.removeUserFromTicket(ticketChannel.id, userToRemove.id);
const removedEmbed = new EmbedBuilder()
.setTitle(msgconfig.RemoveUser.Removed_Title)
.setDescription(msgconfig.RemoveUser.Removed_Message)
.setColor(supportbot.Embed.Colours.Success);
await interaction.reply({
embeds: [removedEmbed],
flags: MessageFlags.Ephemeral,
});
if (supportbot.Ticket?.UserManagement?.DMOnRemove !== false) {
const removedFromTicketEmbed = new EmbedBuilder()
.setTitle(msgconfig.RemoveUser.RemovedFromTicket_Title)
.setDescription(
msgconfig.RemoveUser.RemovedFromTicket_Description.replace(
"%channel_link%",
`[${ticketChannel.name}](https://discord.com/channels/${ticketChannel.guild.id}/${ticketChannel.id})`,
),
)
.setColor(supportbot.Embed.Colours.General);
await userToRemove.send({ embeds: [removedFromTicketEmbed] }).catch(() => { });
}
} catch (err) {
console.error("Error removing user from the ticket:", err);
const errorEmbed = new EmbedBuilder()
.setTitle(msgconfig.RemoveUser.Error_Title)
.setDescription(msgconfig.RemoveUser.Error_Removing)
.setColor(supportbot.Embed.Colours.Error);
await interaction.reply({
embeds: [errorEmbed],
flags: MessageFlags.Ephemeral,
});
}
return;
}
if (subcommand === (cmdconfig.TicketManage?.Rename?.Command || "rename")) {
const modal = new ModalBuilder()
.setCustomId("renameTicketModal")
.setTitle("Rename Channel")
.addComponents(
new ActionRowBuilder().addComponents(
new TextInputBuilder()
.setCustomId("renameTicket")
.setLabel("New Channel Name")
.setStyle(TextInputStyle.Short)
.setRequired(true),
),
);
return interaction.showModal(modal);
}
if (subcommand === (cmdconfig.TicketManage?.Close?.Command || "close")) {
const reason = interaction.options.getString("reason") || "Closed by staff.";
if (supportbot.Ticket.Close.StaffOnly) {
let CloseSupportStaff = await getRole(
supportbot.Roles.StaffMember.Staff,
interaction.guild,
);
let CloseAdmin = await getRole(supportbot.Roles.StaffMember.Admin, interaction.guild);
if (!CloseSupportStaff || !CloseAdmin) {
return interaction.reply({
content:
"Some roles seem to be missing! Please check for errors when starting the bot.",
flags: MessageFlags.Ephemeral,
});
}
const noClosePerms = new EmbedBuilder()
.setTitle("Invalid Permissions!")
.setDescription(
`${msgconfig.Error.IncorrectPerms}\n\nRole Required: \`${supportbot.Roles.StaffMember.Staff}\` or \`${supportbot.Roles.StaffMember.Admin}\``,
)
.setColor(supportbot.Embed.Colours.Warn);
if (
!interaction.member.roles.cache.has(CloseSupportStaff.id) &&
!interaction.member.roles.cache.has(CloseAdmin.id)
) {
return interaction.reply({
embeds: [noClosePerms],
flags: MessageFlags.Ephemeral,
});
}
}
const isThread = interaction.channel.type === ChannelType.PrivateThread;
if (
(supportbot.Ticket.TicketType === "threads" && !isThread) ||
(supportbot.Ticket.TicketType === "channels" &&
interaction.channel.type !== ChannelType.GuildText)
) {
const notTicketChannel = new EmbedBuilder()
.setTitle("Invalid Channel!")
.setDescription(
`This command can only be used in a ${supportbot.Ticket.TicketType === "threads" ? "ticket thread" : "ticket channel"}.`,
)
.setColor(supportbot.Embed.Colours.Warn);
return interaction.reply({
embeds: [notTicketChannel],
flags: MessageFlags.Ephemeral,
});
}
await interaction.deferReply({ flags: MessageFlags.Ephemeral });
const ticketData = db.getTicket(interaction.channel.id);
if (!ticketData) {
const exists = new EmbedBuilder()
.setTitle("No Ticket Found!")
.setDescription(msgconfig.Error.NoValidTicket)
.setColor(supportbot.Embed.Colours.Warn);
return interaction.followUp({
embeds: [exists],
flags: MessageFlags.Ephemeral,
});
}
try {
await TicketManager.createTranscript(interaction, ticketData, reason);
await interaction.followUp({
content: "Ticket closed successfully.",
flags: MessageFlags.Ephemeral,
});
await interaction.channel.delete().catch(() => { });
} catch (err) {
console.error("Error closing ticket:", err);
await interaction.followUp({
content: "An error occurred while closing the ticket.",
flags: MessageFlags.Ephemeral,
});
}
return;
}
return interaction.reply({
content: "Unknown ticket management action.",
flags: MessageFlags.Ephemeral,
});
} catch (error) {
console.error("Error in ticket manage command:", error);
if (!interaction.replied && !interaction.deferred) {
return interaction.reply({
content: "An error occurred while managing the ticket.",
flags: MessageFlags.Ephemeral,
});
}
}
},
});
File diff suppressed because it is too large. Load diff
+342
View File
@@ -0,0 +1,342 @@
// SupportBot | Emerald Services
// Ticket Panel Command
const fs = require("fs");
const {
ApplicationCommandType,
ActionRowBuilder,
ButtonBuilder,
ButtonStyle,
MessageFlags,
ContainerBuilder,
TextDisplayBuilder,
MediaGalleryBuilder,
SeparatorBuilder,
SectionBuilder,
StringSelectMenuBuilder,
ThumbnailBuilder,
EmbedBuilder,
} = require("discord.js");
const yaml = require("js-yaml");
const panelconfig = yaml.load(fs.readFileSync("./Configs/ticket-panel.yml", "utf8"));
const supportbot = yaml.load(fs.readFileSync("./Configs/supportbot.yml", "utf8"));
const cmdconfig = yaml.load(fs.readFileSync("./Configs/commands.yml", "utf8"));
const Command = require("../../Structures/Command.js");
const db = require("../../Structures/Database.js");
function parseButtonStyle(style) {
switch (String(style || "1")) {
case "1":
return ButtonStyle.Primary;
case "2":
return ButtonStyle.Secondary;
case "3":
return ButtonStyle.Danger;
case "4":
return ButtonStyle.Success;
default:
return ButtonStyle.Primary;
}
}
function getPanelMessage(key, fallback) {
return panelconfig.Messages?.[key] || fallback;
}
module.exports = new Command({
name: cmdconfig.TicketPanel.Command,
description: cmdconfig.TicketPanel.Description,
type: ApplicationCommandType.ChatInput,
options: [],
permissions: cmdconfig.TicketPanel.Permission,
async run(interaction) {
if (!panelconfig.Panel) {
console.log(
"\u001b[31m",
`[TICKET PANEL]`,
"\u001b[33m",
"Ticket Panel is not setup, You can set this in",
`\u001b[31m`,
"/Configs/ticket-panel.yml",
`\n `,
);
return interaction.reply({
content: getPanelMessage(
"NotConfigured",
"Ticket Panel is not set up. Please configure it in `/Configs/ticket-panel.yml`.",
),
flags: MessageFlags.Ephemeral,
});
}
const { getChannel } = interaction.client;
const channel = await getChannel(supportbot.Ticket.TicketHome, interaction.guild);
if (!channel) {
console.log(`[TICKET PANEL] TicketHome channel not found. Please check your config file.`);
return interaction.reply({
content: getPanelMessage(
"InvalidChannel",
"TicketHome channel not found. Please check your config file.",
),
flags: MessageFlags.Ephemeral,
});
}
const panelRow = db.getTicketPanel();
if (panelRow) {
try {
const oldMessage = await channel.messages.fetch(panelRow.message_id);
if (oldMessage) {
await oldMessage.delete().catch(() => { });
}
} catch (err) {
console.log(`[TICKET PANEL] Previous panel message not found, creating a new one.`);
}
}
const departmentSystem = supportbot.Ticket?.DepartmentSystem || {};
const prioritySystem = supportbot.Ticket?.PrioritySystem || {};
const usingThreads = supportbot.Ticket?.TicketType === "threads";
const departmentsEnabled = departmentSystem.Enabled === true && !usingThreads;
const prioritiesEnabled = prioritySystem.Enabled === true && !usingThreads;
const departments = departmentSystem.Departments || {};
if (usingThreads && (departmentSystem.Enabled || prioritySystem.Enabled)) {
console.log(
"[SupportBot] Departments and Priority are disabled because TicketType is set to 'threads'.",
);
}
const departmentOptions = Object.entries(departments)
.slice(0, 25)
.map(([key, dept]) => ({
label: dept.Name || key,
description:
dept.PanelDescription ||
dept.Description ||
panelconfig.DepartmentMenu?.DefaultDescription ||
`Open a ${String(dept.Name || key).toLowerCase()} ticket`,
value: key,
emoji:
dept.Emoji ||
panelconfig.DepartmentMenu?.DefaultEmoji ||
panelconfig.Button?.Emoji ||
undefined,
}));
const shouldUseDepartments = departmentsEnabled && departmentOptions.length > 0;
let openerComponent;
if (shouldUseDepartments) {
openerComponent = new StringSelectMenuBuilder()
.setCustomId(panelconfig.DepartmentMenu?.CustomId || "ticketdepartmentselect")
.setPlaceholder(
panelconfig.DepartmentMenu?.Placeholder ||
departmentSystem.Placeholder ||
panelconfig.Button?.Text ||
"Choose a ticket department",
)
.addOptions(departmentOptions);
} else {
openerComponent = new ButtonBuilder()
.setCustomId(panelconfig.Button?.CustomId || "createticket")
.setLabel(panelconfig.Button?.Text || "Create Ticket")
.setStyle(parseButtonStyle(panelconfig.Button?.Color));
if (panelconfig.Button?.Emoji) {
openerComponent.setEmoji(panelconfig.Button.Emoji);
}
}
const panelContainer = new ContainerBuilder();
if (panelconfig.Style?.Color) {
panelContainer.setAccentColor(parseInt(String(panelconfig.Style.Color).replace("#", ""), 16));
}
const layout = String(panelconfig.Style?.Layout || "3");
const showImage = panelconfig.Settings?.Image === true && !!panelconfig.Style?.Image;
const showTopTitle = panelconfig.Settings?.TopTitle === true;
const showTopDivider = panelconfig.Settings?.TopDivider === true;
const showBottomTitle = panelconfig.Settings?.BottomTitle === true;
const showBottomDivider = panelconfig.Settings?.BottomDivider === true;
const panelTitle = new TextDisplayBuilder().setContent(
panelconfig.Style?.Title || "## SupportBot Ticket Creation",
);
const rawTitle = (panelconfig.Style?.Title || "SupportBot Ticket Creation").replace(/^#+\s*/, "");
const panelDesc = new TextDisplayBuilder().setContent(
panelconfig.Style?.Description || "Click on the button below to create a support ticket.",
);
if (showTopTitle) {
panelContainer.addTextDisplayComponents(panelTitle);
}
if (showTopDivider) {
panelContainer.addSeparatorComponents(new SeparatorBuilder().setDivider(true));
}
if (layout === "1" || layout === "3") {
panelContainer.addTextDisplayComponents(panelDesc);
}
if (showImage && layout === "2") {
const panelImage = new MediaGalleryBuilder().addItems([
{
media: {
url: panelconfig.Style.Image,
},
},
]);
panelContainer.addMediaGalleryComponents(panelImage);
}
if (layout === "1") {
const middleSection = new SectionBuilder().addTextDisplayComponents(panelDesc);
if (!shouldUseDepartments) {
middleSection.setButtonAccessory(openerComponent);
panelContainer.addSectionComponents(middleSection);
} else {
panelContainer.addSectionComponents(middleSection);
panelContainer.addActionRowComponents(
new ActionRowBuilder().addComponents(openerComponent),
);
}
}
if (showImage && layout === "3") {
const panelImage = new MediaGalleryBuilder().addItems([
{
media: {
url: panelconfig.Style.Image,
},
},
]);
panelContainer.addMediaGalleryComponents(panelImage);
}
if (showBottomTitle) {
panelContainer.addTextDisplayComponents(panelTitle);
}
if (showBottomDivider) {
panelContainer.addSeparatorComponents(new SeparatorBuilder().setDivider(true));
}
if (layout === "2") {
const middleSection = new SectionBuilder().addTextDisplayComponents(panelDesc);
if (!shouldUseDepartments) {
middleSection.setButtonAccessory(openerComponent);
panelContainer.addSectionComponents(middleSection);
} else {
panelContainer.addSectionComponents(middleSection);
panelContainer.addActionRowComponents(
new ActionRowBuilder().addComponents(openerComponent),
);
}
}
if (layout === "3") {
panelContainer.addActionRowComponents(new ActionRowBuilder().addComponents(openerComponent));
}
if (layout === "4") {
// Create a classic Discord Embed for Layout 4
const oldEmbed = new EmbedBuilder()
.setTitle(rawTitle)
.setDescription(panelconfig.Style?.Description || "Click on the button below to create a support ticket.");
if (panelconfig.Style?.Color) {
oldEmbed.setColor(panelconfig.Style.Color);
}
if (showImage && panelconfig.Style?.Image) {
oldEmbed.setThumbnail(panelconfig.Style.Image);
}
try {
const message = await channel.send({
embeds: [oldEmbed],
components: [new ActionRowBuilder().addComponents(openerComponent)],
});
db.saveTicketPanel(message.id, channel.id);
return interaction.reply({
content: shouldUseDepartments
? getPanelMessage(
"PanelSentWithDepartments",
"Ticket panel message with department selection has been sent!",
)
: getPanelMessage("PanelSent", "Ticket panel message has been sent!"),
flags: MessageFlags.Ephemeral,
});
} catch (e) {
console.log("Error sending message:", e);
return interaction.reply({
content: getPanelMessage(
"SendError",
"An error occurred while sending the ticket panel message.",
),
flags: MessageFlags.Ephemeral,
});
}
}
if (showImage && layout === "1") {
const panelImage = new MediaGalleryBuilder().addItems([
{
media: {
url: panelconfig.Style.Image,
},
},
]);
panelContainer.addMediaGalleryComponents(panelImage);
}
try {
const message = await channel.send({
flags: MessageFlags.IsComponentsV2,
components: [panelContainer],
});
db.saveTicketPanel(message.id, channel.id);
return interaction.reply({
content: shouldUseDepartments
? getPanelMessage(
"PanelSentWithDepartments",
"Ticket panel message with department selection has been sent!",
)
: getPanelMessage("PanelSent", "Ticket panel message has been sent!"),
flags: MessageFlags.Ephemeral,
});
} catch (e) {
console.log("Error sending message:", e);
return interaction.reply({
content: getPanelMessage(
"SendError",
"An error occurred while sending the ticket panel message.",
),
flags: MessageFlags.Ephemeral,
});
}
},
});
+468
View File
@@ -0,0 +1,468 @@
const {
ApplicationCommandType,
ApplicationCommandOptionType,
ActionRowBuilder,
ButtonBuilder,
EmbedBuilder,
StringSelectMenuBuilder,
ModalBuilder,
TextInputBuilder,
TextInputStyle,
ButtonStyle,
ComponentType,
MessageFlags,
} = require('discord.js');
const Command = require('../../Structures/Command.js');
const fs = require('fs');
const yaml = require('js-yaml');
const supportbot = yaml.load(fs.readFileSync('./Configs/supportbot.yml', 'utf8'));
const cmdconfig = yaml.load(fs.readFileSync('./Configs/commands.yml', 'utf8'));
const msgconfig = yaml.load(fs.readFileSync('./Configs/messages.yml', 'utf8'));
function parseColor(color) {
if (!color) return 0x5865F2;
if (typeof color === 'number') return color;
if (typeof color !== 'string') return 0x5865F2;
color = color.replace('#', '');
if (/^[0-9A-F]{6}$/i.test(color)) {
return parseInt(color, 16);
}
return 0x5865F2;
}
module.exports = new Command({
name: cmdconfig.Embed.Command,
description: cmdconfig.Embed.Description,
type: ApplicationCommandType.ChatInput,
options: [
{
name: 'channel',
description: 'Select channel to send the message',
type: ApplicationCommandOptionType.Channel,
required: true
}
],
permissions: cmdconfig.Embed.Permission,
async run(interaction) {
const { getRole } = interaction.client;
let SupportStaff = await getRole(supportbot.Roles.StaffMember.Staff, interaction.guild);
let Admin = await getRole(supportbot.Roles.StaffMember.Admin, interaction.guild);
if (!SupportStaff || !Admin) {
return interaction.reply('Some roles seem to be missing!\nPlease check for errors when starting the bot.');
}
if (!interaction.member.roles.cache.has(SupportStaff.id) &&
!interaction.member.roles.cache.has(Admin.id)) {
const NoPerms = new EmbedBuilder()
.setTitle('Invalid Permissions!')
.setDescription(`${msgconfig.Error.IncorrectPerms}\n\nRole Required: \`${supportbot.Roles.StaffMember.Staff}\` or \`${supportbot.Roles.StaffMember.Admin}\``)
.setColor(0xFF0000);
return interaction.reply({ embeds: [NoPerms], flags: MessageFlags.Ephemeral });
}
const channel = interaction.options.getChannel('channel');
const messageData = {
type: 'embed',
title: 'New Embed',
description: 'Click the buttons below to edit this embed',
color: 0x5865F2,
fields: [],
footer: null,
thumbnail: null,
image: null,
timestamp: false
};
function createEmbed() {
const embed = new EmbedBuilder()
.setTitle(messageData.title)
.setDescription(messageData.description)
.setColor(messageData.color);
if (messageData.fields.length > 0) {
embed.addFields(messageData.fields);
}
if (messageData.footer) {
embed.setFooter({ text: messageData.footer });
}
if (messageData.thumbnail) {
embed.setThumbnail(messageData.thumbnail);
}
if (messageData.image) {
embed.setImage(messageData.image);
}
if (messageData.timestamp) {
embed.setTimestamp();
}
return embed;
}
const typeRow = new ActionRowBuilder()
.addComponents(
new StringSelectMenuBuilder()
.setCustomId('message_type')
.setPlaceholder('Select message type')
.addOptions([
{
label: 'Embed Message',
description: 'Send as an embedded message',
value: 'embed'
},
{
label: 'Text Message',
description: 'Send as a plain text message',
value: 'text'
}
])
);
function createButtons(messageType) {
const buttons = [];
if (messageType === 'embed') {
const row1 = new ActionRowBuilder()
.addComponents(
new ButtonBuilder()
.setCustomId('edit_title')
.setLabel('Edit Title')
.setStyle(ButtonStyle.Secondary),
new ButtonBuilder()
.setCustomId('edit_description')
.setLabel('Edit Description')
.setStyle(ButtonStyle.Secondary),
new ButtonBuilder()
.setCustomId('edit_color')
.setLabel('Edit Color')
.setStyle(ButtonStyle.Secondary),
new ButtonBuilder()
.setCustomId('add_field')
.setLabel('Add Field')
.setStyle(ButtonStyle.Secondary)
);
const row2 = new ActionRowBuilder()
.addComponents(
new ButtonBuilder()
.setCustomId('edit_footer')
.setLabel('Edit Footer')
.setStyle(ButtonStyle.Secondary),
new ButtonBuilder()
.setCustomId('edit_image')
.setLabel('Add Image')
.setStyle(ButtonStyle.Secondary),
new ButtonBuilder()
.setCustomId('edit_thumbnail')
.setLabel('Add Thumbnail')
.setStyle(ButtonStyle.Secondary),
new ButtonBuilder()
.setCustomId('toggle_timestamp')
.setLabel('Toggle Timestamp')
.setStyle(ButtonStyle.Secondary)
);
buttons.push(row1, row2);
} else {
const textRow = new ActionRowBuilder()
.addComponents(
new ButtonBuilder()
.setCustomId('edit_description')
.setLabel('Edit Text')
.setStyle(ButtonStyle.Secondary)
);
buttons.push(textRow);
}
// Send button always shows
const sendRow = new ActionRowBuilder()
.addComponents(
new ButtonBuilder()
.setCustomId('send_message')
.setLabel('Send')
.setStyle(ButtonStyle.Success)
);
buttons.push(sendRow);
return buttons;
}
async function updatePreview(i) {
if (messageData.type === 'embed') {
await i.update({
content: 'Customize your message:',
embeds: [createEmbed()],
components: [typeRow, ...createButtons('embed')]
});
} else {
await i.update({
content: messageData.description,
embeds: [],
components: [typeRow, ...createButtons('text')]
});
}
}
const message = await interaction.reply({
content: messageData.type === 'text' ? messageData.description : 'Customize your message:',
components: [typeRow, ...createButtons(messageData.type)],
embeds: messageData.type === 'embed' ? [createEmbed()] : [],
flags: MessageFlags.Ephemeral
});
const collector = message.createMessageComponentCollector({
time: 900000
});
collector.on('collect', async (i) => {
if (i.user.id !== interaction.user.id) {
return i.reply({
content: 'You cannot edit this message.',
flags: MessageFlags.Ephemeral
});
}
switch (i.customId) {
case 'message_type':
messageData.type = i.values[0];
await updatePreview(i);
break;
case 'edit_description':
const descModal = new ModalBuilder()
.setCustomId('desc_modal')
.setTitle(messageData.type === 'embed' ? 'Edit Description' : 'Edit Text');
descModal.addComponents(
new ActionRowBuilder()
.addComponents(
new TextInputBuilder()
.setCustomId('desc_input')
.setLabel(messageData.type === 'embed' ? 'Description' : 'Message Text')
.setStyle(TextInputStyle.Paragraph)
.setValue(messageData.description)
.setMaxLength(4000)
)
);
await i.showModal(descModal);
break;
case 'edit_title':
const titleModal = new ModalBuilder()
.setCustomId('title_modal')
.setTitle('Edit Title');
titleModal.addComponents(
new ActionRowBuilder()
.addComponents(
new TextInputBuilder()
.setCustomId('title_input')
.setLabel('Title')
.setStyle(TextInputStyle.Short)
.setValue(messageData.title)
.setMaxLength(256)
)
);
await i.showModal(titleModal);
break;
case 'edit_color':
const colorModal = new ModalBuilder()
.setCustomId('color_modal')
.setTitle('Edit Color');
colorModal.addComponents(
new ActionRowBuilder()
.addComponents(
new TextInputBuilder()
.setCustomId('color_input')
.setLabel('Color (HEX)')
.setStyle(TextInputStyle.Short)
.setPlaceholder('#FF0000')
.setMinLength(6)
.setMaxLength(7)
.setValue(messageData.color.toString(16).padStart(6, '0'))
)
);
await i.showModal(colorModal);
break;
case 'add_field':
const fieldModal = new ModalBuilder()
.setCustomId('field_modal')
.setTitle('Add Field');
fieldModal.addComponents(
new ActionRowBuilder()
.addComponents(
new TextInputBuilder()
.setCustomId('field_name')
.setLabel('Field Name')
.setStyle(TextInputStyle.Short)
.setMaxLength(256)
),
new ActionRowBuilder()
.addComponents(
new TextInputBuilder()
.setCustomId('field_value')
.setLabel('Field Value')
.setStyle(TextInputStyle.Paragraph)
.setMaxLength(1024)
),
new ActionRowBuilder()
.addComponents(
new TextInputBuilder()
.setCustomId('field_inline')
.setLabel('Inline? (true/false)')
.setStyle(TextInputStyle.Short)
.setValue('false')
.setPlaceholder('true or false')
)
);
await i.showModal(fieldModal);
break;
case 'edit_footer':
const footerModal = new ModalBuilder()
.setCustomId('footer_modal')
.setTitle('Edit Footer');
footerModal.addComponents(
new ActionRowBuilder()
.addComponents(
new TextInputBuilder()
.setCustomId('footer_input')
.setLabel('Footer Text')
.setStyle(TextInputStyle.Short)
.setValue(messageData.footer || '')
.setMaxLength(2048)
)
);
await i.showModal(footerModal);
break;
case 'edit_image':
const imageModal = new ModalBuilder()
.setCustomId('image_modal')
.setTitle('Add Image');
imageModal.addComponents(
new ActionRowBuilder()
.addComponents(
new TextInputBuilder()
.setCustomId('image_input')
.setLabel('Image URL')
.setStyle(TextInputStyle.Short)
.setValue(messageData.image || '')
.setPlaceholder('https://example.com/image.png')
)
);
await i.showModal(imageModal);
break;
case 'edit_thumbnail':
const thumbnailModal = new ModalBuilder()
.setCustomId('thumbnail_modal')
.setTitle('Add Thumbnail');
thumbnailModal.addComponents(
new ActionRowBuilder()
.addComponents(
new TextInputBuilder()
.setCustomId('thumbnail_input')
.setLabel('Thumbnail URL')
.setStyle(TextInputStyle.Short)
.setValue(messageData.thumbnail || '')
.setPlaceholder('https://example.com/thumbnail.png')
)
);
await i.showModal(thumbnailModal);
break;
case 'toggle_timestamp':
messageData.timestamp = !messageData.timestamp;
await updatePreview(i);
break;
case 'send_message':
try {
if (messageData.type === 'embed') {
await channel.send({ embeds: [createEmbed()] });
} else {
await channel.send(messageData.description);
}
await i.update({
content: 'Message sent successfully!',
components: [],
embeds: []
});
collector.stop();
} catch (error) {
await i.reply({
content: 'Failed to send message. Please check channel permissions.',
flags: MessageFlags.Ephemeral
});
}
break;
}
});
// Handle modal submissions
interaction.client.on('interactionCreate', async (modal) => {
if (!modal.isModalSubmit()) return;
if (modal.user.id !== interaction.user.id) return;
switch (modal.customId) {
case 'title_modal':
messageData.title = modal.fields.getTextInputValue('title_input');
break;
case 'desc_modal':
messageData.description = modal.fields.getTextInputValue('desc_input');
break;
case 'color_modal':
messageData.color = parseColor(modal.fields.getTextInputValue('color_input'));
break;
case 'field_modal':
const inlineValue = modal.fields.getTextInputValue('field_inline').toLowerCase();
messageData.fields.push({
name: modal.fields.getTextInputValue('field_name'),
value: modal.fields.getTextInputValue('field_value'),
inline: inlineValue === 'true'
});
break;
case 'footer_modal':
messageData.footer = modal.fields.getTextInputValue('footer_input');
break;
case 'image_modal':
messageData.image = modal.fields.getTextInputValue('image_input');
break;
case 'thumbnail_modal':
messageData.thumbnail = modal.fields.getTextInputValue('thumbnail_input');
break;
default:
return;
}
await updatePreview(modal);
});
collector.on('end', () => {
interaction.editReply({
content: 'Message editor timed out.',
components: [],
embeds: []
}).catch(() => {});
});
}
});
+261
View File
@@ -0,0 +1,261 @@
const fs = require("fs");
const { ApplicationCommandOptionType, ApplicationCommandType, EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle, ComponentType, MessageFlags } = require("discord.js");
const yaml = require("js-yaml");
const supportbot = yaml.load(fs.readFileSync("./Configs/supportbot.yml", "utf8"));
const cmdconfig = yaml.load(fs.readFileSync("./Configs/commands.yml", "utf8"));
const msgconfig = yaml.load(fs.readFileSync("./Configs/messages.yml", "utf8"));
const Command = require("../../Structures/Command.js");
// Function to chunk array into smaller arrays
function chunkArray(arr, size) {
const chunks = [];
for (let i = 0; i < arr.length; i += size) {
chunks.push(arr.slice(i, i + size));
}
return chunks;
}
module.exports = new Command({
name: cmdconfig.Mod.Command,
description: cmdconfig.Mod.Command,
type: ApplicationCommandType.ChatInput,
options: [
{
name: cmdconfig.Mod.TicketBlacklist.Command,
description: cmdconfig.Mod.TicketBlacklist.Description,
type: ApplicationCommandOptionType.SubcommandGroup,
options: [
{
name: cmdconfig.Mod.TicketBlacklist.Add.Command,
description: msgconfig.Mod.TicketBlacklist.Add.Description || "Add a user to the ticket blacklist",
type: ApplicationCommandOptionType.Subcommand,
options: [
{
name: 'user',
description: msgconfig.Mod.TicketBlacklist.Add.UserDescription || "User to blacklist",
type: ApplicationCommandOptionType.User,
required: true
},
{
name: 'reason',
description: msgconfig.Mod.TicketBlacklist.Add.ReasonDescription || "Reason for blacklisting",
type: ApplicationCommandOptionType.String,
required: false
}
]
},
{
name: cmdconfig.Mod.TicketBlacklist.Remove.Command,
description: msgconfig.Mod.TicketBlacklist.Remove.Description || "Remove a user from the ticket blacklist",
type: ApplicationCommandOptionType.Subcommand,
options: [
{
name: 'user',
description: msgconfig.Mod.TicketBlacklist.Remove.UserDescription || "User to remove from blacklist",
type: ApplicationCommandOptionType.User,
required: true
},
{
name: 'reason',
description: msgconfig.Mod.TicketBlacklist.Remove.ReasonDescription || "Reason for removing from blacklist",
type: ApplicationCommandOptionType.String,
required: false
}
]
},
{
name: "view",
description: msgconfig.Mod.TicketBlacklist.View.Description || "View all blacklisted users",
type: ApplicationCommandOptionType.Subcommand,
}
]
}
],
permissions: cmdconfig.Mod.Permission,
async run(interaction) {
const { getRole } = interaction.client;
let SupportStaff = await getRole(supportbot.Roles.StaffMember.Staff, interaction.guild);
let Admin = await getRole(supportbot.Roles.StaffMember.Admin, interaction.guild);
let Moderator = await getRole(supportbot.Roles.StaffMember.Moderator, interaction.guild);
if (!SupportStaff || !Admin || !Moderator) {
const missingRolesEmbed = new EmbedBuilder()
.setDescription(msgconfig.Error.InvalidChannel || "Required roles are missing!")
.setColor(supportbot.Embed.Colours.Warn);
return interaction.reply({ embeds: [missingRolesEmbed] });
}
const NoPerms = new EmbedBuilder()
.setDescription(msgconfig.Error.IncorrectPerms || "You do not have the correct permissions!")
.setColor(supportbot.Embed.Colours.Warn);
if (!interaction.member.roles.cache.has(Admin.id) && !interaction.member.roles.cache.has(Moderator.id) && (!supportbot.Mod.AllowSupportStaff || !interaction.member.roles.cache.has(SupportStaff.id))) {
return interaction.reply({ embeds: [NoPerms] });
}
const subcommand = interaction.options.getSubcommand(false);
const user = interaction.options.getUser('user');
const reason = interaction.options.getString('reason') || "No reason provided";
try {
let blacklistedUsers;
try {
blacklistedUsers = JSON.parse(fs.readFileSync("./Data/BlacklistedUsers.json", "utf8")).blacklistedUsers;
if (!Array.isArray(blacklistedUsers)) {
blacklistedUsers = [];
}
} catch (error) {
blacklistedUsers = [];
}
if (subcommand === cmdconfig.Mod.TicketBlacklist.Add.Command) {
if (blacklistedUsers.includes(user.id)) {
const alreadyBlacklistedEmbed = new EmbedBuilder()
.setDescription(msgconfig.Mod.TicketBlacklist.Add.AlreadyBlacklisted.replace("{userTag}", user.tag) || ":x: User is already blacklisted.")
.setColor(supportbot.Embed.Colours.Warn);
return interaction.reply({ embeds: [alreadyBlacklistedEmbed], flags: MessageFlags.Ephemeral });
}
blacklistedUsers.push(user.id);
fs.writeFileSync("./Data/BlacklistedUsers.json", JSON.stringify({ "blacklistedUsers": blacklistedUsers }, null, 4));
const successEmbed = new EmbedBuilder()
.setDescription(msgconfig.Mod.TicketBlacklist.Add.Success.replace("{userTag}", user.tag) || ":white_check_mark: User has been blacklisted.")
.setColor(supportbot.Embed.Colours.Success);
const blacklistChannel = interaction.guild.channels.cache.get(supportbot.Ticket.Log.TicketBlacklistLog);
if (blacklistChannel) {
const blacklistLogEmbed = new EmbedBuilder()
.setTitle(msgconfig.TicketBlacklistLog.Title || "Ticket Blacklist Log")
.setColor(msgconfig.TicketBlacklistLog.Colour || supportbot.Embed.Colours.Success)
.setFooter({ text: supportbot.Embed.Footer, iconURL: interaction.user.displayAvatarURL() })
.setDescription(`> **User:** ${user.tag} (\`${user.id}\`)\n> **Actioned by:** <@${interaction.user.id}>`)
.addFields({ name: "Action", value: "\`\`\`Removed from blacklist\`\`\`", inline: false })
.addFields({ name: "Reason", value: `\`\`\`${reason}\`\`\``, inline: false });
blacklistChannel.send({ embeds: [blacklistLogEmbed] });
}
return interaction.reply({
embeds: [successEmbed],
flags: MessageFlags.Ephemeral
});
} else if (subcommand === cmdconfig.Mod.TicketBlacklist.Remove.Command) {
if (!blacklistedUsers.includes(user.id)) {
const notBlacklistedEmbed = new EmbedBuilder()
.setDescription(msgconfig.Mod.TicketBlacklist.Remove.NotBlacklisted.replace("{userTag}", user.tag) || ":x: User is not blacklisted.")
.setColor(supportbot.Embed.Colours.Warn);
return interaction.reply({ embeds: [notBlacklistedEmbed], flags: MessageFlags.Ephemeral });
}
blacklistedUsers = blacklistedUsers.filter(id => id !== user.id);
fs.writeFileSync("./Data/BlacklistedUsers.json", JSON.stringify({ "blacklistedUsers": blacklistedUsers }, null, 4));
const removedEmbed = new EmbedBuilder()
.setDescription(msgconfig.Mod.TicketBlacklist.Remove.Success.replace("{userTag}", user.tag) || ":white_check_mark: User has been removed from the blacklist.")
.setColor(supportbot.Embed.Colours.Success);
const blacklistChannel = interaction.guild.channels.cache.get(supportbot.Ticket.Log.TicketBlacklistLog);
if (blacklistChannel) {
const blacklistLogEmbed = new EmbedBuilder()
.setTitle(msgconfig.TicketBlacklistLog.Title || "Ticket Blacklist Log")
.setColor(msgconfig.TicketBlacklistLog.Colour || supportbot.Embed.Colours.Success)
.setFooter({ text: supportbot.Embed.Footer, iconURL: interaction.user.displayAvatarURL() })
.setDescription(`> **User:** ${user.tag} (\`${user.id}\`)\n> **Actioned by:** <@${interaction.user.id}>`)
.addFields({ name: "Action", value: "\`\`\`Removed from blacklist\`\`\`", inline: false })
.addFields({ name: "Reason", value: `\`\`\`${reason}\`\`\``, inline: false });
blacklistChannel.send({ embeds: [blacklistLogEmbed] });
}
return interaction.reply({ embeds: [removedEmbed], flags: MessageFlags.Ephemeral });
} else if (subcommand === "view") {
if (blacklistedUsers.length === 0) {
const noBlacklistedUsersEmbed = new EmbedBuilder()
.setDescription(msgconfig.Mod.TicketBlacklist.View.NoBlacklistedUsers || "No users are blacklisted.")
.setColor(supportbot.Embed.Colours.Success);
return interaction.reply({ embeds: [noBlacklistedUsersEmbed], flags: MessageFlags.Ephemeral });
}
const chunkedUsers = chunkArray(blacklistedUsers, 5);
let currentPage = 0;
const createEmbed = (page) => {
return new EmbedBuilder()
.setTitle(msgconfig.Mod.TicketBlacklist.View.EmbedTitle || "Blacklisted Users")
.setDescription(chunkedUsers[page].map(id => `<@${id}>`).join("\n"))
.setColor(supportbot.Embed.Colours.Success)
.setFooter({ text: `Page ${page + 1} of ${chunkedUsers.length}` });
};
const buttons = new ActionRowBuilder()
.addComponents(
new ButtonBuilder()
.setCustomId('previous')
.setLabel('Previous')
.setStyle(ButtonStyle.Secondary)
.setDisabled(currentPage === 0),
new ButtonBuilder()
.setCustomId('next')
.setLabel('Next')
.setStyle(ButtonStyle.Secondary)
.setDisabled(currentPage === chunkedUsers.length - 1)
);
const response = await interaction.reply({
embeds: [createEmbed(currentPage)],
components: chunkedUsers.length > 1 ? [buttons] : [],
flags: MessageFlags.Ephemeral
});
if (chunkedUsers.length <= 1) return;
const collector = response.createMessageComponentCollector({
componentType: ComponentType.Button,
time: 60000
});
collector.on('collect', async (i) => {
if (i.user.id !== interaction.user.id) {
return i.reply({
content: 'You cannot use these buttons.',
flags: MessageFlags.Ephemeral
});
}
if (i.customId === 'previous' && currentPage > 0) {
currentPage--;
} else if (i.customId === 'next' && currentPage < chunkedUsers.length - 1) {
currentPage++;
}
buttons.components[0].setDisabled(currentPage === 0);
buttons.components[1].setDisabled(currentPage === chunkedUsers.length - 1);
await i.update({
embeds: [createEmbed(currentPage)],
components: [buttons]
});
});
collector.on('end', () => {
buttons.components.forEach(button => button.setDisabled(true));
interaction.editReply({
components: [buttons]
}).catch(() => {});
});
}
} catch (error) {
console.error("Error in mod command:", error);
const errorEmbed = new EmbedBuilder()
.setDescription(msgconfig.Error.ActionFailed || "An error occurred while processing your request.")
.setColor(supportbot.Embed.Colours.Warn);
interaction.reply({ embeds: [errorEmbed], flags: MessageFlags.Ephemeral });
}
}
});
+237
View File
@@ -0,0 +1,237 @@
const { Command } = require('../../Structures/Addon.js');
const Discord = require("discord.js");
const fs = require("fs");
const yaml = require("js-yaml");
const db = require("../../Structures/Database.js");
const supportbot = yaml.load(fs.readFileSync("./Configs/supportbot.yml", "utf8"));
const cmdconfig = yaml.load(fs.readFileSync("./Configs/commands.yml", "utf8"));
async function loadSettings() {
return new Promise((resolve, reject) => {
db.get("SELECT data FROM settings WHERE id = 1", (err, row) => {
if (err) return reject(err);
if (!row) return resolve({});
try {
resolve(JSON.parse(row.data));
} catch (e) {
resolve({});
}
});
});
}
async function saveSettings(settings) {
const data = JSON.stringify(settings);
return new Promise((resolve, reject) => {
db.run(
"INSERT INTO settings (id, data) VALUES (1, ?) ON CONFLICT(id) DO UPDATE SET data = excluded.data",
[data],
(err) => (err ? reject(err) : resolve())
);
});
}
module.exports = new Command({
name: cmdconfig.Settings.Command,
description: cmdconfig.Settings.Description,
permissions: cmdconfig.Settings.Permission,
options: [
{
name: 'setstatus',
type: Discord.ApplicationCommandOptionType.Subcommand,
description: 'Set the bot status',
options: [
{
name: 'status',
type: Discord.ApplicationCommandOptionType.String,
description: 'Choose the bot status',
required: true,
choices: [
{ name: 'Online 🟢', value: 'online' },
{ name: 'Idle 🌙', value: 'idle' },
{ name: 'Do Not Disturb ⛔', value: 'dnd' },
{ name: 'Invisible 👻', value: 'invisible' }
],
},
],
},
{
name: 'setactivity',
type: Discord.ApplicationCommandOptionType.Subcommand,
description: 'Set the bot activity',
options: [
{
name: 'type',
type: Discord.ApplicationCommandOptionType.String,
description: 'Choose the activity type',
required: true,
choices: [
{ name: 'Playing 🎮', value: 'PLAYING' },
{ name: 'Watching 👀', value: 'WATCHING' },
{ name: 'Listening 🎧', value: 'LISTENING' },
{ name: 'Competing 🏆', value: 'COMPETING' }
],
},
{
name: 'message',
type: Discord.ApplicationCommandOptionType.String,
description: 'The activity message',
required: true,
},
],
},
{
name: 'streammode',
type: Discord.ApplicationCommandOptionType.Subcommand,
description: 'Set the bot streaming status',
options: [
{
name: 'toggle',
type: Discord.ApplicationCommandOptionType.String,
description: 'Turn streaming mode on or off',
required: true,
choices: [
{ name: 'On', value: 'on' },
{ name: 'Off', value: 'off' }
],
},
{
name: 'twitchurl',
type: Discord.ApplicationCommandOptionType.String,
description: 'Twitch stream URL (Required if turning on)',
required: false,
},
],
},
{
name: 'setnickname',
type: Discord.ApplicationCommandOptionType.Subcommand,
description: 'Set the bot nickname',
options: [
{
name: 'nickname',
type: Discord.ApplicationCommandOptionType.String,
description: 'The new nickname for the bot',
required: true,
},
],
},
],
async run(interaction) {
const subcommand = interaction.options.getSubcommand();
const settings = await loadSettings();
if (subcommand === 'setstatus') {
const status = interaction.options.getString('status');
try {
interaction.client.user.setPresence({
status: status,
activities: interaction.client.user.presence.activities || [],
});
settings.status = status;
await saveSettings(settings);
const embed = new Discord.EmbedBuilder()
.setDescription(`Status set to **${status.charAt(0).toUpperCase() + status.slice(1)}**`)
.setColor(supportbot.Embed.Colours.General);
return interaction.reply({ embeds: [embed], flags: Discord.MessageFlags.Ephemeral });
} catch (error) {
return interaction.reply({ content: `Failed to set status: ${error.message}`, flags: Discord.MessageFlags.Ephemeral });
}
}
if (subcommand === 'setactivity') {
const activityType = interaction.options.getString('type');
const activityMessage = interaction.options.getString('message');
try {
interaction.client.user.setPresence({
activities: [{ name: activityMessage, type: Discord.ActivityType[activityType] }],
status: interaction.client.user.presence.status || 'online',
});
settings.activity = { type: activityType, message: activityMessage };
await saveSettings(settings);
const embed = new Discord.EmbedBuilder()
.setDescription(`Activity set to **${activityType.toLowerCase()} ${activityMessage}**`)
.setColor(supportbot.Embed.Colours.General);
return interaction.reply({ embeds: [embed], flags: Discord.MessageFlags.Ephemeral });
} catch (error) {
return interaction.reply({ content: `Failed to set activity: ${error.message}`, flags: Discord.MessageFlags.Ephemeral });
}
} else if (subcommand === 'streammode') {
const toggle = interaction.options.getString('toggle');
const twitchUrl = interaction.options.getString('twitchurl');
if (toggle === 'on') {
if (!twitchUrl) {
return interaction.reply({ content: 'Please provide a Twitch URL to stream.', flags: Discord.MessageFlags.Ephemeral });
}
try {
interaction.client.user.setPresence({
activities: [{ name: 'Streaming', type: Discord.ActivityType.Streaming, url: twitchUrl }],
status: 'online',
});
settings.streaming = { active: true, url: twitchUrl };
await saveSettings(settings);
const embed = new Discord.EmbedBuilder()
.setDescription(`**Streaming mode enabled!**\nStreaming: [Twitch](${twitchUrl})`)
.setColor(supportbot.Embed.Colours.General);
return interaction.reply({ embeds: [embed], flags: Discord.MessageFlags.Ephemeral });
} catch (error) {
return interaction.reply({ content: `Failed to enable streaming mode: ${error.message}`, flags: Discord.MessageFlags.Ephemeral });
}
} else if (toggle === 'off') {
try {
interaction.client.user.setPresence({
activities: interaction.client.user.presence.activities.filter(a => a.type !== Discord.ActivityType.Streaming),
status: settings.status || 'online',
});
settings.streaming = { active: false };
await saveSettings(settings);
const embed = new Discord.EmbedBuilder()
.setDescription(`**Streaming mode disabled!**`)
.setColor(supportbot.Embed.Colours.General);
return interaction.reply({ embeds: [embed], flags: Discord.MessageFlags.Ephemeral });
} catch (error) {
return interaction.reply({ content: `Failed to disable streaming mode: ${error.message}`, flags: Discord.MessageFlags.Ephemeral });
}
}
} else if (subcommand === 'setnickname') {
const nickname = interaction.options.getString('nickname');
try {
const guild = interaction.guild;
const botMember = guild.members.cache.get(interaction.client.user.id);
await botMember.setNickname(nickname);
settings.nickname = nickname;
await saveSettings(settings);
const embed = new Discord.EmbedBuilder()
.setDescription(`Bot nickname set to **${nickname}**`)
.setColor(supportbot.Embed.Colours.General);
return interaction.reply({ embeds: [embed], flags: Discord.MessageFlags.Ephemeral });
} catch (error) {
return interaction.reply({ content: `Failed to set nickname: ${error.message}`, flags: Discord.MessageFlags.Ephemeral });
}
} else {
return interaction.reply({ content: 'Invalid command usage.', flags: Discord.MessageFlags.Ephemeral });
}
},
});
+8
View File
@@ -0,0 +1,8 @@
# -------------------------------
# API Server Configuration
# -------------------------------
API:
Enabled: true
Port: 3000 # PORT NUMBER FOR YOUR BOT
SecretKey: "PUT_RANDOM_STRING_HERE" # DO NOT SHARE THIS KEY WITH ANYONE
+196
View File
@@ -0,0 +1,196 @@
# ___ _ ___ _
# / __> _ _ ___ ___ ___ _ _ _| |_ | . > ___ _| |_
# \__ \| | || . \| . \/ . \| '_> | | | . \/ . \ | |
# <___/`___|| _/| _/\___/|_| |_| |___/\___/ |_|
# |_| |_|
#
# SupportBot created by Emerald Services
# Installed with MIT License
#
# Discord Support: https://discord.gg/emeraldsrv
# Official Documentation: https://docs.emeraldsrv.com
# Addons Marketplace: https://community.emeraldsrv.com
#
# Commands Configuration (commands.yml)
Help:
Command: "help"
Description: "Get a list of all the commands."
Permission: ["SendMessages"]
Enabled: true
Info:
Command: "info"
Description: "Get information about the **ServerName**."
Permission: ["SendMessages"]
Enabled: true
TicketPanel:
Command: "ticketpanel"
Description: "Create the ticket creation panel"
Permission: ["Administrator"]
Enabled: true
Profile:
Command: "profile"
Description: "Shows the profile for a discord member."
Permission: ["SendMessages"]
# Command is automatically disabled when the TicketClaims is disabled.
OpenTicket:
Command: "ticket"
Description: "Create a support ticket."
Permission: ["SendMessages"]
Enabled: true
AddUser:
Command: "add"
Description: "Add a user to a support ticket."
Permission: ["SendMessages"]
Enabled: true
CloseTicket:
Command: "close"
Description: "Close a support ticket"
Permission: ["SendMessages"]
Enabled: true
TicketManage:
Command: "ticketmanage"
Description: "Manage an existing support ticket."
Permission: ["SendMessages"]
Enabled: true
Close:
Command: "close"
Description: "Close a support ticket."
ForceAdd:
Command: "forceadd"
Description: "Add a user to a support ticket by bypassing the invite system."
ForceRemove:
Command: "forceremove"
Description: "Remove a user from a support ticket by bypassing the normal restrictions."
Rename:
Command: "rename"
Description: "Rename a support ticket by bypassing the normal restrictions."
Suggestion:
Command: "suggest"
Description: "Create a suggestion."
Permission: ["SendMessages"]
Enabled: true
SuggestionAdmin:
Command: "suggestadmin"
Description: "Update a suggestion’s status."
Permission: ['SendMessages']
# Disable "Suggestion" to disable this command.
Embed:
Command: "embed"
Description: "Build a discord embed."
Permission: ["SendMessages"]
Enabled: true
Translate:
Command: "translate"
Description: "Translate something to english"
Permission: ["SendMessages"]
Enabled: true
UserInfo:
Command: "userinfo"
Description: "Get info about a user."
Permission: ["SendMessages"]
Enabled: true
Ping:
Command: "ping"
Description: "Pong."
Permission: ["SendMessages"]
Enabled: true
# ---------------------------------------
# Bot Moderator Commands
# ---------------------------------------
Mod:
Command: "mod"
Description: "Execute a moderation action."
Permission: ["BanMembers", "KickMembers"]
Enabled: true
TicketBlacklist:
Command: "ticket-blacklist"
Description: "Blacklist a user from creating Tickets."
Add:
Command: "add"
Description: "Add a user to the blacklist."
Remove:
Command: "remove"
Description: "Remove a user from the blacklist."
View:
Command: "view"
Description: "View all blacklisted users."
# ---------------------------------------
# Bot Administrator Commands
# ---------------------------------------
Settings:
Command: "settings"
Description: "Update bot settings."
Permission: ["Administrator"]
Enabled: true
AI:
Command: "ai"
Description: "Manage SupportBot AI settings and memory."
Permission: ["Administrator"]
Enabled: true
Train:
Command: "train"
Description: "Train the AI by adding knowledge to its database."
Knowledge:
Command: "knowledge"
Description: "Manage the AI knowledge base."
Clear:
Command: "clear"
Description: "Clear all trained knowledge from the AI."
Memory:
Command: "memory"
Description: "Manage the AI conversational memory."
Clear:
Command: "clear"
Description: "Clear recent conversation memory for this channel."
# ---------------------------------------
# Command Description Configuration
# ---------------------------------------
BlacklistDesc: "Blacklist a user from creating Tickets."
TicketAddDesc: "Add a user to a support ticket."
TicketRemoveDesc: "Remove a user from a support ticket."
TranslateCommandDesc: "Translates the language provided, along with the abbreviation (2 char) long language code"
OpenTicketDesc: "Open a new support ticket."
CloseTicketDesc: "Close your support ticket."
InfoCommandDesc: "Get information about the brand."
PingCommandDesc: "Pong!"
HelpCommandDesc: "Get a list of all the commands."
EmbedCommandDesc: "Send a message as an embed."
SuggestCommandDesc: "Suggest a feature for the server."
UserInfoCommandDesc: "Get info about a user."
TicketManageDesc: "Manage an existing support ticket."
TicketManageCloseDesc: "Close a support ticket."
TicketManageForceAddDesc: "Add a user to a support ticket by bypassing the invite system."
TicketManageForceRemoveDesc: "Remove a user from a support ticket by bypassing the normal restrictions."
TicketManageForceRenameDesc: "Rename a support ticket by bypassing the normal restrictions."
+333
View File
@@ -0,0 +1,333 @@
# ___ _ ___ _
# / __> _ _ ___ ___ ___ _ _ _| |_ | . > ___ _| |_
# \__ \| | || . \| . \/ . \| '_> | | | . \/ . \ | |
# <___/`___|| _/| _/\___/|_| |_| |___/\___/ |_|
# |_| |_|
#
# SupportBot created by Emerald Services
# Installed with MIT License
#
# Discord Support: https://discord.gg/emeraldsrv
# Official Documentation: https://docs.emeraldsrv.com
# Addons Marketplace: https://community.emeraldsrv.com
#
# Messages Configuration (messages.yml)
# ----------------------------
# Info Command
# ----------------------------
Info:
Title: "About Us"
Description: "SupportBot is an open-sourced support system for discord. It's completely free to use with high amounts of customization to match your own brand."
Button: "Visit Site"
URL: "https://docs.emeraldsrv.com"
Colour: "#45b463"
# ----------------------------
# Welcome/Leave Messages
# ----------------------------
Welcome:
Enabled: true
LayoutStyle: "modern"
# Available Layout Styles
# "modern" - For the new Discord v2 components
# "classic" - Use the classic Discord look.
Embed:
Colour: "#45b463"
Title: "Welcome to ServerName"
Message: ":smile: %joined_user% has just landed!\n\n🔨 **Server Rules:** <#1202667199853232129>"
Icon:
Mode: "USER" # USER | BOT | CUSTOM
CustomURL: "https://example.com/custom.png"
Image:
Enabled: false
URL: "https://example.com/banner.png"
Buttons:
Enabled: true
List:
- label: "BuiltByBit"
style: "Link"
url: "https://your-website.com/how-to-play-java"
emoji: "⌨️"
- label: "GitHub"
style: "Link"
url: "https://your-website.com/how-to-play-bedrock"
emoji: "👾"
- label: "Tebex"
style: "Link"
url: "https://your-store.tebex.io/"
emoji: "🛒"
Modern:
Colour: "#45b463"
Title: "**Welcome to ServerName**"
Body: ":smile: %joined_user% has just landed!\n\n🔨 **Server Rules:** <#1202667199853232129>"
Icon:
Mode: "BOT" # USER | BOT | CUSTOM
CustomURL: "https://example.com/custom-icon.png"
Image:
Enabled: false
URL: "https://example.com/banner.png"
Buttons:
- label: "BuiltByBit"
style: "Link"
url: "https://your-website.com/how-to-play-java"
emoji: "⌨️"
- label: "GitHub"
style: "Link"
url: "https://your-website.com/how-to-play-bedrock"
emoji: "👾"
- label: "Tebex"
style: "Link"
url: "https://your-store.tebex.io/"
emoji: "🛒"
Leave:
Embed:
Colour: "#f74343"
Title: "Goodbye!"
Message: ":slight_frown: %left_user% has recently dropped out!"
Thumbnail: "BOT"
ImageEnabled: false
ImageURL: "https://animagelink.png/"
# ----------------------------
# Suggestion Messages
# ----------------------------
Suggestions:
Sent_Title: "Suggestion Sent!"
Sent: ":white_check_mark: **You have successfully sent a suggestion.**"
NoSelfVote: ":x: **You cannot vote on your own suggestion.**"
RemoveVoteButton: "Remove Vote"
# ----------------------------
# Ticket Messages
# ----------------------------
Ticket:
# Available Placeholders:
# %ticketusername% - User who created the ticket.
# <@%ticketauthor%> - Tags the user who created the ticket.
# <#%ticketid%> - Mentions the ticket channel.
# You can use Markdown formatting in this message:
# # Heading 1
# ## Heading 2
# ### Heading 3
# **Bold** text
# *Italic* text
# -# Small text
# - Bullet points
# Links: [text](https://example.com)
TicketAuthorTitle: "-# %ticketusername%'s Ticket"
TicketTitle: "## Support Ticket"
TicketMessage: "Hello <@%ticketauthor%>, Thank you for creating a support ticket\nPlease wait patiently whilst a member of our team reaches out to you."
TicketThumbnail: "https://images.emojiterra.com/google/android-pie/512px/1f39f.png"
TicketCreatedAlert: ":ticket: Ticked Created: <#%ticketid%>"
TicketExists: "❌ Ticket already exists"
TicketClaim: ":white_check_mark: Ticket claimed by" #The user who claimed the ticket will be added to the end of this message
TicketUnclaim: ":white_check_mark: Ticket unclaimed by" #The user who claimed the ticket will be added to the end of this message
TicketArchived: ":white_check_mark: Ticket archived."
TicketUnarchived: ":white_check_mark: Ticket unarchived."
TicketLocked: ":lock: Ticket is locked."
DisableInvites: "🔒 Invites have been disabled for this ticket."
EnableInvites: "🔓 Invites have been enabled for this ticket."
# Available Placeholders:
# <@%user%> - Tags the user who was added to the ticket.
Blacklisted: ":x: You are not allowed to open a ticket"
Muted: ":x: You are `Muted` and therefore not allowed to open any tickets"
InvalidSubject: "No Reason Provided!"
ConfirmClose: "Please confirm closing the ticket by clicking the button below."
CloseTimeout: "Ticket close confirmation timed out."
RenamedSuccess: "🏷️ Ticket renamed successfully!"
ClaimTickets:
ClaimTitle: "Incoming Support Request!"
ClaimMessage: "A new ticket has been created by <@!%user%>. Click the button below to claim this ticket."
ClaimMessage_Edit: "<#%channel%> was claimed by <@!%user%>."
ClaimedTitle: "Ticket Claimed!"
Claimed: "You have successfully claimed this ticket. <#%channel%>"
NoPermsToClaimTitle: "Error, no permissions!"
NoPermsToClaim: ":x: **Err!** You do not permissions to claim this ticket."
ReassigningTitle: "Reassigning!..."
ReassigningMessage: "<@%user%> did not claim the ticket. **Reassigning...**"
TicketQuestions:
Details:
Title: "Ticket Details"
Description: "Questions by <@%user%>" # Use <@%user%> to display the username.
AIMode:
Title: "SupportBot AI"
Description: "Use the buttons below to enable or disable AI chat in this ticket."
EnabledMessage: "AI Mode has been enabled for this ticket."
DisabledMessage: "AI Mode has been disabled for this ticket."
ThreadWelcomeTitle: "SupportBot AI"
ThreadWelcomeMessage: "Hi! I’m SupportBot AI. You can chat with me here about your issue."
EnableButton: "Enable AI Mode"
DisableButton: "Disable AI Mode"
TicketNotFound: "Ticket not found."
EnableError: "There was an error enabling SupportBot AI."
DisableError: "There was an error disabling SupportBot AI."
# ----------------------------
# Review Messages
# ----------------------------
ReviewSystem:
Rate:
Title: "Review us!"
Description: "Please rate our support for this ticket (1-5 stars)."
Stars:
One: "⭐ 1 Star"
Two: "⭐⭐ 2 Stars"
Three: "⭐⭐⭐ 3 Stars"
Four: "⭐⭐⭐⭐ 4 Stars"
Five: "⭐⭐⭐⭐⭐ 5 Stars"
Comment:
Title: "Write a comment."
Description: "Write a comment about your experience."
ReviewEmbed:
Title: "Ticket Review"
CommentTitle: "Comment"
RatingTitle: "Rating"
ReviewedStaffTitle: "Reviewed Staff:"
ReviewedByTitle: "Reviewed By:"
ReviewEmoji: "⭐"
Color: "#f7a943"
# ----------------------------
# Mod Command Messages
# ----------------------------
Mod:
TicketBlacklist:
Add:
Description: "Add a user to the ticket blacklist"
UserDescription: "User to blacklist"
AlreadyBlacklisted: ":x: {userTag} is already blacklisted."
Success: ":white_check_mark: {userTag} has been added to the blacklist. They can no longer use the ticket system."
Remove:
Description: "Remove a user from the ticket blacklist"
UserDescription: "User to remove from blacklist"
NotBlacklisted: ":x: {userTag} is not blacklisted."
Success: ":white_check_mark: {userTag} has been removed from the blacklist. They can now use the ticket system again."
View:
Description: "View the list of all blacklisted users"
NoBlacklistedUsers: ":information_source: There are currently no users on the blacklist."
# ----------------------------
# Logging Messages
# ----------------------------
TicketLog:
Title: "Ticket Log"
Colour: "#0cc559"
TicketBlacklistLog:
Title: "Ticket Blacklist Log"
Colour: "#0cc559"
# ----------------------------
# Misc Messages
# ----------------------------
AddUser:
NotInTicket_Title: "Ticket Invitation"
NotInTicket_Description: "This command can only be used within a ticket thread."
Invite_Title: "User Invited"
Invite_Description: "%username% has been invited to join the ticket."
DM_Title: "Ticket Invitation"
DM_Description: "You have been invited to join the ticket %channelname%. Do you accept?"
Accept_Label: "Accept"
Reject_Label: "Reject"
ViewTicket_Label: "Go to Ticket"
Accepted_Title: "Invitation Accepted"
Accepted_Message: "You have been added to the ticket."
AddedToTicket_Title: "Added to Ticket"
AddedToTicket_Description: "You have been added to the ticket %channel_link%."
# Added Message for inside the ticket, this informs everyone inside the ticket that the user has been added.
Added_Title: "User Added"
Added_Description: "Successfully added **%username%** to the ticket."
Declined_Title: "Invitation Declined"
Declined_Message: "You have declined the invitation."
NoResponse_Title: "No Response"
NoResponse_Message: "You did not respond in time. Please contact staff if you wish to join the ticket."
Error_Title: "Error"
Error_Adding: "There was an error adding you to the ticket. Please try again."
DM_Error_Title: "Error"
DM_Error_Description: "Unable to send a DM to %username%. Please ensure your DMs are enabled."
Unexpected_Error_Title: "Error"
Unexpected_Error_Description: "An unexpected error occurred: %error%"
RemoveUser:
NotInTicket_Title: "Error"
NotInTicket_Description: "This command can only be used in ticket threads."
Removed_Title: "User Removed"
Removed_Message: "The user has been successfully removed from the ticket."
RemovedFromTicket_Title: "Removed from Ticket"
RemovedFromTicket_Description: "You have been removed from the ticket channel %channel_link%."
Error_Title: "Error"
Error_Removing: "There was an error removing the user from the ticket."
ForceAddUser:
NotInTicket_Title: "Not a Ticket"
NotInTicket_Description: "This command can only be used within a ticket thread."
Added_Title: "User Added"
Added_Description: "Successfully added %username% to the ticket."
AddedToTicket_Title: "You have been added to a Ticket"
AddedToTicket_Description: "You have been added to the ticket channel [%channel_link%]."
Error_Title: "Error"
Error_Adding: "There was an error adding the user to the ticket."
Error:
IncorrectPermissions: ":x: **Error!** You do not have the correct permissions to use this command."
MissingChannel: ":x: **Error!** Required channel not found. Please ensure it is set up correctly!"
UserNotFound: ":x: **Error!** Specified user not found. Please check if they are in this server."
CommandNotAllowedHere: ":warning: This command cannot be used in this channel."
EntryAlreadyExists: ":warning: Cannot complete the action, as the entry already exists."
EntryDoesNotExist: ":warning: Cannot complete the action, as the entry does not exist."
ActionFailed: ":x: **Error!** An error occurred while processing your request. Please try again later."
InvalidChannel: ":x: **Error!** The suggestions channel has not been set up correctly."
+76
View File
@@ -0,0 +1,76 @@
# -------------------------
# SupportBot AI
#
# In order to use the SupportBot AI, You need to setup an OpenAI or Groq Developer Account.
# this can be done at https://platform.openai.com/ or https://groq.com/
# -------------------------
Enabled: true
General:
Provider: "claude"
Model: "claude-sonnet-4-6"
Model_API_Key: "MODEL_API_KEY"
# Providers Available:
# "openai" - Use OpenAI's GPT models. Example: "gpt-5.4" "gpt-5-mini"
# "groq" - Use Groq's GroqAI models. Example: "meta-llama/llama-4-scout-17b-16e-instruct"
# "claude" - Use Anthropic's Claude models. Example: "claude-sonnet-4-6"
Tokens: 1200
Temperature: 0.4
Name: "SupportBot AI"
PastebinAPI_Key: "PASTEBIN_API_KEY"
PastebinAPI_URL: "https://pastebin.com/api/api_post.php"
Style:
MessageType: "text"
# Available Styles for AI:
# "embed" - AI responses will be sent as Discord embeds.
# "text" - AI responses will be sent as plain messages.
# "components_v2" - AI responses will be sent with the new components style.
Features:
SuggestTickets: true # Should SupportBot AI suggest creating a ticket if the user needs more help?
Channels:
AIChannel: "1469028791312715902"
Embed:
Color: "#45b463"
Footer: "SupportBot AI"
Memory:
Enabled: true
StoreFacts: true
# StoreFacts - Enables saving important facts the AI learns.
StoreSummaries: true
# StoreSummaries - Enables saving conversation summaries.
MaxRecentMessages: 15
# MaxRecentMessages - Number of recent messages used for context.
Scope: "guild" # channel | guild
# Available Scopes for Memory:
# "channel" - Memory is per channel only.
# "guild" - Memory is shared across the server.
CustomInstructions:
- "You are SupportBot AI made by Emerald Services"
- "You are built with DiscordJS/NodeJS and currently running on dev build 26.0 build 2"
- "You're current build can be found here https://github.com/Emerald-Services/SupportBot/tree/26.0"
- "You're main build can be found here https://builtbybit.com/resources/supportbot-free-advanced-ticket-bot.8940/ and Polymart at https://polymart.org/product/518/supportbot-1-discord-ticket-bot which is version 8.4"
- "dev build 26.0 build 2 includes all-new AI features for SupportBot such as memory system that allows you to remember facts and summaries of conversations, which can be used to provide better responses."
- "SupportBot AI also have a new tickets AI Mode which is enabled in supportbot.ymll, which allows you to assist users in support tickets and provide better responses based on the context of the ticket."
- "Your main purpose is to assist users in the support server and provide helpful responses to their questions and issues. Always be accurate and if you do not have answer then simply ask the person to create a ticket if they need more help."
#- "Add custom instructions here"
Messages:
ErrorResponse: "I couldn't generate a response."
AIError: "There was an error contacting the AI provider."
AIDisabled: "AI is currently disabled."
MessageTooLong: "My response was too long, so I uploaded it here: {pastebin}"
SuggestTicketText: "-# Need more help? React with 🎫 to open a ticket."
SuggestTicketReaction : "🎫"
+372
View File
@@ -0,0 +1,372 @@
# ___ _ ___ _
# / __> _ _ ___ ___ ___ _ _ _| |_ | . > ___ _| |_
# \__ \| | || . \| . \/ . \| '_> | | | . \/ . \ | |
# <___/`___|| _/| _/\___/|_| |_| |___/\___/ |_|
# |_| |_|
#
# SupportBot created by Emerald Services
# Installed with MIT License
#
# Discord Support: https://discord.gg/emeraldsrv
# Website: https://emeraldsrv.dev
#
# SupportBot Configuration (supportbot.yml)
SupportBot_Version: "v26.1.1"
# -------------------------
# General
# -------------------------
General:
Name: "SupportBot"
Token: "BOT_TOKEN"
Addons:
Enabled: true
# -------------------------
# Activity
# -------------------------
Activity:
Status: "SupportBot v8"
Type: "Competing"
StreamingURL: "https://www.twitch.tv/YOUR_TWITCH_NAME"
# Available Types:
# Playing
# Watching
# Listening
# Competing
# Streaming (URL required)
# You can also update the activity via Discord using: /settings
# -------------------------
# Embeds
# -------------------------
Embed:
Colours:
General: "#0cc559"
Success: "#04b545"
Error: "#d13030"
Warn: "#fca117"
Footer: "SupportBot | Developed by Emerald Development"
# Use 0x<hexcode> to change the colour of the embeds.
# -------------------------
# Roles
# -------------------------
Roles:
AutoRole:
Enabled: true
Role: "ROLE_ID"
StaffMember:
Staff: "ROLE_ID"
Admin: "ROLE_ID"
Moderator: "ROLE_ID"
Mod:
AllowSupportStaff: false
# Allow Support Staff to use the /mod command. (More in detail customisation in commands.yml)
# ----------------------------
# System Messages
# ----------------------------
Welcome:
Enabled: true
Channel: "CHANNEL_ID"
Leave:
Enabled: true
Channel: "CHANNEL_ID"
# ----------------------------
# Suggestions
# ----------------------------
Suggestions:
Mode: "Channel" # Channel or Forum
ForumChannel: "FORUM_CHANNEL_ID" # A forum channel, disabled if mode is set to Channel.
Channel: "CHANNEL_ID" # A text channel, disabled if mode is set to Forum.
UpvoteEmoji: "✅"
DownvoteEmoji: "❌"
UpvoteTitle: "Yes"
DownvoteTitle: "No"
OwnSuggestion: true
# If false this will not allow the user to vote for a suggestion they created
# If true this will allow the user to vote for a suggestion they created
ShowUsers: true
Threads:
Enabled: true
Title: "Suggestion-releated Thread"
Reason: "A thread releted to this suggestion"
Buttons:
Upvote: "2"
Downvote: "2"
RemoveVote: "4"
RemoveVote_Title: "Remove Vote"
# Available Button Styles
# 1 - Blurple
# 2 - Grey
# 3 - Green
# 4 - Red
Tags:
Created: "TAG_ID"
Considering: "TAG_ID"
Solved: "TAG_ID"
Denied: "TAG_ID"
# -------------------------
# Tickets
# -------------------------
VoiceTickets:
Name: "%username%'s VC"
Category: "CATEGORY_ID"
Ticket:
TicketType: "channels"
# Available TicketTypes:
# channels - Tickets will be created as channels in the TicketChannelsCategory
# threads - Tickets will be created as threads through the "TicketHome" channel.
UserManagement:
DMOnAdd: true # DM the user when they are added to the ticket
DMOnRemove: true # DM the user when they are removed from the ticket
DMTranscript: true # DM the user a transcript of the ticket when it is closed
TicketHome: "1469028381638000725"
# What is TicketHome?
# - Channel where the Ticket creation panel is sent.
# - Channel where ticket threads are made. (only if ticket threads is enabled above.)
# For TicketType: channels
TicketChannelsCategory: "CATEGORY_ID"
TicketChannelsCategory2: "CATEGORY_ID" # This will be used if the first category has reached the max channel limit.
TicketArchiveCategory: "CATEGORY_ID"
# ---
Channel: "ticket-" # The prefix for ticket channel names
TicketsPerUser: 100
TicketReason: true
# If ticket reason is set to false, It will not prompt to create a reason
TicketSubject: "description"
# Available TicketSubjects:
# "description" will display the ticket reason within the channel description
# "embed" will display the ticket reason within the ticket embed
Timeout: 5
# Set to true to allow all staff to access the ticket
Close:
StaffOnly: true
# Set to false is anyone is able to close a ticket.
Invites: # Invites is for ticket threads.
StaffOnly: true
ClaimTickets:
Enabled: false
Channel: "CHANNEL_ID"
# Channel where the ticket assignments are sent for staff to claim.
ClaimAcceptTime: 120000
# How long the assigned user has to accept the ticket before it gets re-assigned to someone else.
# 120000 = 2 Minutes
# 180000 = 3 Minutes
# 240000 = 4 Minutes
# 300000 = 5 Minutes
# Time in Mliseconds
ButtonTitle: "Claim Ticket"
ButtonEmoji: "🎫"
Button: "1"
# Available Button Styles
# 1 - Blurple
# 2 - Grey
# 3 - Green
# 4 - Red
ReviewSystem:
Enabled: false
Channel: "CHANNEL_ID"
UseModal: true
Questions: # Default questions asked when a ticket is created, these are used if departments are disabled.
Enabled: false
List:
- "Please provide your account email?"
- "What is the nature of your issue?"
- "Have you tried resolving the issue yourself?"
Log:
TicketDataLog: "CHANNEL_ID"
TickeDataTitle: "Ticket Data"
TicketBlacklistLog: "CHANNEL_ID"
AIMode:
Enabled: true
ThreadName: "Chat with SupportBot AI"
WelcomeMessage: "Hi! I’m SupportBot AI. You can chat with me here about your issue."
# -------------------------
# Ticket Departments
# -------------------------
DepartmentSystem:
Enabled: true
Placeholder: "Choose a ticket department"
DefaultDepartment: "general"
Departments:
general:
Name: "General Support"
Description: "Open a general support ticket"
Emoji: "🎫"
Category: "CATEGORY_ID"
Role: "ROLE_ID"
ChannelPrefix: "support-"
DefaultPriority: "normal"
Questions:
- "What do you need help with?"
- "When did the issue start?"
purchase:
Name: "Purchase Support"
Description: "Get help with store purchases"
Emoji: "💳"
Category: "CATEGORY_ID"
Role: "ROLE_ID"
ChannelPrefix: "purchase-"
DefaultPriority: "high"
Questions:
- "What is your order ID?"
- "What product did you purchase?"
- "What payment issue are you having?"
reports:
Name: "Player Report"
Description: "Report a player for breaking the rules"
Emoji: "🚨"
Category: "CATEGORY_ID"
Role: "ROLE_ID"
ChannelPrefix: "report-"
DefaultPriority: "normal"
Questions:
- "Who are you reporting?"
- "What happened?"
- "Do you have evidence?"
appeals:
Name: "Ban Appeals"
Description: "Appeal a server punishment"
Emoji: "⚖️"
Category: "CATEGORY_ID"
Role: "ROLE_ID"
ChannelPrefix: "appeals-"
DefaultPriority: "low"
Questions:
- "What punishment are you appealing?"
- "Why should it be reviewed?"
- "Anything else staff should know?"
PrioritySystem:
Enabled: false
DefaultPriority: "Normal"
AllowUsersToChooseOnOpen: true
Priorities:
low:
Name: "Low"
Emoji: "🟢"
normal:
Name: "Normal"
Emoji: "🟡"
high:
Name: "High"
Emoji: "🟠"
urgent:
Name: "Urgent"
Emoji: "🔴"
# -------------------------
# Buttons
# -------------------------
Buttons:
General:
Delete: "🗑️"
DeleteStyle: "4"
Voice:
TicketDeleteText: "Delete Voice Channel"
Tickets:
ClaimEmoji: "🧑‍💻"
ClaimStyle: "1"
Unarchive: "Unarchive Ticket"
Unarchive_Emoji: "♻️"
Unarchive_Style: "2"
Unlock: "Unlock Ticket"
Unlock_Emoji: "🔓"
Unlock_Style: "2"
# Available Button Styles
# 1 - Blurple
# 2 - Grey
# 3 - Green
# 4 - Red
# -------------------------
# Select Menus
# -------------------------
SelectMenus:
Tickets:
PanelEmoji: "⚙️"
CloseEmoji: "🗑️"
ArchiveEmoji: "♻️"
LockEmoji: "🔐"
RenameEmoji: "🏷️"
VCEmoji: "🔊"
EnableInvitesEmoji: "📤"
DisableInvitesEmoji: "📥"
# -------------------------
# Logging
# -------------------------
MessageDelete:
Channel: "CHANNEL_ID"
Colour: "#d92525"
MessageUpdate:
Channel: "CHANNEL_ID"
Colour: "#f2a024"
Translate:
TranslateLog: "CHANNEL_ID"
+65
View File
@@ -0,0 +1,65 @@
# ___ _ ___ _
# / __> _ _ ___ ___ ___ _ _ _| |_ | . > ___ _| |_
# \__ \| | || . \| . \/ . \| '_> | | | . \/ . \ | |
# <___/`___|| _/| _/\___/|_| |_| |___/\___/ |_|
# |_| |_|
#
# SupportBot created by Emerald Services
# Installed with MIT License
#
# Discord Support: https://discord.gg/emeraldsrv
# Official Documentation: https://docs.emeraldsrv.com
# Addons Marketplace: https://community.emeraldsrv.com
#
# Ticket Creation Panel Configuration (ticket-panel.yml)
# -------------------------------
# Ticket Panel Configuration
# -------------------------------
Panel: true
Style:
Title: "## SupportBot Ticket Creation"
Description: "Click on the button to file a `Ticket` and our team will try their best to assist you in the best way we can!"
Image: "https://i.imgur.com/dejQvkg.png"
Color: "#45b463"
Layout: "4"
# Available Layout Styles
# "1" - Style 1 - Title & Text, Button at the top -- Image at the bottom
# "2" - Style 2 - Title & Text, Button at the bottom -- Image at the top
# "3" - Style 3 - The classic look - Title & Text at the top -- Image in the middle -- Button at the bottom
# "4" - Style 4 - Classic Embed (Title & Text, Image on right, Button at bottom)
Button:
Text: "Create Ticket"
Emoji: "🎫"
Color: "2"
CustomId: "createticket"
# Available Button Styles
# 1 - Blurple
# 2 - Grey
# 3 - Red
# 4 - Green
DepartmentMenu:
CustomId: "ticketdepartmentselect"
Placeholder: "Choose a ticket department"
DefaultDescription: "Open a support ticket"
DefaultEmoji: "🎫"
Settings:
Image: true
TopTitle: true
TopDivider: true
BottomTitle: false
BottomDivider: false
Messages:
NotConfigured: "Ticket Panel is not set up. Please configure it in `/Configs/ticket-panel.yml`."
InvalidChannel: "TicketHome channel not found. Please check your config file."
PanelSent: "Ticket panel message has been sent!"
PanelSentWithDepartments: "Ticket panel message with department selection has been sent!"
SendError: "An error occurred while sending the ticket panel message."
+3
View File
@@ -0,0 +1,3 @@
{
"blacklistedUsers": []
}
+1
View File
@@ -0,0 +1 @@
+84
View File
@@ -0,0 +1,84 @@
// Emerald Services | SupportBot
// Claude integration for SupportBot AI
const fs = require("fs");
const yaml = require("js-yaml");
const axios = require("axios");
const supportbotai = yaml.load(
fs.readFileSync("./Configs/supportbot-ai.yml", "utf8"),
);
function extractTextFromMessage(message) {
if (!message) return "";
if (typeof message === "string") {
return message.trim();
}
if (message.text) {
return message.text.trim();
}
if (Array.isArray(message)) {
return message
.map((part) => {
if (typeof part === "string") return part;
if (part?.type === "text" && typeof part.text === "string") {
return part.text;
}
return "";
})
.join("")
.trim();
}
return "";
}
async function chat({ messages, temperature, maxTokens }) {
const model = supportbotai.General.Model;
const apiKey = supportbotai.General.Model_API_Key;
const systemMessages = messages.filter((m) => m.role === "system");
const systemPrompt = systemMessages.map((m) => m.content).join("\n\n");
const userAssistantMessages = messages.filter((m) => m.role !== "system");
const response = await axios.post(
"https://api.anthropic.com/v1/messages",
{
model,
system: systemPrompt || undefined,
messages: userAssistantMessages,
temperature: temperature || supportbotai.General.Temperature || 0.4,
max_tokens: maxTokens || supportbotai.General.Tokens || 800,
},
{
headers: {
"x-api-key": apiKey,
"anthropic-version": "2023-06-01",
"content-type": "application/json",
},
}
);
const data = response.data;
const content = extractTextFromMessage(data.content);
if (!content) {
console.error("Claude raw response:", JSON.stringify(data, null, 2));
throw new Error(
`Claude returned empty response. stop_reason=${data?.stop_reason || "unknown"}`,
);
}
return {
content,
raw: data,
};
}
module.exports = {
chat,
};
+72
View File
@@ -0,0 +1,72 @@
// Emerald Services | SupportBot
// Groq integration for SupportBot AI
const fs = require("fs");
const yaml = require("js-yaml");
const OpenAI = require("openai");
const supportbotai = yaml.load(
fs.readFileSync("./Configs/supportbot-ai.yml", "utf8"),
);
const client = new OpenAI({
apiKey: supportbotai.General.Model_API_Key,
baseURL: "https://api.groq.com/openai/v1",
});
function extractTextFromMessage(message) {
if (!message) return "";
if (typeof message.content === "string") {
return message.content.trim();
}
if (Array.isArray(message.content)) {
return message.content
.map((part) => {
if (typeof part === "string") return part;
if (part?.type === "text" && typeof part.text === "string") {
return part.text;
}
if (typeof part?.text?.value === "string") {
return part.text.value;
}
return "";
})
.join("")
.trim();
}
return "";
}
async function chat({ messages, temperature, maxTokens }) {
const model = supportbotai.General.Model;
const response = await client.chat.completions.create({
model,
messages,
temperature: temperature || supportbotai.General.Temperature || 0.4,
max_tokens: maxTokens || supportbotai.General.Tokens || 800,
});
const choice = response?.choices?.[0];
const message = choice?.message;
const content = extractTextFromMessage(message);
if (!content) {
console.error("Groq raw response:", JSON.stringify(response, null, 2));
throw new Error(
`Groq returned empty response. finish_reason=${choice?.finish_reason || "unknown"}`,
);
}
return {
content,
raw: response,
};
}
module.exports = {
chat,
};
+68
View File
@@ -0,0 +1,68 @@
// Emerald Services | SupportBot
// Open AI integration for SupportBot AI
const fs = require("fs");
const yaml = require("js-yaml");
const OpenAI = require("openai");
const supportbotai = yaml.load(
fs.readFileSync("./Configs/supportbot-ai.yml", "utf8"),
);
const client = new OpenAI({
apiKey: supportbotai.General.Model_API_Key,
});
function extractTextFromMessage(message) {
if (!message) return "";
if (typeof message.content === "string") {
return message.content.trim();
}
if (Array.isArray(message.content)) {
return message.content
.map((part) => {
if (typeof part === "string") return part;
if (part?.type === "text" && typeof part.text === "string")
return part.text;
if (typeof part?.text?.value === "string") return part.text.value;
return "";
})
.join("")
.trim();
}
return "";
}
async function chat({ messages, temperature, maxTokens }) {
const model = supportbotai.General.Model;
const response = await client.chat.completions.create({
model,
messages,
temperature: temperature || supportbotai.General.Temperature || 0.4,
max_completion_tokens: maxTokens || supportbotai.General.Tokens || 800,
});
const choice = response?.choices?.[0];
const message = choice?.message;
const content = extractTextFromMessage(message);
if (!content) {
console.error("OpenAI raw response:", JSON.stringify(response, null, 2));
throw new Error(
`OpenAI returned empty response. finish_reason=${choice?.finish_reason || "unknown"}`,
);
}
return {
content,
raw: response,
};
}
module.exports = {
chat,
};
+9
View File
@@ -0,0 +1,9 @@
const Event = require("../Structures/Event.js");
module.exports = new Event("guildCreate", async (client) => {
console.log(
`\u001b[31m`,
`${client.user.username} is not in the correct server set in your config. Please leave all other servers and restart the bot.`
);
console.log(`\u001b[31m`, `${client.user.username} will now exit.`);
return process.exit(1);
});
+10
View File
@@ -0,0 +1,10 @@
const Event = require("../Structures/Event.js");
module.exports = new Event("guildDelete", async (client) => {
console.log(
`\u001b[31m`,
`${client.user.username} is not in the correct server set in your config. Please join the server and restart the bot.`
);
console.log(`\u001b[31m`, `${client.user.username} will now exit.`);
return process.exit(1);
});
+157
View File
@@ -0,0 +1,157 @@
const {
EmbedBuilder,
ActionRowBuilder,
ButtonBuilder,
ButtonStyle,
MessageFlags,
ContainerBuilder,
TextDisplayBuilder,
SectionBuilder,
ThumbnailBuilder,
MediaGalleryBuilder
} = require("discord.js");
const fs = require("fs");
const yaml = require("js-yaml");
const Event = require("../Structures/Event.js");
const supportbot = yaml.load(
fs.readFileSync("./Configs/supportbot.yml", "utf8")
);
const msgconfig = yaml.load(
fs.readFileSync("./Configs/messages.yml", "utf8")
);
function getWelcomeThumbnail(client, member, iconCfg) {
switch ((iconCfg?.Mode || "").toUpperCase()) {
case "USER":
return member.user.displayAvatarURL();
case "BOT":
return client.user.displayAvatarURL();
case "CUSTOM":
return iconCfg.CustomURL;
default:
return null;
}
}
function buildModernComponents(client, member) {
const container = new ContainerBuilder();
if (msgconfig.Welcome.Modern.Colour) {
container.setAccentColor(parseInt(msgconfig.Welcome.Modern.Colour.replace("#", ""), 16));
}
const section = new SectionBuilder().addTextDisplayComponents(
new TextDisplayBuilder().setContent(
msgconfig.Welcome.Modern.Title.replace(/%joined_user%/g, member.user)
),
new TextDisplayBuilder().setContent(
msgconfig.Welcome.Modern.Body.replace(/%joined_user%/g, member.user)
)
);
const thumbUrl = getWelcomeThumbnail(client, member, msgconfig.Welcome.Modern.Icon);
if (thumbUrl) {
section.setThumbnailAccessory(
new ThumbnailBuilder()
.setURL(thumbUrl)
);
}
container.addSectionComponents(section);
// FIXED: Using MediaGalleryBuilder instead of TextDisplayBuilder for images
if (msgconfig.Welcome.Modern.Image?.Enabled && msgconfig.Welcome.Modern.Image.URL) {
container.addMediaGalleryComponents(
new MediaGalleryBuilder().addItems([
{
media: {
url: msgconfig.Welcome.Modern.Image.URL
}
}
])
);
}
if (Array.isArray(msgconfig.Welcome.Modern.Buttons)) {
const row = new ActionRowBuilder();
msgconfig.Welcome.Modern.Buttons.slice(0, 5).forEach(b => {
const btn = new ButtonBuilder()
.setLabel(b.label)
.setStyle(ButtonStyle[b.style])
.setEmoji(b.emoji || null);
if (b.style === "Link") btn.setURL(b.url);
else if (b.customId) btn.setCustomId(b.customId);
row.addComponents(btn);
});
container.addActionRowComponents(row);
}
return [container];
}
module.exports = new Event("guildMemberAdd", async (client, member) => {
if (!supportbot.Welcome.Enabled) return;
const WelcomeChannel =
member.guild.channels.cache.get(supportbot.Welcome.Channel) ||
member.guild.channels.cache.find(c => c.name === supportbot.Welcome.Channel);
if (!WelcomeChannel) return;
const style = (msgconfig.Welcome.LayoutStyle || "classic").toLowerCase();
if (style === "classic") {
const WelcomeEmbed = new EmbedBuilder()
.setColor(msgconfig.Welcome.Embed.Colour)
.setTitle(msgconfig.Welcome.Embed.Title || null)
.setDescription(
msgconfig.Welcome.Embed.Message.replace(/%joined_user%/g, member.user)
)
.setTimestamp();
const thumb = getWelcomeThumbnail(client, member, msgconfig.Welcome.Embed.Icon);
if (thumb) WelcomeEmbed.setThumbnail(thumb);
if (msgconfig.Welcome.Embed.Image?.Enabled && msgconfig.Welcome.Embed.Image.URL) {
WelcomeEmbed.setImage(msgconfig.Welcome.Embed.Image.URL);
}
const components = [];
if (
msgconfig.Welcome.Embed.Buttons?.Enabled &&
Array.isArray(msgconfig.Welcome.Embed.Buttons.List)
) {
const row = new ActionRowBuilder();
msgconfig.Welcome.Embed.Buttons.List.slice(0, 5).forEach(b => {
const btn = new ButtonBuilder()
.setLabel(b.label)
.setStyle(ButtonStyle[b.style])
.setEmoji(b.emoji || null);
if (b.style === "Link") btn.setURL(b.url);
else if (b.customId) btn.setCustomId(b.customId);
row.addComponents(btn);
});
components.push(row);
}
await WelcomeChannel.send({ embeds: [WelcomeEmbed], components });
} else if (style === "modern") {
const components = buildModernComponents(client, member);
if (components.length > 0) {
await WelcomeChannel.send({
components,
flags: MessageFlags.IsComponentsV2
});
}
}
if (supportbot.Roles.AutoRole.Enabled) {
const role =
member.guild.roles.cache.get(supportbot.Roles.AutoRole.Role) ||
member.guild.roles.cache.find(r => r.name === supportbot.Roles.AutoRole.Role);
if (role) await member.roles.add(role);
}
console.log("\u001b[32m", "[+]", "\u001b[33m", `${member.user.username} joined the server!`);
});
+40
View File
@@ -0,0 +1,40 @@
const { EmbedBuilder } = require("discord.js");
const fs = require("fs");
const yaml = require("js-yaml");
const Event = require("../Structures/Event.js");
const supportbot = yaml.load(fs.readFileSync("./Configs/supportbot.yml", "utf8"));
const msgconfig = yaml.load(fs.readFileSync("./Configs/messages.yml", "utf8"));
module.exports = new Event("guildMemberRemove", async (client, member) => {
if (!supportbot.Leave || !supportbot.Leave.Enabled) return;
const leaveChannel =
member.guild.channels.cache.get(supportbot.Leave.Channel) ||
member.guild.channels.cache.find(c => c.name === supportbot.Leave.Channel);
if (!leaveChannel) return;
const leaveEmbed = new EmbedBuilder()
.setColor(msgconfig.Leave.Embed.Colour)
.setTitle(msgconfig.Leave.Embed.Title)
.setDescription(
msgconfig.Leave.Embed.Message.replace(/%left_user%/g, member.user.toString())
)
.setTimestamp();
if (msgconfig.Leave.Embed.Thumbnail === "BOT") {
leaveEmbed.setThumbnail(client.user.displayAvatarURL());
} else if (msgconfig.Leave.Embed.Thumbnail === "USER") {
leaveEmbed.setThumbnail(member.user.displayAvatarURL());
}
if (msgconfig.Leave.Embed.ImageEnabled) {
leaveEmbed.setImage(msgconfig.Leave.Embed.ImageURL);
}
await leaveChannel.send({ embeds: [leaveEmbed] });
console.log(`[-] ${member.user.tag} left the server`);
});
File diff suppressed because it is too large. Load diff
+584
View File
@@ -0,0 +1,584 @@
const fs = require("fs");
const Discord = require("discord.js");
const yaml = require("js-yaml");
const axios = require("axios");
const supportbotai = yaml.load(
fs.readFileSync("./Configs/supportbot-ai.yml", "utf8"),
);
const supportbot = yaml.load(
fs.readFileSync("./Configs/supportbot.yml", "utf8"),
);
const Event = require("../Structures/Event.js");
const AIDatabase = require("../Structures/AIDatabase.js");
const db = require("../Structures/Database.js");
const openai = require("./Models/openai.js");
const groq = require("./Models/groq.js");
const claude = require("./Models/claude.js");
const PASTEBIN_API_KEY = supportbotai.General.PastebinAPI_Key;
const PASTEBIN_API_URL = supportbotai.General.PastebinAPI_URL;
const CHANNELS = [supportbotai.Channels.AIChannel].filter(Boolean);
async function createPaste(content) {
try {
if (!PASTEBIN_API_KEY || !PASTEBIN_API_URL) return null;
const response = await axios.post(
PASTEBIN_API_URL,
new URLSearchParams({
api_dev_key: PASTEBIN_API_KEY,
api_option: "paste",
api_paste_code: content,
api_paste_private: 1,
api_paste_expire_date: "1D",
api_paste_format: "text",
}),
);
return response.data;
} catch (error) {
console.error("Pastebin Error:", error);
return null;
}
}
function getProvider() {
const provider = String(
supportbotai.General.Provider || "openai",
).toLowerCase();
switch (provider) {
case "openai":
return openai;
case "groq":
return groq;
case "claude":
return claude;
default:
throw new Error(`Unsupported AI provider: ${provider}`);
}
}
function formatTicketQuestionAnswers(questionAnswers) {
if (!Array.isArray(questionAnswers) || questionAnswers.length === 0) {
return "No ticket question answers were saved.";
}
return questionAnswers
.map((item, index) => {
const question = item?.question || `Question ${index + 1}`;
const answer = item?.answer || "No answer provided";
return `${index + 1}. ${question}\nAnswer: ${answer}`;
})
.join("\n\n");
}
function buildTicketContext(ticket, message) {
if (!ticket) return "";
return `
Ticket Information:
Ticket ID: ${ticket.ticket_id || ticket.id || "Unknown"}
Subject: ${ticket.subject || ticket.reason || "No subject provided"}
Department: ${ticket.department || "Not set"}
Priority: ${ticket.priority || "Not set"}
Created By: ${ticket.user_id || ticket.user || "Unknown"}
Current User: ${message?.author?.tag || "Unknown"} (${message?.author?.id || "Unknown"})
Ticket Question Answers:
${formatTicketQuestionAnswers(ticket.questionAnswers)}
Use this information when helping the user with their ticket.
Do not invent missing ticket details.
`;
}
function buildSystemPrompt(message) {
const sections = [];
if (Array.isArray(supportbotai.CustomInstructions)) {
sections.push(...supportbotai.CustomInstructions);
}
sections.push(
`I am currently powered by the ${supportbotai.General.Provider || "Unknown"} provider, running the ${supportbotai.General.Model || "Unknown"} model.`,
);
sections.push(
`The current guild is: ${message.guild?.name || "Unknown Guild"}`,
);
sections.push(
`The current channel is: #${message.channel?.name || "unknown-channel"}`,
);
return sections.join("\n- ").replace(/^/, "- ");
}
function buildConversationFromMemory(currentMessage) {
const memoryConfig = supportbotai.Memory || {};
const memoryEnabled = memoryConfig.Enabled !== false;
const maxRecentMessages = memoryConfig.MaxRecentMessages || 15;
const memoryScope = String(memoryConfig.Scope || "guild").toLowerCase();
const conversation = [
{
role: "system",
content: buildSystemPrompt(currentMessage),
},
];
if (!memoryEnabled) return conversation;
const recentMessages =
typeof AIDatabase.getRecentMessagesByScope === "function"
? AIDatabase.getRecentMessagesByScope({
guildId: currentMessage.guild?.id || null,
channelId: currentMessage.channel?.id || null,
limit: maxRecentMessages,
scope: memoryScope,
})
: AIDatabase.getRecentMessages(
currentMessage.channel?.id,
maxRecentMessages,
);
const latestSummary =
memoryConfig.StoreSummaries !== false
? typeof AIDatabase.getLatestSummaryByScope === "function"
? AIDatabase.getLatestSummaryByScope({
guildId: currentMessage.guild?.id || null,
channelId: currentMessage.channel?.id || null,
scope: memoryScope,
})
: AIDatabase.getLatestSummary(currentMessage.channel?.id)
: null;
const facts =
memoryConfig.StoreFacts !== false
? typeof AIDatabase.getFactsByScope === "function"
? AIDatabase.getFactsByScope({
guildId: currentMessage.guild?.id || null,
channelId: currentMessage.channel?.id || null,
scope: memoryScope,
})
: AIDatabase.getFacts(currentMessage.channel?.id)
: [];
const userFacts =
memoryConfig.StoreFacts !== false &&
typeof AIDatabase.getUserFactsByScope === "function"
? AIDatabase.getUserFactsByScope({
guildId: currentMessage.guild?.id || null,
userId: currentMessage.author?.id || null,
scope: memoryScope,
})
: memoryConfig.StoreFacts !== false &&
typeof AIDatabase.getUserFacts === "function"
? AIDatabase.getUserFacts(
currentMessage.guild?.id,
currentMessage.author?.id,
)
: [];
const knowledgeBase = typeof AIDatabase.getKnowledge === "function"
? AIDatabase.getKnowledge(25)
: [];
if (latestSummary?.summary) {
conversation.push({
role: "system",
content: `Shared memory summary (${memoryScope} scope):\n${latestSummary.summary}`,
});
}
if (facts.length > 0) {
const factText = facts
.map(
(fact) => `- [${fact.fact_type}] ${fact.fact_key}: ${fact.fact_value}`,
)
.join("\n");
conversation.push({
role: "system",
content: `Known shared facts (${memoryScope} scope):\n${factText}`,
});
}
if (userFacts.length > 0) {
const userFactText = userFacts
.map(
(fact) => `- [${fact.fact_type}] ${fact.fact_key}: ${fact.fact_value}`,
)
.join("\n");
conversation.push({
role: "system",
content: `Known facts about this user across chats:\n${userFactText}`,
});
}
if (knowledgeBase.length > 0) {
const knowledgeText = knowledgeBase
.map((k) => `- ${k.content}`)
.join("\n");
conversation.push({
role: "system",
content: `Server Knowledge Base (use this to answer questions):\n${knowledgeText}`,
});
}
for (const msg of recentMessages) {
conversation.push({
role: msg.role === "assistant" ? "assistant" : "user",
content: msg.content,
});
}
return conversation;
}
function getTicketContextForMessage(message) {
if (!message?.channel) return null;
if (typeof db.getTicketByAIChannel === "function") {
const aiTicket = db.getTicketByAIChannel(message.channel.id);
if (aiTicket) return aiTicket;
}
if (typeof db.getTicket === "function") {
const directTicket = db.getTicket(message.channel.id);
if (directTicket) return directTicket;
}
if (message.channel.isThread() && typeof db.getTicket === "function") {
const parentTicket = db.getTicket(message.channel.parentId);
if (parentTicket) return parentTicket;
}
return null;
}
function getAIMessageType() {
return String(supportbotai.Style?.MessageType || "embed").toLowerCase();
}
function shouldSuggestTicket(message, ticket) {
if (supportbotai.Features?.SuggestTickets !== true) return false;
if (ticket) return false;
if (message.channel.isThread()) return false;
return CHANNELS.includes(message.channel.id);
}
function getSuggestTicketText() {
return (
supportbotai.Messages?.SuggestTicketText ||
"-# Need more help? React with 🎫 to open a ticket."
);
}
async function sendAIResponse({
client,
message,
replyContent,
suggestTicket = false,
}) {
const messageType = getAIMessageType();
const ticketHint = suggestTicket ? `\n\n${getSuggestTicketText()}` : "";
if (messageType === "text") {
return message.reply({
content: `${replyContent}${ticketHint}`,
});
}
if (messageType === "components_v2") {
const {
ContainerBuilder,
TextDisplayBuilder,
SeparatorBuilder,
MessageFlags,
} = Discord;
const container = new ContainerBuilder();
if (supportbot.Embed?.Colours?.General) {
container.setAccentColor(
parseInt(String(supportbot.Embed.Colours.General).replace("#", ""), 16),
);
}
const title = new TextDisplayBuilder().setContent(
`**${supportbotai.General?.Name || "SupportBot AI"}**`,
);
const body = new TextDisplayBuilder().setContent(replyContent);
container.addTextDisplayComponents(title);
container.addSeparatorComponents(new SeparatorBuilder().setDivider(true));
container.addTextDisplayComponents(body);
if (suggestTicket) {
container.addSeparatorComponents(new SeparatorBuilder().setDivider(true));
container.addTextDisplayComponents(
new TextDisplayBuilder().setContent(getSuggestTicketText()),
);
}
return message.reply({
flags: MessageFlags.IsComponentsV2,
components: [container],
});
}
const embed = new Discord.EmbedBuilder()
.setAuthor({
name: supportbotai.General.Name,
iconURL: client.user.displayAvatarURL(),
})
.setDescription(`${replyContent}${ticketHint}`)
.setColor(supportbotai.Embed.Color)
.setFooter({
text: supportbotai.Embed.Footer,
iconURL: message.author.displayAvatarURL(),
})
.setTimestamp();
return message.reply({ embeds: [embed] });
}
function rememberUserFacts(message) {
if (!message?.guild || !message?.author || !message?.content) return;
const content = message.content.trim();
const nameMatch = content.match(/^my name is\s+(.+)$/i);
if (nameMatch && typeof AIDatabase.saveUserFact === "function") {
AIDatabase.saveUserFact({
guildId: message.guild.id,
userId: message.author.id,
factType: "profile",
factKey: "name",
factValue: nameMatch[1].trim(),
});
}
const nicknameMatch = content.match(/^i(?:'| a)?m\s+(.+)$/i);
if (
nicknameMatch &&
nicknameMatch[1] &&
nicknameMatch[1].length <= 32 &&
typeof AIDatabase.saveUserFact === "function"
) {
AIDatabase.saveUserFact({
guildId: message.guild.id,
userId: message.author.id,
factType: "profile",
factKey: "display_name",
factValue: nicknameMatch[1].trim(),
});
}
const usesMatch = content.match(/^i use\s+(.+)$/i);
if (usesMatch && typeof AIDatabase.saveUserFact === "function") {
AIDatabase.saveUserFact({
guildId: message.guild.id,
userId: message.author.id,
factType: "preference",
factKey: "uses",
factValue: usesMatch[1].trim(),
});
}
}
module.exports = new Event("messageCreate", async (client, message) => {
if (message.author.bot || !message.guild) return;
let shouldRespond =
CHANNELS.includes(message.channelId) ||
message.mentions.users.has(client.user.id);
if (!shouldRespond && message.channel.isThread()) {
let ticket = null;
if (typeof db.getTicketByAIChannel === "function") {
ticket = db.getTicketByAIChannel(message.channel.id);
}
if (!ticket && typeof db.getTicket === "function") {
ticket = db.getTicket(message.channel.id);
}
if (
!ticket &&
message.channel.parentId &&
typeof db.getTicket === "function"
) {
ticket = db.getTicket(message.channel.parentId);
}
if (
ticket &&
ticket.aiModeEnabled &&
ticket.aiChannelId === message.channel.id
) {
shouldRespond = true;
}
}
if (!shouldRespond) return;
if (!supportbotai.Enabled) {
const embed = new Discord.EmbedBuilder()
.setAuthor({
name: supportbotai.General.Name,
iconURL: client.user.displayAvatarURL(),
})
.setDescription(
supportbotai.Messages?.AIDisabled || "AI is currently disabled.",
)
.setColor(supportbot.Embed.Colours.Error)
.setFooter({
text: supportbotai.Embed.Footer,
iconURL: message.author.displayAvatarURL(),
});
return message.reply({ embeds: [embed] });
}
const typingInterval = setInterval(() => {
message.channel.sendTyping().catch(() => { });
}, 5000);
try {
const memoryConfig = supportbotai.Memory || {};
const memoryEnabled = memoryConfig.Enabled !== false;
if (memoryEnabled) {
AIDatabase.addMessage({
guildId: message.guild.id,
channelId: message.channel.id,
userId: message.author.id,
role: "user",
content: message.content,
});
rememberUserFacts(message);
}
const ticket = getTicketContextForMessage(message);
const conversation = buildConversationFromMemory(message);
if (ticket) {
conversation.push({
role: "system",
content: buildTicketContext(ticket, message),
});
}
const provider = getProvider();
const response = await provider.chat({
messages: conversation,
temperature: supportbotai.General.Temperature || 0.4,
maxTokens: supportbotai.General.Tokens || 800,
});
clearInterval(typingInterval);
if (!response?.content) {
const embed = new Discord.EmbedBuilder()
.setDescription(
supportbotai.Messages?.ErrorResponse ||
"I couldn't generate a response.",
)
.setColor(supportbotai.Embed.Color);
return message.reply({ embeds: [embed] });
}
const replyContent = response.content;
if (memoryEnabled) {
AIDatabase.addMessage({
guildId: message.guild.id,
channelId: message.channel.id,
userId: client.user.id,
role: "assistant",
content: replyContent,
});
}
if (replyContent.length > 4000) {
const pasteLink = await createPaste(replyContent);
if (pasteLink) {
const embed = new Discord.EmbedBuilder()
.setDescription(
(
supportbotai.Messages?.MessageTooLong ||
"My response was too long, so I uploaded it here: {pastebin}"
).replace("{pastebin}", pasteLink),
)
.setColor(supportbotai.Embed.Color);
return message.reply({ embeds: [embed] });
}
return message.reply({
content: replyContent.slice(0, 1900),
});
}
const suggestTicket = shouldSuggestTicket(message, ticket);
const sentMessage = await sendAIResponse({
client,
message,
replyContent,
suggestTicket: false,
});
if (
shouldSuggestTicket(message, ticket) &&
supportbotai.Features?.SuggestTickets === true
) {
const hintMessage = await message.channel.send(
supportbotai.Messages?.SuggestTicketText ||
"Need more help? React with 🎫 to open a ticket.",
);
await hintMessage
.react(supportbotai.Messages?.SuggestTicketReaction || "🎫")
.catch(() => { });
setTimeout(
() => {
hintMessage.delete().catch(() => { });
},
5 * 60 * 1000,
);
}
} catch (error) {
clearInterval(typingInterval);
console.error("AI Error:", error);
const embed = new Discord.EmbedBuilder()
.setDescription(
supportbotai.Messages?.AIError ||
supportbotai.Messages?.ErrorResponse ||
"There was an error contacting the AI provider.",
)
.setColor(supportbot.Embed.Colours.Error);
message.reply({ embeds: [embed] }).catch(() => { });
}
});
+36
View File
@@ -0,0 +1,36 @@
const { EmbedBuilder } = require('discord.js');
const fs = require("fs");
const yaml = require("js-yaml");
const Event = require("../Structures/Event.js");
const supportbot = yaml.load(fs.readFileSync("./Configs/supportbot.yml", "utf8"));
const msgconfig = yaml.load(fs.readFileSync("./Configs/messages.yml", "utf8"));
module.exports = new Event("messageDelete", async (client, message) => {
if (!message.guild) return;
const author = message.author || (message.partial ? await message.fetch().then(m => m.author).catch(() => null) : null);
if (!author || author.bot) return;
const content = message.content || (message.attachments.size > 0 ? "Contains attachment(s)" : "*No content*");
const deleteLogChannel = message.guild.channels.cache.get(supportbot.MessageDelete.Channel) ||
message.guild.channels.cache.find(c => c.name === supportbot.MessageDelete.Channel);
const deletedMessageEmbed = new EmbedBuilder()
.setColor(supportbot.MessageDelete.Colour)
.setTitle("Message Deleted")
.setDescription(`> **Channel:** <#${message.channel.id}>\n> **Message ID:** ${message.id}\n> **Message author:** ${author.tag} (${author.id})\n> **Message Created:** <t:${Math.floor(message.createdTimestamp / 1000)}:F>`)
.addFields({ name: "Deleted Content", value: content, inline: false })
.setThumbnail(author.displayAvatarURL())
.setTimestamp();
if (message.attachments.size > 0) {
const attachment = message.attachments.first();
deletedMessageEmbed.addFields({ name: "Attachment", value: `[${attachment.name}](${attachment.proxyURL})` });
}
if (deleteLogChannel) {
deleteLogChannel.send({ embeds: [deletedMessageEmbed] });
}
});
+75
View File
@@ -0,0 +1,75 @@
const fs = require("fs");
const yaml = require("js-yaml");
const supportbot = yaml.load(
fs.readFileSync("./Configs/supportbot.yml", "utf8"),
);
const supportbotai = yaml.load(
fs.readFileSync("./Configs/supportbot-ai.yml", "utf8"),
);
const cmdconfig = yaml.load(fs.readFileSync("./Configs/commands.yml", "utf8"));
const Event = require("../Structures/Event.js");
module.exports = new Event(
"messageReactionAdd",
async (client, reaction, user) => {
try {
if (user.bot) return;
if (reaction.partial) {
await reaction.fetch().catch(() => null);
}
const message = reaction.message;
if (!message || !message.guild) return;
const reactionEmoji = reaction.emoji?.name || reaction.emoji?.id || null;
const expectedReaction =
supportbotai.Messages?.SuggestTicketReaction || "🎫";
if (reactionEmoji !== expectedReaction) return;
if (supportbotai.Features?.SuggestTickets !== true) return;
if (message.author?.id !== client.user.id) return;
const expectedText =
supportbotai.Messages?.SuggestTicketText ||
"Need more help? React with 🎫 to open a ticket.";
if ((message.content || "").trim() !== expectedText.trim()) return;
await message.delete().catch(() => {});
const cmd = client.commands.get(cmdconfig.OpenTicket.Command);
if (!cmd) {
console.error("Open ticket command not found.");
return;
}
const member = await message.guild.members
.fetch(user.id)
.catch(() => null);
if (!member) return;
const fakeInteraction = {
user,
member,
guild: message.guild,
channel: message.channel,
client,
replied: true,
deferred: false,
reason: `Opened from AI suggestion in #${message.channel.name}`,
options: {
getString: () => null,
},
reply: async () => null,
};
await cmd.run(fakeInteraction);
} catch (error) {
console.error("Error handling AI ticket reaction:", error);
}
},
);
+57
View File
@@ -0,0 +1,57 @@
const { EmbedBuilder } = require('discord.js');
const fs = require("fs");
const yaml = require("js-yaml");
const Event = require("../Structures/Event.js");
// Load the configuration files
const supportbot = yaml.load(fs.readFileSync("./Configs/supportbot.yml", "utf8"));
const msgconfig = yaml.load(fs.readFileSync("./Configs/messages.yml", "utf8"));
module.exports = new Event("messageUpdate", async (client, oldMessage, newMessage) => {
// Check if the message is from a guild and not from a bot
if (!newMessage.guild || newMessage.author.bot) return;
// Fetch old message if it's not cached (important for message content)
if (!oldMessage.content && oldMessage.partial) {
try {
oldMessage = await oldMessage.fetch();
} catch (err) {
console.error('Error fetching old message:', err);
return;
}
}
// Fallback if content is missing
const oldMessageContent = oldMessage.content || (oldMessage.attachments.size > 0 ? 'Contains attachment(s)' : '*No content*');
const newMessageContent = newMessage.content || (newMessage.attachments.size > 0 ? 'Contains attachment(s)' : '*No content*');
// Get the update log channel either by ID or by name
const updateLogChannel = newMessage.guild.channels.cache.get(supportbot.MessageUpdate.Channel) ||
newMessage.guild.channels.cache.find(channel => channel.name === supportbot.MessageUpdate.Channel);
// Create the embed for the updated message
const updatedMessageEmbed = new EmbedBuilder()
.setColor(supportbot.MessageUpdate.Colour)
.setTitle("Message Updated")
.setDescription(`> **Channel:** <#${newMessage.channel.id}>\n> **Message ID:** [${newMessage.id}](https://discord.com/channels/${newMessage.guild.id}/${newMessage.channel.id}/${newMessage.id})\n> **Message author:** ${newMessage.author.tag} (${newMessage.author.id})\n> **Message Created:** <t:${Math.floor(oldMessage.createdTimestamp / 1000)}:F>`)
.addFields(
{ name: 'Old Message', value: oldMessageContent, inline: false },
{ name: 'New Message', value: newMessageContent, inline: false }
)
.setThumbnail(newMessage.author.displayAvatarURL())
.setTimestamp();
// If the new message contains an attachment, add it to the embed
if (newMessage.attachments.size > 0) {
const attachment = newMessage.attachments.first();
updatedMessageEmbed.addFields({ name: 'Attachment', value: `[${attachment.name}](${attachment.proxyURL})` });
}
// Send the embed to the update log channel if the channel is found
if (updateLogChannel) {
updateLogChannel.send({
embeds: [updatedMessageEmbed]
});
}
});
+126
View File
@@ -0,0 +1,126 @@
const fs = require("fs");
const Discord = require("discord.js");
const yaml = require("js-yaml");
const Event = require("../Structures/Event.js");
// Load configs
const supportbot = yaml.load(fs.readFileSync("./Configs/supportbot.yml", "utf8"));
const ACTIVITY_TYPES = {
PLAYING: Discord.ActivityType.Playing,
WATCHING: Discord.ActivityType.Watching,
LISTENING: Discord.ActivityType.Listening,
COMPETING: Discord.ActivityType.Competing
};
const setActivity = (client, type, status) => {
const activityType = ACTIVITY_TYPES[type?.toUpperCase()];
if (!activityType) return;
client.user.setPresence({
activities: [{ name: status || "Online", type: activityType }],
status: "online"
});
};
// simple colors
const c = {
reset: "\x1b[0m",
gray: "\x1b[90m",
green: "\x1b[32m",
yellow: "\x1b[33m",
cyan: "\x1b[36m",
bold: "\x1b[1m"
};
function line() {
console.log(`${c.gray}────────────────────────────────────────────────────────${c.reset}`);
}
function section(title) {
console.log(`\n${c.green}${title}${c.reset}`);
console.log(`${c.gray}${"-".repeat(title.length)}${c.reset}`);
}
function info(label, value) {
console.log(`${c.gray}${label.padEnd(14)}${c.reset} ${value}`);
}
function status(label, ok, details = "") {
const icon = ok ? `${c.green}✓${c.reset}` : `${c.yellow}!${c.reset}`;
console.log(` ${icon} ${label}${details ? ` (${details})` : ""}`);
}
const logStartup = async (client) => {
console.clear();
const botName = supportbot?.General?.Name || "SupportBot";
const botVersion = supportbot?.SupportBot_Version || "Unknown";
const inviteUrl = `https://discord.com/api/oauth2/authorize?client_id=${client.user.id}&permissions=8&scope=bot%20applications.commands`;
line();
console.log(`${c.bold}${c.green}SupportBot${c.reset}`);
console.log(`${c.gray}Emerald Services${c.reset}`);
line();
section("System");
info("Bot Name", botName);
info("Version", botVersion);
info("Node.js", process.version);
info("Discord.js", `v${Discord.version}`);
info("Logged in as", client.user.tag);
info("Guilds", `${client.guilds.cache.size}`);
section("Links");
info("Docs", "https://emerald-services.gitbook.io/");
info("Discord", "https://dsc.gg/emerald-dev");
info("Invite", inviteUrl);
console.log("");
};
const checkConfigs = async (client) => {
const guild = client.guilds.cache.first();
if (!guild) return;
section("Config Check");
const roles = [
supportbot?.Roles?.StaffMember?.Admin,
supportbot?.Roles?.StaffMember?.Staff,
supportbot?.Roles?.AutoRole?.Role
].filter(Boolean);
const channels = [
supportbot?.Ticket?.TicketHome
].filter(Boolean);
const [roleResults, channelResults] = await Promise.all([
Promise.all(roles.map((role) => client.getRole(role, guild))),
Promise.all(channels.map((channel) => client.getChannel(channel, guild)))
]);
const missingRoles = roles.filter((_, i) => !roleResults[i]);
const missingChannels = channels.filter((_, i) => !channelResults[i]);
if (!missingRoles.length && !missingChannels.length) {
status("All configurations validated successfully", true);
} else {
if (missingRoles.length) {
status("Missing roles", false, missingRoles.join(", "));
}
if (missingChannels.length) {
status("Missing channels", false, missingChannels.join(", "));
}
}
console.log("");
};
module.exports = new Event("clientReady", async (client) => {
setActivity(client, supportbot?.Activity?.Type, supportbot?.Activity?.Status);
await logStartup(client);
await checkConfigs(client);
});
+21
View File
@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2026 Emerald Services
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
+78 -111
View File
@@ -1,129 +1,96 @@
<h1 align="center">SupportBot v4.0.0</h1>
<h4 align="center">A Self Hosted discord application</h4>
<h1 align="center">
<br>
<a href="https://github.com/Emerald-Services/SupportBot"><img src="https://i.imgur.com/cuadAYv.png"></a>
<br>
SupportBot
<br>
</h1>
<div align="center">
<a href="https://opensource.org/licenses/MIT">
<img src="https://img.shields.io/badge/license-MIT-green?style=for-the-badge" alt="shield.png">
</a>
<a href="https://github.com/discordjs">
<img src="https://img.shields.io/badge/DISCORD.JS%20-%20v14-blue?style=for-the-badge" alt="shield.png">
</a>
<a href="https://github.com/nodejs/node">
<img src="https://img.shields.io/badge/NODE.JS%20-%20v20.x-green?style=for-the-badge" alt="shield.png">
</a>
<a href="https://github.com/Emerald-Services/SupportBot/releases">
<img src="https://img.shields.io/github/downloads/Emerald-Services/SupportBot/total?style=for-the-badge" alt="shield.png">
</a>
## Supported Versions
| SupportBot | Node.JS | Discord.JS | Supported |
|------------|---------|------------|------------|
| 8.x | 22.x | 14.x. | ✅ Yes
| 7.7.3 | 16.x | 13.x. | ❌ No
| 7.x | 16.x | 13.x. | ❌ No
| 6.x | 14.x | 13.x. | ❌ No
| 5.x | 12.x | 13.x. | ❌ No
| 4.x | 11.x | 13.x. | ❌ No
| Older | 10.x | 13.x. | ❌ No
</div>
<p align="center">
<a href="https://discord.gg/hmWgxdF">
<img src="https://discordapp.com/api/guilds/516345301985132552/widget.png?style=shield" alt="Discord Server">
</a>
<img src="https://img.shields.io/badge/Made%20with-NodeJS-blue.svg" alt="Made with NodeJS">
<img src="https://img.shields.io/github/release/EmeraldRusher/SupportBot.svg" alt="GitHub release">
<img src="https://img.shields.io/github/package-json/dependency-version/EmeraldRusher/SupportBot/discord.js.svg" alt="GitHub package.json dependency version (prod)">
<a href="https://emeraldsrv.com/">Website</a>
•
<a href="https://github.com/Emerald-Services/SupportBot/wiki">Wiki</a>
<br>
<a href="#about">About</a>
•
<a href="#support">Support</a>
•
<a href="#license">License</a>
•
<a href="https://github.com/Emerald-Services/SupportBot/wiki/Third-Party-Developer">Third-Party</a>
•
<a href="#contributors">Contributors</a>
</p>
SupportBot is a free & open source discord bot for your server that has the capability to control & manage your servers support.
## About
| Version | Supported | Status |
| ------- | ------------------ |--------------------|
| 1.x | 🚫 | Discontinued |
| 2.x | 🚫 | Discontinued |
| 3.x | ✔️ | Supported |
| 4.x | ✔️ | Supported |
| Premium | ❌ | Not released yet |
SupportBot is an Open-Source discord bot built with [discord.js](https://github.com/discordjs/discord.js). It's primarily focused to help servers organise and manage their support system in a unique way with full customisation to match your brand.
# Getting Started
Firstly you will need to download the resource, Once you have downloaded the resource open a new tab in your browser and go to https://discordapp.com/developers/applications/. Create a new application and then open your app and select bot and then create your bot. Copy the bot token and paste it where it says ``"token": "BOT TOKEN HERE",`` in the ``settings.json`` file.
## Support
# Invite the bot
Head back to discord developers portal where your application is and head into the ``OAuth`` tab and select bot and then below select ``Administrator`` then copy the link and paste into your browser and it should as your to invite the bot to a server.
<a href="https://emeraldsrv.com/discord">
<img alt="Discord" src="https://img.shields.io/discord/597779408295821323?logo=discord&logoColor=white&style=for-the-badge">
</a>
# Help
If you don't understand something, you are experiencing problems, or you just need a gentle nudge in the right direction, please don't hesitate to join our official [Emerald Services Server](https://discord.gg/u47MQJ).
# Configurating SupportBot
Once you have setup your discord application such as invited the bot and added your bot token to the ``settings.json`` we can begin configurating your bot. Firstly open up the ``settings.json`` file and you will see loads of different things to config. You will see the following below:
## License
```
{
"SupportBot": "v4.0.0",
"token": "BOT_TOKEN_HERE",
"prefix": "!",
"botname": "SupportBot",
"colour": "#13bd2a",
"footer": "Support Bot, By Emerald Services",
"BotStatus": "Support Bot",
"staff": "Staff",
"support": "Support",
"everyone": "@everyone",
"Auto_Role": "Member",
"LINKS": {
"Discord": "https://discord.gg/",
"Twitter": "https://twitter.com/",
"Website": "https://example.com/",
"AddMore": "AddMoreIfYouWant"
},
"LINKS_TITLE": "SupportBot Links",
Released under the [MIT](https://opensource.org/licenses/MIT) license.
"category": "Tickets",
"Ticket_Message": "Your support ticket has been opened successfully\nPlease allow us some time to reach out to you.",
"Ticket_Logs": "ticket-logs",
"bot.settings.Default_Ticket_Reason": "No Subject",
"Ticket_React_Message": ":mailbox: React to create your support ticket.",
"Commands_Log_Title": "SupportBot Logs",
"Command_Log_Channel": "command-logs",
"Announcement_Title": "SupportBot Announcement",
"Announcement_Channel": "announcements",
"Announcement_Tag_Role": "@everyone",
"Welcome_Message": "Welcome to the server!",
"Welcome_Channel": "welcome",
"Leave_Message": "Thank you for visiting us!",
"Leave_Channel": "welcome",
## Third-Party
"Poll_Channel": "polls",
"Poll_Title": "📊 Polls",
"Reaction_Poll_1": "✅",
"Reaction_Poll_2": "❎",
"Suggestion_Title": "SupportBot Suggestions",
"Suggestion_Channel": "suggestions",
"suggestyes": "✅",
"suggestno": "❎",
"Report_Channel": "reports",
"Report_Title": "SupportBot Report",
- [Official addons repository](https://github.com/Emerald-Services/Addons/)
- [Syphers Addons](https://github.com/SypherRed/SB_Addons_Unofficial)
- [BuiltByBit]([https://builtbybit.com/supportbot](https://builtbybit.com/resources/supportbot-advanced-ticket-bot.8940/))
- [Polymart](https://polymart.org/resource/supportbot-1-discord-ticket-bot.518)
"Announcement_Command": "announce",
"Say_Command": "say",
"Suggest_Command": "suggest",
"Ping_Command": "ping",
"Ticket_Command": "ticket",
"Remove_Command": "remove",
"Add_Command": "add",
"Close_Command": "close",
"Forceclose_Command": "forceclose",
"Rename_Command": "rename",
"Help_Command": "help",
"Link_Command": "links",
"Lockchat_Command": "lock",
"UnLockchat_Command": "unlock",
"Poll_Command": "poll",
"Report_Command": "report"
}
```
## Contributors
<a href="https://github.com/Emerald-Services/SupportBot/graphs/contributors">
<img src="https://contrib.rocks/image?repo=Emerald-Services/SupportBot">
</a>
## Hosting
You can use our [Pterodactyl egg](https://github.com/Emerald-Services/Pterodactyl-Egg) to host it on your own panel. We currently don't offer hosting for you, altough we might add this in the future.
If you don't know how to install pterodactyl, you could always host it on replit:
[![Run on Repl.it](https://repl.it/badge/github/ItsNyoty/IKI-bot)]([https://repl.it/github/ItsNyoty/iki](https://repl.it/github/Emerald-Services/SupportBot
)
# Contributors List
<p>
<a href="https://github.com/iJosGCS">
<img src="https://cdn.discordapp.com/avatars/199237487648833556/cdd7d976b75698b19e3c6b64e1dcdceb.png?size=32" alt="iJosGCS Profile">
<strong>@iJosGCS</strong>
</a>
</p>
<p>
<a href="https://github.com/RedstoneGamez">
<img src="https://cdn.discordapp.com/avatars/282610987801247744/9567e0674a5a6d371bb5d6efb956d57b.png?size=32" alt="RedstoneGamez Profile">
<strong>@RedstoneGamez</strong>
</a>
</p>
# Donators List
+20
View File
@@ -0,0 +1,20 @@
# Security Policy
## Supported Versions
Use this section to tell people about which versions of your project are
currently being supported with security updates.
| Version | Supported |
| ------- | ------------------ |
| 7.7.2 | :white_check_mark: |
| 7.7.1 | :white_check_mark: |
| < 4.0 | :x: |
## Reporting a Vulnerability
Use this section to tell people how to report a vulnerability.
Tell them where to go, how often they can expect to get an update on a
reported vulnerability, what to expect if the vulnerability is accepted or
declined, etc.
+438
View File
@@ -0,0 +1,438 @@
const Database = require("better-sqlite3");
const path = require("path");
const db = new Database(path.join(__dirname, "../Data/ai-memory.db"));
db.pragma("journal_mode = WAL");
db.prepare(
`
CREATE TABLE IF NOT EXISTS ai_conversations (
id INTEGER PRIMARY KEY AUTOINCREMENT,
guild_id TEXT,
channel_id TEXT,
user_id TEXT,
role TEXT NOT NULL,
content TEXT NOT NULL,
created_at INTEGER NOT NULL
)
`,
).run();
db.prepare(
`
CREATE TABLE IF NOT EXISTS ai_summaries (
id INTEGER PRIMARY KEY AUTOINCREMENT,
guild_id TEXT,
channel_id TEXT,
summary TEXT NOT NULL,
created_at INTEGER NOT NULL,
updated_at INTEGER NOT NULL
)
`,
).run();
db.prepare(
`
CREATE TABLE IF NOT EXISTS ai_facts (
id INTEGER PRIMARY KEY AUTOINCREMENT,
guild_id TEXT,
channel_id TEXT,
user_id TEXT,
fact_type TEXT NOT NULL,
fact_key TEXT NOT NULL,
fact_value TEXT NOT NULL,
created_at INTEGER NOT NULL,
updated_at INTEGER NOT NULL
)
`,
).run();
db.prepare(
`
CREATE TABLE IF NOT EXISTS ai_knowledge (
id INTEGER PRIMARY KEY AUTOINCREMENT,
source_type TEXT NOT NULL,
source_name TEXT NOT NULL,
title TEXT NOT NULL,
content TEXT NOT NULL,
created_at INTEGER NOT NULL,
updated_at INTEGER NOT NULL
)
`,
).run();
db.prepare(
`
CREATE TABLE IF NOT EXISTS ai_sessions (
id INTEGER PRIMARY KEY AUTOINCREMENT,
guild_id TEXT,
channel_id TEXT,
user_id TEXT,
model TEXT,
mode TEXT,
last_message_at INTEGER,
created_at INTEGER NOT NULL,
updated_at INTEGER NOT NULL
)
`,
).run();
try {
db.prepare(`ALTER TABLE ai_facts ADD COLUMN user_id TEXT`).run();
} catch (e) {
if (!String(e).includes("duplicate column name")) throw e;
}
module.exports = {
saveUserFact({ guildId, userId, factType, factKey, factValue }) {
const existing = db
.prepare(
`
SELECT id FROM ai_facts
WHERE guild_id IS ? AND user_id IS ? AND fact_type = ? AND fact_key = ?
LIMIT 1
`,
)
.get(guildId || null, userId || null, factType, factKey);
if (existing) {
db.prepare(
`
UPDATE ai_facts
SET fact_value = ?, updated_at = ?
WHERE id = ?
`,
).run(factValue, Date.now(), existing.id);
return;
}
db.prepare(
`
INSERT INTO ai_facts (
guild_id, channel_id, user_id, fact_type, fact_key, fact_value, created_at, updated_at
) VALUES (?, ?, ?, ?, ?, ?, ?, ?)
`,
).run(
guildId || null,
null,
userId || null,
factType,
factKey,
factValue,
Date.now(),
Date.now(),
);
},
getUserFacts(guildId, userId) {
return db
.prepare(
`
SELECT * FROM ai_facts
WHERE guild_id IS ? AND user_id IS ?
ORDER BY updated_at DESC
`,
)
.all(guildId || null, userId || null);
},
getUserFactsByScope({ guildId = null, userId = null, scope = "guild" }) {
if (!userId) return [];
if (scope === "global") {
return db
.prepare(
`
SELECT * FROM ai_facts
WHERE user_id IS ?
ORDER BY updated_at DESC
`,
)
.all(userId || null);
}
return db
.prepare(
`
SELECT * FROM ai_facts
WHERE guild_id IS ? AND user_id IS ?
ORDER BY updated_at DESC
`,
)
.all(guildId || null, userId || null);
},
addMessage({ guildId, channelId, userId, role, content }) {
db.prepare(
`
INSERT INTO ai_conversations (
guild_id, channel_id, user_id, role, content, created_at
) VALUES (?, ?, ?, ?, ?, ?)
`,
).run(
guildId || null,
channelId || null,
userId || null,
role,
content,
Date.now(),
);
},
getRecentMessages(channelId, limit = 15) {
return db
.prepare(
`
SELECT * FROM ai_conversations
WHERE channel_id = ?
ORDER BY created_at DESC
LIMIT ?
`,
)
.all(channelId, limit)
.reverse();
},
getRecentMessagesByScope({ guildId = null, channelId = null, limit = 15, scope = "guild" }) {
if (scope === "channel") {
return db
.prepare(
`
SELECT * FROM ai_conversations
WHERE channel_id = ?
ORDER BY created_at DESC
LIMIT ?
`,
)
.all(channelId || null, limit)
.reverse();
}
if (scope === "global") {
return db
.prepare(
`
SELECT * FROM ai_conversations
ORDER BY created_at DESC
LIMIT ?
`,
)
.all(limit)
.reverse();
}
return db
.prepare(
`
SELECT * FROM ai_conversations
WHERE guild_id IS ?
ORDER BY created_at DESC
LIMIT ?
`,
)
.all(guildId || null, limit)
.reverse();
},
saveSummary({ guildId, channelId, summary }) {
const existing = db
.prepare(
`
SELECT id FROM ai_summaries
WHERE guild_id IS ? AND channel_id IS ?
ORDER BY updated_at DESC
LIMIT 1
`,
)
.get(guildId || null, channelId || null);
if (existing) {
db.prepare(
`
UPDATE ai_summaries
SET summary = ?, updated_at = ?
WHERE id = ?
`,
).run(summary, Date.now(), existing.id);
return;
}
db.prepare(
`
INSERT INTO ai_summaries (
guild_id, channel_id, summary, created_at, updated_at
) VALUES (?, ?, ?, ?, ?)
`,
).run(guildId || null, channelId || null, summary, Date.now(), Date.now());
},
getLatestSummary(channelId) {
return db
.prepare(
`
SELECT * FROM ai_summaries
WHERE channel_id = ?
ORDER BY updated_at DESC
LIMIT 1
`,
)
.get(channelId);
},
getLatestSummaryByScope({ guildId = null, channelId = null, scope = "guild" }) {
if (scope === "channel") {
return db
.prepare(
`
SELECT * FROM ai_summaries
WHERE channel_id = ?
ORDER BY updated_at DESC
LIMIT 1
`,
)
.get(channelId || null);
}
if (scope === "global") {
return db
.prepare(
`
SELECT * FROM ai_summaries
ORDER BY updated_at DESC
LIMIT 1
`,
)
.get();
}
return db
.prepare(
`
SELECT * FROM ai_summaries
WHERE guild_id IS ?
ORDER BY updated_at DESC
LIMIT 1
`,
)
.get(guildId || null);
},
saveFact({ guildId, channelId, factType, factKey, factValue }) {
const existing = db
.prepare(
`
SELECT id FROM ai_facts
WHERE guild_id IS ? AND channel_id IS ? AND fact_type = ? AND fact_key = ?
LIMIT 1
`,
)
.get(guildId || null, channelId || null, factType, factKey);
if (existing) {
db.prepare(
`
UPDATE ai_facts
SET fact_value = ?, updated_at = ?
WHERE id = ?
`,
).run(factValue, Date.now(), existing.id);
return;
}
db.prepare(
`
INSERT INTO ai_facts (
guild_id, channel_id, fact_type, fact_key, fact_value, created_at, updated_at
) VALUES (?, ?, ?, ?, ?, ?, ?)
`,
).run(
guildId || null,
channelId || null,
factType,
factKey,
factValue,
Date.now(),
Date.now(),
);
},
getFacts(channelId) {
return db
.prepare(
`
SELECT * FROM ai_facts
WHERE channel_id = ?
ORDER BY updated_at DESC
`,
)
.all(channelId);
},
getFactsByScope({ guildId = null, channelId = null, scope = "guild" }) {
if (scope === "channel") {
return db
.prepare(
`
SELECT * FROM ai_facts
WHERE channel_id = ? AND user_id IS NULL
ORDER BY updated_at DESC
`,
)
.all(channelId || null);
}
if (scope === "global") {
return db
.prepare(
`
SELECT * FROM ai_facts
WHERE user_id IS NULL
ORDER BY updated_at DESC
`,
)
.all();
}
return db
.prepare(
`
SELECT * FROM ai_facts
WHERE guild_id IS ? AND user_id IS NULL
ORDER BY updated_at DESC
`,
)
.all(guildId || null);
},
addKnowledge({ sourceType, sourceName, title, content }) {
db.prepare(
`
INSERT INTO ai_knowledge (
source_type, source_name, title, content, created_at, updated_at
) VALUES (?, ?, ?, ?, ?, ?)
`,
).run(sourceType, sourceName, title, content, Date.now(), Date.now());
},
getKnowledge(limit = 25) {
return db
.prepare(
`
SELECT * FROM ai_knowledge
ORDER BY updated_at DESC
LIMIT ?
`,
)
.all(limit);
},
clearKnowledge() {
db.prepare(`DELETE FROM ai_knowledge`).run();
},
clearConversations(channelId) {
if (!channelId) return;
db.prepare(`DELETE FROM ai_conversations WHERE channel_id = ?`).run(channelId);
},
};
+27
View File
@@ -0,0 +1,27 @@
// SupportBot | Emerald Services
// Addon Structure
class Command {
constructor(options) {
this.name = options.name;
this.description = options.description;
this.permissions = options.permissions;
this.options = options.options || [];
this.run = options.run;
this.defaultPermission = true;
}
// Method to dynamically update options
setOptions(options) {
this.options = options;
}
}
class Event {
constructor(event, run) {
this.event = event;
this.run = run;
}
}
module.exports = { Command, Event };
+191
View File
@@ -0,0 +1,191 @@
const fs = require("fs");
const path = require("path");
const Discord = require("discord.js");
const { GatewayIntentBits, Partials } = require("discord.js");
const yaml = require("js-yaml");
const { Command, Event } = require("./Addon.js");
const supportbot = yaml.load(fs.readFileSync("./Configs/supportbot.yml", "utf8"));
const cmdconfig = yaml.load(fs.readFileSync("./Configs/commands.yml", "utf8"));
const c = {
reset: "\x1b[0m",
gray: "\x1b[90m",
green: "\x1b[32m",
yellow: "\x1b[33m",
cyan: "\x1b[36m",
red: "\x1b[31m",
white: "\x1b[37m",
bold: "\x1b[1m",
};
function line() {
console.log(`${c.gray}────────────────────────────────────────────────────────${c.reset}`);
}
function section(title) {
console.log(`\n${c.green}${title}${c.reset}`);
console.log(`${c.gray}${"-".repeat(title.length)}${c.reset}`);
}
function walk(dir, ext = ".js", fileList = []) {
const files = fs.readdirSync(dir);
for (const file of files) {
const full = `${dir}/${file}`;
const stat = fs.statSync(full);
if (stat.isDirectory()) {
walk(full, ext, fileList);
} else if (file.endsWith(ext)) {
fileList.push(full);
}
}
return fileList;
}
class Client extends Discord.Client {
constructor() {
super({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMembers,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.GuildMessageReactions,
GatewayIntentBits.MessageContent,
],
partials: [Partials.Message, Partials.Channel, Partials.Reaction],
});
this.commands = new Discord.Collection();
}
async getChannel(channel, guild) {
if (!channel) return null;
const channelStr = String(channel).toLowerCase();
return guild.channels.cache.find(
(c) =>
(c.type === Discord.ChannelType.GuildText || c.type === Discord.ChannelType.GuildNews) &&
(c.id === channel || (c.name && c.name.toLowerCase() === channelStr)),
);
}
async getRole(role, guild) {
if (!role) return null;
const roleStr = String(role).toLowerCase();
return guild.roles.cache.find(
(r) => r.id === role || (r.name && r.name.toLowerCase() === roleStr),
);
}
async getCategory(category, guild) {
if (!category) return null;
const catStr = String(category).toLowerCase();
return guild.channels.cache.find(
(c) =>
c.type === Discord.ChannelType.GuildCategory &&
(c.id === category || (c.name && c.name.toLowerCase() === catStr)),
);
}
async start(token) {
const commandFiles = walk("./Commands");
const allCommands = commandFiles.map((file) => ({
file,
command: require(`../${file}`),
}));
const enabledCommands = allCommands.filter(({ command }) => {
const matchingConfig = Object.values(cmdconfig).find(
(entry) =>
entry &&
typeof entry === "object" &&
entry.Command &&
String(entry.Command).toLowerCase() === String(command.name).toLowerCase(),
);
if (!matchingConfig) {
return true;
}
return matchingConfig.Enabled !== false;
});
section("Commands");
enabledCommands.forEach(({ command, file }) => {
console.log(
`${c.green}✓${c.reset} ${c.white}${command.name}${c.reset} ${c.gray}(${path.basename(file)})${c.reset}`,
);
this.commands.set(command.name, command);
});
if (supportbot.General.Addons.Enabled) {
const addonFiles = fs.readdirSync("./Addons").filter((file) => file.endsWith(".js"));
section("Addons");
addonFiles.forEach((file) => {
let addon = require(`../Addons/${file}`);
// Handle single or multiple addons per file
const addonArray = Array.isArray(addon) ? addon : [addon];
addonArray.forEach((item, index) => {
// If name is missing, use filename (handling index for arrays)
if (!item.name) {
item.name = index === 0 ? file.split(".")[0] : `${file.split(".")[0]}_${index}`;
}
console.log(`${c.green}✓${c.reset} ${c.white}${item.name}${c.reset}`);
if (item instanceof Command) {
this.commands.set(item.name, item);
}
if (item.events && Array.isArray(item.events)) {
item.events.forEach((event) => {
if (event instanceof Event) {
this.on(event.event, (...args) => event.run(this, ...args));
}
});
}
// If it's a direct Event instance
if (item instanceof Event) {
this.on(item.event, (...args) => item.run(this, ...args));
}
});
});
}
this.once("clientReady", async () => {
await this.guilds.cache.first()?.commands.set(this.commands);
console.log(
`\n${c.green}✓${c.reset} ${c.white}Slash Commands Registered${c.reset} ${c.gray}for ${this.guilds.cache.first().name}${c.reset}`,
);
});
section("Events");
fs.readdirSync("./Events")
.filter((file) => file.endsWith(".js"))
.forEach((file) => {
const event = require(`../Events/${file}`);
console.log(
`${c.green}✓${c.reset} ${c.white}${event.event}${c.reset} ${c.gray}(${file})${c.reset}`,
);
this.on(event.event, (...args) => event.run(this, ...args));
});
console.log("");
if (process.argv[2] !== "test") {
await this.login(token);
} else {
console.log(`${c.red}RUNNING IN TEST MODE, IF NOT INTENDED, PLEASE USE npm start${c.reset}`);
}
}
}
module.exports = Client;
+14
View File
@@ -0,0 +1,14 @@
// SupportBot | Emerald Services
// Command Structure
class Command {
constructor(options) {
this.name = options.name;
this.description = options.description;
this.permissions = options.permissions || [];
this.options = options.options || [];
this.run = options.run;
this.defaultPermission = true;
}
}
module.exports = Command;
+474
View File
@@ -0,0 +1,474 @@
// SupportBot | Emerald Services
const Database = require("better-sqlite3");
const path = require("path");
const db = new Database(path.join(__dirname, "../Data/supportbot.db"));
db.prepare(
`
CREATE TABLE IF NOT EXISTS suggestions (
thread_id TEXT PRIMARY KEY,
author_id TEXT,
text TEXT,
status TEXT DEFAULT 'Created'
)
`,
).run();
db.prepare(
`
CREATE TABLE IF NOT EXISTS profiles (
user_id TEXT PRIMARY KEY,
bio TEXT,
timezone TEXT,
clockedIn INTEGER DEFAULT 0
)
`,
).run();
db.prepare(
`
CREATE TABLE IF NOT EXISTS tickets (
ticket_id TEXT PRIMARY KEY,
user_id TEXT,
status TEXT DEFAULT 'open',
created_at INTEGER,
updated_at INTEGER,
subject TEXT,
description TEXT
)
`,
).run();
// Safe column upgrades
const safeAlter = (sql) => {
try {
db.prepare(sql).run();
} catch (e) {
if (!String(e).includes("duplicate column name")) throw e;
}
};
safeAlter(`ALTER TABLE tickets ADD COLUMN voiceChannelId TEXT`);
safeAlter(`ALTER TABLE tickets ADD COLUMN department TEXT DEFAULT 'general'`);
safeAlter(`ALTER TABLE tickets ADD COLUMN priority TEXT DEFAULT 'medium'`);
safeAlter(`ALTER TABLE tickets ADD COLUMN aiModeEnabled INTEGER DEFAULT 0`);
safeAlter(`ALTER TABLE tickets ADD COLUMN aiChannelId TEXT`);
safeAlter(`ALTER TABLE tickets ADD COLUMN aiType TEXT`);
safeAlter(`ALTER TABLE tickets ADD COLUMN aiEnabledBy TEXT`);
safeAlter(`ALTER TABLE tickets ADD COLUMN aiEnabledAt INTEGER`);
safeAlter(`ALTER TABLE tickets ADD COLUMN questionAnswers TEXT`);
safeAlter(`ALTER TABLE tickets ADD COLUMN ticketName TEXT`);
safeAlter(`ALTER TABLE tickets ADD COLUMN ticketNumber TEXT`);
db.prepare(
`
CREATE TABLE IF NOT EXISTS ticket_panel (
id INTEGER PRIMARY KEY AUTOINCREMENT,
message_id TEXT,
channel_id TEXT,
created_at INTEGER
)
`,
).run();
db.prepare(
`
CREATE TABLE IF NOT EXISTS ticket_users (
ticket_id TEXT,
user_id TEXT,
PRIMARY KEY(ticket_id, user_id)
)
`,
).run();
db.prepare(
`
CREATE TABLE IF NOT EXISTS settings (
id INTEGER PRIMARY KEY,
data TEXT
)
`,
).run();
function ensureProfile(userId) {
const existing = db
.prepare(
`
SELECT user_id FROM profiles WHERE user_id = ?
`,
)
.get(userId);
if (!existing) {
db.prepare(
`
INSERT INTO profiles (user_id, bio, timezone, clockedIn)
VALUES (?, '', '', 0)
`,
).run(userId);
}
}
function normaliseTicketRow(row) {
if (!row) return null;
let questionAnswers = [];
if (row.questionAnswers) {
try {
questionAnswers = JSON.parse(row.questionAnswers);
} catch {
questionAnswers = [];
}
}
return {
...row,
aiModeEnabled: Boolean(row.aiModeEnabled),
clockedIn:
row.clockedIn !== undefined ? Boolean(row.clockedIn) : row.clockedIn,
questionAnswers,
};
}
module.exports = {
addTicket(ticket) {
const now = Date.now();
db.prepare(
`
INSERT INTO tickets (
ticket_id,
user_id,
subject,
description,
created_at,
updated_at,
department,
priority,
aiModeEnabled,
aiChannelId,
aiType,
aiEnabledBy,
aiEnabledAt,
questionAnswers,
ticketName,
ticketNumber
)
VALUES (
@ticket_id,
@user_id,
@subject,
@description,
@created_at,
@updated_at,
@department,
@priority,
@aiModeEnabled,
@aiChannelId,
@aiType,
@aiEnabledBy,
@aiEnabledAt,
@questionAnswers,
@ticketName,
@ticketNumber
)
ON CONFLICT(ticket_id) DO NOTHING
`,
).run({
ticket_id: ticket.id,
user_id: ticket.user,
subject: ticket.reason || "",
description: ticket.description || "",
created_at: now,
updated_at: now,
department: ticket.department || "general",
priority: ticket.priority || "medium",
aiModeEnabled: ticket.aiModeEnabled ? 1 : 0,
aiChannelId: ticket.aiChannelId || null,
aiType: ticket.aiType || null,
aiEnabledBy: ticket.aiEnabledBy || null,
aiEnabledAt: ticket.aiEnabledAt || null,
questionAnswers: JSON.stringify(ticket.questionAnswers || []),
ticketName: ticket.name || null,
ticketNumber: ticket.number || null,
});
},
updateTicketQuestionAnswers(ticketId, questionAnswers = []) {
db.prepare(
`
UPDATE tickets
SET questionAnswers=@questionAnswers, updated_at=@updatedAt
WHERE ticket_id=@ticketId
`,
).run({
ticketId,
questionAnswers: JSON.stringify(questionAnswers),
updatedAt: Date.now(),
});
},
updateTicketVoice(ticketId, voiceChannelId) {
db.prepare(
`
UPDATE tickets
SET voiceChannelId=@voiceChannelId, updated_at=@updatedAt
WHERE ticket_id=@ticketId
`,
).run({
ticketId,
voiceChannelId,
updatedAt: Date.now(),
});
},
updateTicketStatus(ticketId, status) {
db.prepare(
`
UPDATE tickets
SET status=@status, updated_at=@updatedAt
WHERE ticket_id=@ticketId
`,
).run({
status,
updatedAt: Date.now(),
ticketId,
});
},
updateTicketDepartment(ticketId, department) {
db.prepare(
`
UPDATE tickets
SET department=@department, updated_at=@updatedAt
WHERE ticket_id=@ticketId
`,
).run({
ticketId,
department,
updatedAt: Date.now(),
});
},
updateTicketPriority(ticketId, priority) {
db.prepare(
`
UPDATE tickets
SET priority=@priority, updated_at=@updatedAt
WHERE ticket_id=@ticketId
`,
).run({
ticketId,
priority,
updatedAt: Date.now(),
});
},
setTicketAIState(ticketId, aiState = {}) {
db.prepare(
`
UPDATE tickets
SET
aiModeEnabled=@aiModeEnabled,
aiChannelId=@aiChannelId,
aiType=@aiType,
aiEnabledBy=@aiEnabledBy,
aiEnabledAt=@aiEnabledAt,
updated_at=@updatedAt
WHERE ticket_id=@ticketId
`,
).run({
ticketId,
aiModeEnabled: aiState.enabled ? 1 : 0,
aiChannelId: aiState.aiChannelId || null,
aiType: aiState.aiType || null,
aiEnabledBy: aiState.enabledBy || null,
aiEnabledAt: aiState.enabledAt
? new Date(aiState.enabledAt).getTime()
: aiState.enabled
? Date.now()
: null,
updatedAt: Date.now(),
});
},
enableTicketAI(
ticketId,
aiChannelId = null,
aiType = null,
enabledBy = null,
) {
db.prepare(
`
UPDATE tickets
SET
aiModeEnabled=1,
aiChannelId=@aiChannelId,
aiType=@aiType,
aiEnabledBy=@aiEnabledBy,
aiEnabledAt=@aiEnabledAt,
updated_at=@updatedAt
WHERE ticket_id=@ticketId
`,
).run({
ticketId,
aiChannelId,
aiType,
aiEnabledBy,
aiEnabledAt: Date.now(),
updatedAt: Date.now(),
});
},
disableTicketAI(ticketId) {
db.prepare(
`
UPDATE tickets
SET
aiModeEnabled=0,
updated_at=@updatedAt
WHERE ticket_id=@ticketId
`,
).run({
ticketId,
updatedAt: Date.now(),
});
},
getTicket(ticketId) {
const row = db
.prepare(
`
SELECT * FROM tickets WHERE ticket_id=@ticketId
`,
)
.get({ ticketId });
return normaliseTicketRow(row);
},
getTicketByAIChannel(aiChannelId) {
const row = db
.prepare(
`
SELECT * FROM tickets WHERE aiChannelId=@aiChannelId LIMIT 1
`,
)
.get({ aiChannelId });
return normaliseTicketRow(row);
},
getAllTickets() {
return db.prepare(`SELECT * FROM tickets`).all().map(normaliseTicketRow);
},
saveTicketPanel(messageId, channelId) {
db.prepare(
`
INSERT INTO ticket_panel (message_id, channel_id, created_at)
VALUES (@messageId, @channelId, @createdAt)
`,
).run({ messageId, channelId, createdAt: Date.now() });
},
getTicketPanel() {
return db
.prepare(
`
SELECT * FROM ticket_panel ORDER BY id DESC LIMIT 1
`,
)
.get();
},
addUserToTicket(ticketId, userId) {
db.prepare(
`
INSERT INTO ticket_users (ticket_id, user_id)
VALUES (?, ?)
ON CONFLICT(ticket_id, user_id) DO NOTHING
`,
).run(ticketId, userId);
},
removeUserFromTicket(ticketId, userId) {
db.prepare(
`
DELETE FROM ticket_users WHERE ticket_id=? AND user_id=?
`,
).run(ticketId, userId);
},
getTicketUsers(ticketId) {
return db
.prepare(
`
SELECT user_id FROM ticket_users WHERE ticket_id=?
`,
)
.all(ticketId)
.map((r) => r.user_id);
},
getSettings() {
const row = db.prepare(`SELECT data FROM settings WHERE id=1`).get();
if (!row) return {};
try {
return JSON.parse(row.data);
} catch {
return {};
}
},
getProfile(userId) {
ensureProfile(userId);
const row = db
.prepare(
`
SELECT * FROM profiles WHERE user_id = ?
`,
)
.get(userId);
if (!row) {
return {
user_id: userId,
bio: "",
timezone: "",
clockedIn: false,
};
}
return {
...row,
clockedIn: Boolean(row.clockedIn),
};
},
setClockedIn(userId, clockedIn) {
ensureProfile(userId);
db.prepare(
`
UPDATE profiles
SET clockedIn = ?
WHERE user_id = ?
`,
).run(clockedIn ? 1 : 0, userId);
},
saveSettings(obj) {
const data = JSON.stringify(obj);
db.prepare(
`
INSERT INTO settings (id, data)
VALUES (1, @data)
ON CONFLICT(id) DO UPDATE SET data = excluded.data
`,
).run({ data });
},
};
+11
View File
@@ -0,0 +1,11 @@
// SupportBot | Emerald Services
// Event Structure
class Event {
constructor(event, run) {
this.event = event;
this.run = run;
}
}
module.exports = Event;
+30
View File
@@ -0,0 +1,30 @@
// SupportBot | Emerald Services
// Ticket ID Structure
const db = require("./Database")
class TicketNumberID {
static async pad() {
let num = await this.get()
let n = num + ""
await this.set(num + 1)
return n.length >= 4 ? n : new Array(4 - n.length + 1).join("0") + n
}
static async get() {
const row = db.getTicketPanel()
if (!row) return await this.set(0)
return row.id
}
static async set(value) {
db.saveTicketPanel(`panel-${value}`, "none")
return value
}
static async reset() {
return await this.set(0)
}
}
module.exports = TicketNumberID
+636
View File
@@ -0,0 +1,636 @@
const fs = require("fs");
const path = require("path");
const Discord = require("discord.js");
const yaml = require("js-yaml");
const db = require("./Database.js");
const supportbot = yaml.load(fs.readFileSync("./Configs/supportbot.yml", "utf8"));
const msgconfig = yaml.load(fs.readFileSync("./Configs/messages.yml", "utf8"));
function escapeHtml(str = "") {
return String(str)
.replace(/&/g, "&amp;")
.replace(/</g, "&lt;")
.replace(/>/g, "&gt;")
.replace(/"/g, "&quot;");
}
function parseMarkdown(content = "") {
let safe = escapeHtml(content);
safe = safe.replace(/```([\s\S]*?)```/g, "<pre><code>$1</code></pre>");
safe = safe.replace(/`(.*?)`/g, "<code>$1</code>");
safe = safe.replace(/\*\*(.*?)\*\*/g, "<strong>$1</strong>");
safe = safe.replace(/\*(.*?)\*/g, "<em>$1</em>");
safe = safe.replace(/_(.*?)_/g, "<em>$1</em>");
safe = safe.replace(
/\[(.*?)\]\((.*?)\)/g,
'<a href="$2" target="_blank" rel="noopener noreferrer">$1</a>',
);
return safe.replace(/\n/g, "<br>");
}
function formatDate(iso) {
try {
return new Date(iso).toLocaleString("en-GB", {
dateStyle: "medium",
timeStyle: "short",
});
} catch {
return iso;
}
}
function getFileTypeInfo(att) {
const fileName = String(att.name || "attachment").toLowerCase();
if (/\.(png|jpg|jpeg|gif|webp|bmp|svg)$/i.test(fileName)) {
return "image";
}
if (/\.(mp4|webm|mov|m4v)$/i.test(fileName)) {
return "video";
}
if (/\.(mp3|wav|ogg|m4a|flac)$/i.test(fileName)) {
return "audio";
}
return "file";
}
function renderAttachment(att) {
const url = escapeHtml(att.url || "");
const name = escapeHtml(att.name || "attachment");
const type = getFileTypeInfo(att);
if (type === "image") {
return `
<div class="attachment">
<a href="${url}" target="_blank" rel="noopener noreferrer" class="attachment-file">📎 ${name}</a>
<div class="attachment-preview attachment-image">
<img src="${url}" alt="${name}" loading="lazy">
</div>
</div>
`;
}
if (type === "video") {
return `
<div class="attachment">
<a href="${url}" target="_blank" rel="noopener noreferrer" class="attachment-file">📎 ${name}</a>
<div class="attachment-preview">
<video controls preload="metadata">
<source src="${url}">
</video>
</div>
</div>
`;
}
if (type === "audio") {
return `
<div class="attachment">
<a href="${url}" target="_blank" rel="noopener noreferrer" class="attachment-file">📎 ${name}</a>
<div class="attachment-preview">
<audio controls preload="metadata">
<source src="${url}">
</audio>
</div>
</div>
`;
}
return `
<div class="attachment">
<a href="${url}" target="_blank" rel="noopener noreferrer" class="attachment-file">📎 ${name}</a>
</div>
`;
}
function renderEmbeds(embeds = []) {
return embeds
.map((embed) => {
const fields = (embed.fields || [])
.map(
(field) => `
<div class="embed-field">
<div class="embed-field-name">${escapeHtml(field.name || "Field")}</div>
<div class="embed-field-value">${parseMarkdown(field.value || "")}</div>
</div>
`,
)
.join("");
return `
<div class="discord-embed">
${embed.title ? `<div class="discord-embed-title">${escapeHtml(embed.title)}</div>` : ""}
${embed.description ? `<div class="discord-embed-description">${parseMarkdown(embed.description)}</div>` : ""}
${fields}
</div>
`;
})
.join("");
}
function createTranscriptHTML(ticket, reason) {
return `<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Transcript - ${escapeHtml(ticket.name)}</title>
<style>
:root {
--bg: #0b0f14;
--panel: #111821;
--panel-2: #182230;
--panel-3: #1d2938;
--border: #283548;
--text: #e6edf3;
--muted: #9fb0c3;
--accent: #22c55e;
--accent-soft: rgba(34, 197, 94, 0.12);
--code: #0f1720;
}
* {
box-sizing: border-box;
}
html, body {
margin: 0;
padding: 0;
background: var(--bg);
color: var(--text);
font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
body {
padding: 32px 20px;
}
.page {
max-width: 1100px;
margin: 0 auto;
}
.header {
background: var(--panel);
border: 1px solid var(--border);
border-radius: 16px;
padding: 24px;
margin-bottom: 18px;
}
.header-top {
display: flex;
justify-content: space-between;
align-items: flex-start;
gap: 16px;
flex-wrap: wrap;
}
.title-wrap h1 {
margin: 0;
font-size: 1.8rem;
line-height: 1.2;
font-weight: 800;
letter-spacing: -0.02em;
}
.title-wrap p {
margin: 8px 0 0;
color: var(--muted);
font-size: 0.98rem;
}
.badge {
display: inline-flex;
align-items: center;
gap: 8px;
background: var(--accent-soft);
color: #8df0ad;
border: 1px solid rgba(34, 197, 94, 0.25);
padding: 8px 12px;
border-radius: 999px;
font-size: 0.9rem;
font-weight: 700;
white-space: nowrap;
}
.meta-grid {
margin-top: 18px;
display: grid;
grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
gap: 12px;
}
.meta-card {
background: var(--panel-2);
border: 1px solid var(--border);
border-radius: 12px;
padding: 14px;
}
.meta-label {
color: var(--muted);
font-size: 0.82rem;
margin-bottom: 6px;
text-transform: uppercase;
letter-spacing: 0.08em;
font-weight: 700;
}
.meta-value {
font-size: 0.98rem;
font-weight: 600;
word-break: break-word;
}
.messages-wrap {
background: var(--panel);
border: 1px solid var(--border);
border-radius: 16px;
overflow: hidden;
}
.messages-header {
padding: 18px 20px;
border-bottom: 1px solid var(--border);
background: var(--panel-2);
font-weight: 800;
font-size: 1rem;
}
.message {
display: flex;
gap: 14px;
padding: 18px 20px;
border-bottom: 1px solid var(--border);
}
.message:last-child {
border-bottom: none;
}
.avatar {
width: 42px;
height: 42px;
min-width: 42px;
border-radius: 50%;
object-fit: cover;
background: var(--panel-3);
border: 1px solid var(--border);
}
.message-body {
min-width: 0;
flex: 1;
}
.message-header {
display: flex;
align-items: baseline;
gap: 10px;
flex-wrap: wrap;
margin-bottom: 8px;
}
.username {
font-weight: 800;
color: var(--text);
font-size: 0.98rem;
}
.userid {
color: var(--muted);
font-size: 0.8rem;
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.timestamp {
color: var(--muted);
font-size: 0.82rem;
margin-left: auto;
}
.content {
color: var(--text);
font-size: 0.96rem;
line-height: 1.6;
word-break: break-word;
}
.content:empty {
display: none;
}
.discord-embed {
margin-top: 12px;
background: var(--panel-2);
border: 1px solid var(--border);
border-left: 4px solid var(--accent);
border-radius: 10px;
padding: 12px 14px;
}
.discord-embed-title {
font-weight: 800;
margin-bottom: 6px;
}
.discord-embed-description {
color: var(--text);
line-height: 1.5;
}
.embed-field {
margin-top: 10px;
padding-top: 10px;
border-top: 1px solid rgba(255,255,255,0.06);
}
.embed-field-name {
font-weight: 700;
margin-bottom: 4px;
}
.embed-field-value {
color: var(--text);
line-height: 1.5;
}
.attachment {
margin-top: 12px;
background: var(--panel-2);
border: 1px solid var(--border);
border-radius: 12px;
padding: 12px;
}
.attachment-file {
display: inline-block;
color: #8fd9a8;
text-decoration: none;
font-weight: 700;
word-break: break-word;
}
.attachment-file:hover {
text-decoration: underline;
}
.attachment-preview {
margin-top: 10px;
}
.attachment-preview img,
.attachment-preview video {
width: 100%;
max-width: 560px;
border-radius: 10px;
border: 1px solid var(--border);
display: block;
background: #0a0f15;
}
.attachment-preview audio {
width: 100%;
max-width: 560px;
display: block;
}
code {
background: var(--code);
border: 1px solid var(--border);
padding: 2px 6px;
border-radius: 6px;
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
font-size: 0.9em;
}
pre {
background: var(--code);
border: 1px solid var(--border);
padding: 12px;
border-radius: 10px;
overflow-x: auto;
white-space: pre-wrap;
word-break: break-word;
}
pre code {
background: transparent;
border: none;
padding: 0;
}
a {
color: #8fd9ff;
}
.empty-state {
padding: 24px 20px;
color: var(--muted);
}
@media (max-width: 700px) {
body {
padding: 18px 12px;
}
.header,
.messages-wrap {
border-radius: 12px;
}
.message {
padding: 14px;
}
.timestamp {
width: 100%;
margin-left: 0;
}
}
</style>
</head>
<body>
<div class="page">
<section class="header">
<div class="header-top">
<div class="title-wrap">
<h1>Ticket Transcript</h1>
<p>Exported conversation log for support ticket <strong>${escapeHtml(ticket.name)}</strong></p>
</div>
<div class="badge">Closed Transcript</div>
</div>
<div class="meta-grid">
<div class="meta-card">
<div class="meta-label">Channel</div>
<div class="meta-value">${escapeHtml(ticket.name)}</div>
</div>
<div class="meta-card">
<div class="meta-label">Ticket ID</div>
<div class="meta-value">${escapeHtml(ticket.id)}</div>
</div>
<div class="meta-card">
<div class="meta-label">Message Count</div>
<div class="meta-value">${ticket.messages.length}</div>
</div>
<div class="meta-card">
<div class="meta-label">Close Reason</div>
<div class="meta-value">${escapeHtml(reason || "No Reason Provided.")}</div>
</div>
</div>
</section>
<section class="messages-wrap">
<div class="messages-header">Messages</div>
${
ticket.messages.length
? ticket.messages
.map(
(msg) => `
<article class="message">
<img src="${escapeHtml(msg.avatar || "")}" alt="Avatar" class="avatar">
<div class="message-body">
<div class="message-header">
<span class="username">${escapeHtml(msg.username || "Unknown User")}</span>
<span class="userid">${escapeHtml(msg.userId || "Unknown ID")}</span>
<span class="timestamp">${formatDate(msg.timestamp)}</span>
</div>
<div class="content">${parseMarkdown(msg.content || "")}</div>
${renderEmbeds(msg.embeds || [])}
${(msg.attachments || []).map(renderAttachment).join("")}
</div>
</article>
`,
)
.join("")
: `<div class="empty-state">No messages were found in this ticket.</div>`
}
</section>
</div>
</body>
</html>`;
}
async function createTranscript(interaction, ticket, reason) {
const { getChannel } = interaction.client;
const transcriptChannel = await getChannel(
supportbot.Ticket.Log.TicketDataLog,
interaction.guild,
);
if (!transcriptChannel) {
throw new Error("Transcript log channel missing or inaccessible.");
}
let allMessages = [];
let lastId = null;
while (true) {
const options = { limit: 100 };
if (lastId) options.before = lastId;
const messages = await interaction.channel.messages.fetch(options);
if (messages.size === 0) break;
allMessages = [...allMessages, ...messages.values()];
lastId = messages.last().id;
if (messages.size < 100) break;
}
allMessages.sort((a, b) => a.createdTimestamp - b.createdTimestamp);
const transcriptData = allMessages.map((msg) => ({
content: msg.content || "",
username: msg.author.username,
userId: msg.author.id,
avatar: msg.author.displayAvatarURL({ extension: "png", size: 128 }),
timestamp: msg.createdAt.toISOString(),
attachments: Array.from(msg.attachments.values()).map((att) => ({
url: att.url,
name: att.name || "attachment",
contentType: att.contentType || null,
size: att.size || 0,
})),
embeds: msg.embeds.map((embed) => ({
title: embed.title || "",
description: embed.description || "",
fields: embed.fields || [],
})),
}));
if (typeof db.updateTicketStatus === "function") {
db.updateTicketStatus(interaction.channel.id, "closed");
}
const ticketUserId = ticket.user_id || ticket.user;
const tUser =
interaction.client.users.cache.get(ticketUserId) ||
(ticketUserId
? await interaction.client.users.fetch(ticketUserId).catch(() => null)
: null);
const transcriptEmbed = new Discord.EmbedBuilder()
.setTitle(msgconfig.TicketLog.Title)
.setColor(msgconfig.TicketLog.Colour)
.setFooter({
text: supportbot.Embed.Footer,
iconURL: interaction.user.displayAvatarURL(),
})
.setDescription(
`> **Ticket:** ${interaction.channel.name} (\`${interaction.channel.id}\`)\n` +
`> **User:** ${tUser?.tag || "Unknown User"} (\`${tUser?.id || ticketUserId || "Unknown"}\`)\n` +
`> **Closed by:** <@${interaction.user.id}>\n` +
`> **Message Count:** ${transcriptData.length}`,
)
.addFields({
name: "Reason",
value: `\`\`\`${reason || "No Reason Provided."}\`\`\``,
inline: false,
});
const transcriptDir = path.join(process.cwd(), "./Data/Transcripts");
if (!fs.existsSync(transcriptDir)) {
fs.mkdirSync(transcriptDir, { recursive: true });
}
const htmlFileName = `${interaction.channel.id}-transcript.html`;
const htmlPath = path.join(transcriptDir, htmlFileName);
const html = createTranscriptHTML(
{
id: interaction.channel.id,
name: interaction.channel.name,
messages: transcriptData,
},
reason,
);
fs.writeFileSync(htmlPath, html, "utf8");
await transcriptChannel.send({
embeds: [transcriptEmbed],
files: [
new Discord.AttachmentBuilder(htmlPath, {
name: `SPOILER_${htmlFileName}`,
}),
],
});
return { htmlPath };
}
module.exports = {
createTranscript,
};
-1
View File
@@ -1 +0,0 @@
theme: jekyll-theme-cayman
-75
View File
@@ -1,75 +0,0 @@
// SupportBot
// Command: Add User
const Discord = require("discord.js");
const bot = new Discord.Client()
bot.settings = require("../settings.json");
module.exports.run = async (bot, message, args) => {
message.delete()
console.log(`\x1b[36m`, `${message.author} has executed ${bot.settings.prefix}${bot.settings.Add_Command}`)
let staffGroup = message.guild.roles.find(staffRole => staffRole.name === bot.settings.support)
const rolemissing = new Discord.RichEmbed()
.setDescription(`:x: Looks like this server doesn't have the role **${bot.settings.support}**`)
.setColor(bot.settings.colour)
if (!staffGroup) return message.reply({embed: rolemissing});
const donothaverole = new Discord.RichEmbed()
.setDescription(`:x: Sorry! You cannot use this command with the role **${bot.settings.support}**`)
.setColor(bot.settings.colour)
if (!message.member.roles.has(staffGroup.id)) return message.reply({embed: donothaverole});
const outsideticket = new Discord.RichEmbed()
.setDescription(`:x: Cannot use this command becase you are outside a ticket channel.`)
.setColor(bot.settings.colour)
if (!message.channel.name.startsWith(`ticket-`)) return message.channel.send({embed: outsideticket});
let rUser = message.guild.member(message.mentions.users.first() || message.guild.members.get(args[0]));
const cantfinduser = new Discord.RichEmbed()
.setDescription(`:x: Hmm! Does that user exist? I cannot find the user.`)
.setColor(bot.settings.colour)
if(!rUser) return message.channel.send({embed: cantfinduser});
const channel = message.guild.channels.find(channel => channel.name === message.channel.name);
const cantfindchannel = new Discord.RichEmbed()
.setDescription(`:x: Hmm! Does that ticket exist? I cannot find the ticket channel.`)
.setColor(bot.settings.colour)
if(!channel) return message.channel.send({embed: cantfindchannel});
message.delete().catch(O_o=>{});
message.channel.overwritePermissions(rUser, { READ_MESSAGES: true, SEND_MESSAGES: true });
const useradded = new Discord.RichEmbed()
.setColor(bot.settings.colour)
.setDescription(`:white_check_mark: Successfully Added ${rUser} to the ticket.`)
.setTimestamp();
message.channel.send({embed: useradded});
console.log(`\x1b[36m`, `${message.author} has successfully added ${rUser} to ${message.channel}`)
const CMDLog = new Discord.RichEmbed()
.setTitle(bot.settings.Commands_Log_Title)
.addField(`User`, `<@${message.author.id}>`)
.addField(`Command`, bot.settings.Add_Command, true)
.addField(`Channel`, message.channel, true)
.addField(`Executed At`, message.createdAt, true)
.setColor(bot.settings.colour)
.setFooter(bot.settings.footer)
let CommandLog = message.guild.channels.find(LogsChannel => LogsChannel === `${bot.settings.Command_Log_Channel}`);
if(!CommandLog) return message.channel.send(`:x: Error! Could not find the logs channel. **${bot.settings.Command_Log_Channel}**\nThis can be changed via ``settings.json```);
CommandLog.send(CMDLog);
}
exports.help = {
name: bot.settings.Add_Command,
}
-63
View File
@@ -1,63 +0,0 @@
// SupportBot
// Command: Say
const Discord = require("discord.js");
const bot = new Discord.Client()
bot.settings = require("../settings.json");
exports.run = (bot, message, args) => {
message.delete();
let staffGroup = message.guild.roles.find(staffRole => staffRole.name === `${bot.settings.staff}`)
const rolemissing = new Discord.RichEmbed()
.setDescription(`:x: Looks like this server doesn't have the role **${bot.settings.staff}**`)
.setColor(bot.settings.colour)
if (!staffGroup) return message.reply(rolemissing).catch(err=>{console.error(err)})
const donothaverole = new Discord.RichEmbed()
.setDescription(`:x: Sorry! You cannot use this command with the role **${bot.settings.staff}**`)
.setColor(bot.settings.colour)
if (!message.member.roles.has(staffGroup.id)) return message.reply(donothaverole)
const embed = new Discord.RichEmbed()
.setTitle(`${bot.settings.Announcement_Title}`)
.setDescription(args.join(" "))
.setTimestamp()
.setColor(bot.settings.colour)
.setFooter(`${message.author.username}#${message.author.discriminator}`, message.author.displayAvatarURL)
let ac = message.guild.channels.find(AnnounceChannel => AnnounceChannel.name === `${bot.settings.Announcement_Channel}`)
if(!ac) return message.channel.send(`:x: Error! Could not find the logs channel **${bot.settings.Announcement_Channel}**`)
ac.send(embed)
ac.send(`${bot.settings.Annuoncement_Tag_Role}`)
const SuggestionSuccessEmbed = new Discord.RichEmbed()
.setDescription(`:white_check_mark: You have successfully created an announcement. <#${ac.id}>`)
.setColor(bot.settings.colour)
message.channel.send(SuggestionSuccessEmbed);
console.log(`\x1b[36m`, `${message.author} has executed ${bot.settings.prefix}${bot.settings.Announcement_Command}`)
const CMDLog = new Discord.RichEmbed()
.setTitle(bot.settings.Commands_Log_Title)
.addField(`User`, `<@${message.author.id}>`)
.addField(`Command`, bot.settings.Announcement_Command, true)
.addField(`Channel`, message.channel, true)
.addField(`Executed At`, message.createdAt, true)
.setColor(bot.settings.colour)
.setFooter(bot.settings.footer)
let CommandLog = message.guild.channels.find(LogsChannel => LogsChannel === `${bot.settings.Command_Log_Channel}`);
if(!CommandLog) return message.channel.send(`:x: Error! Could not find the logs channel. **${bot.settings.Command_Log_Channel}**\nThis can be changed via ``settings.json```);
CommandLog.send(CMDLog);
}
exports.help = {
name: bot.settings.Announcement_Command,
}
-58
View File
@@ -1,58 +0,0 @@
// SupportBot
// Command: Close Ticket
const Discord = require("discord.js");
const bot = new Discord.Client()
bot.settings = require("../settings.json");
exports.run = (bot, message, args) => {
message.delete();
const outsideticket = new Discord.RichEmbed()
.setDescription(`:x: Cannot use this command becase you are outside a ticket channel.`)
.setColor(bot.settings.colour)
if (!message.channel.name.startsWith(`ticket-`)) return message.channel.send({embed: outsideticket});
const close1 = new Discord.RichEmbed()
.setDescription(`Looks like you have come to the end of your support ticket\nPlease confirm that you want to close your ticket by saying ||**confirm**||`)
.setFooter("Your request will be avoided in 20 seconds")
.setColor(bot.settings.colour)
message.channel.send({embed: close1}).then(m => {
message.channel.awaitMessages(response => response.content === `confirm`, {
max: 1,
time: 10000,
errors: ['time'],
}).then((collected) => {
message.channel.delete();
}).catch(() => {
m.edit('Close ticket request, timedout').then(m2 => {
m2.delete();
}, 3000);
});
});
console.log(`\x1b[36m`, `${message.author} has executed ${bot.settings.prefix}${bot.settings.Close_Command}`)
const CMDLog = new Discord.RichEmbed()
.setTitle(bot.settings.Commands_Log_Title)
.addField(`User`, `<@${message.author.id}>`)
.addField(`Command`, bot.settings.Close_Command, true)
.addField(`Channel`, message.channel, true)
.addField(`Executed At`, message.createdAt, true)
.setColor(bot.settings.colour)
.setFooter(bot.settings.footer)
let CommandLog = message.guild.channels.find(LogsChannel => LogsChannel.name === `${bot.settings.Command_Log_Channel}`);
if(!CommandLog) return message.channel.send(`:x: Error! Could not find the logs channel. **${bot.settings.Command_Log_Channel}**\nThis can be changed via ``settings.json```);
CommandLog.send(CMDLog);
}
exports.help = {
name: bot.settings.Close_Command,
}
-50
View File
@@ -1,50 +0,0 @@
// SupportBot
// Command: Forceclose Ticket
const Discord = require("discord.js");
const bot = new Discord.Client()
bot.settings = require("../settings.json");
exports.run = (bot, message, args) => {
message.delete();
let staffGroup = message.guild.roles.find(staffRole => staffRole.name === `${bot.settings.support}`)
const rolemissing = new Discord.RichEmbed()
.setDescription(`:x: Looks like this server doesn't have the role **${bot.settings.support}**`)
.setColor(bot.settings.colour)
if (!staffGroup) return message.reply({embed: rolemissing});
const donothaverole = new Discord.RichEmbed()
.setDescription(`:x: Sorry! You cannot use this command with the role **${bot.settings.support}**`)
.setColor(bot.settings.colour)
if (!message.member.roles.has(staffGroup.id)) return message.reply({embed: donothaverole});
const outsideticket = new Discord.RichEmbed()
.setDescription(`:x: Cannot use this command becase you are outside a ticket channel.`)
.setColor(bot.settings.colour)
if (!message.channel.name.startsWith(`ticket-`)) return message.channel.send({embed: outsideticket});
message.channel.delete();
console.log(`\x1b[36m`, `${message.author} has executed ${bot.settings.prefix}${bot.settings.Forceclose_Command}`)
const CMDLog = new Discord.RichEmbed()
.setTitle(bot.settings.Commands_Log_Title)
.addField(`User`, `<@${message.author.id}>`)
.addField(`Command`, bot.settings.Forceclose_Command, true)
.addField(`Channel`, message.channel, true)
.addField(`Executed At`, message.createdAt, true)
.setColor(bot.settings.colour)
.setFooter(bot.settings.footer)
let CommandLog = message.guild.channels.find(LogsChannel => LogsChannel.name === `${bot.settings.Command_Log_Channel}`);
if(!CommandLog) return message.channel.send(`:x: Error! Could not find the logs channel. **${bot.settings.Command_Log_Channel}**\nThis can be changed via ``settings.json```);
CommandLog.send(CMDLog);
}
exports.help = {
name: bot.settings.Forceclose_Command,
}
-61
View File
@@ -1,61 +0,0 @@
// SupportBot
// Command: Help
const Discord = require("discord.js");
const bot = new Discord.Client()
bot.settings = require("../settings.json");
exports.run = (bot, message, args) => {
message.delete();
let userCommands = "";
userCommands += `**${bot.settings.prefix}${bot.settings.Link_Command}**: Get some important links!\n`;
userCommands += `**${bot.settings.prefix}${bot.settings.Ping_Command}**: Check the bots ping. Pong!\n`;
userCommands += `**${bot.settings.prefix}${bot.settings.Ticket_Command} <reason>**: Create a support ticket\n`;
userCommands += `**${bot.settings.prefix}${bot.settings.Close_Command}**: Close your support ticket\n`;
userCommands += `**${bot.settings.prefix}${bot.settings.Suggest_Command} <suggestion>**: Create a server suggestion\n`;
let supportCommands = "";
supportCommands += `**${bot.settings.prefix}${bot.settings.Add_Command} <user>**: Adds a user to a ticket\n`;
supportCommands += `**${bot.settings.prefix}${bot.settings.Remove_Command} <user>**: Removes a user from a ticket\n`;
supportCommands += `**${bot.settings.prefix}${bot.settings.Forceclose_Command}**: Forceclose a support ticket\n`;
supportCommands += `**${bot.settings.prefix}${bot.settings.Rename_Command}**: Rename a support ticket\n`;
let staffCommands = "";
staffCommands += `**${bot.settings.prefix}${bot.settings.Announcement_Command} <message>**: Create a bot announcement\n`;
staffCommands += `**${bot.settings.prefix}${bot.settings.Say_Command} <message>**: Send a message as the bot\n`;
staffCommands += `**${bot.settings.prefix}${bot.settings.Lockchat_Command}**: Lock the chat channel\n`;
staffCommands += `**${bot.settings.prefix}${bot.settings.UnLockchat_Command}**: UnLock the chat channel\n`;
const embed = new Discord.RichEmbed()
.setTitle(bot.settings.botname)
.addField(":ticket: Support Commands", userCommands)
.addField(":pushpin: Support Commands", supportCommands, true)
.addField(":pushpin: Staff Commands", staffCommands, true)
.setColor(bot.settings.colour)
.setFooter(bot.settings.footer, message.author.displayAvatarURL);
message.channel.send(embed)
console.log(`\x1b[36m`, `${message.author} has executed ${bot.settings.prefix}${bot.settings.Help_Command}`)
const CMDLog = new Discord.RichEmbed()
.setTitle(bot.settings.Commands_Log_Title)
.addField(`User`, `<@${message.author.id}>`)
.addField(`Command`, bot.settings.Help_Command, true)
.addField(`Channel`, message.channel, true)
.addField(`Executed At`, message.createdAt, true)
.setColor(bot.settings.colour)
.setFooter(bot.settings.footer)
let CommandLog = message.guild.channels.find(LogsChannel => LogsChannel.name === `${bot.settings.Command_Log_Channel}`);
if(!CommandLog) return message.channel.send(`:x: Error! Could not find the logs channel. **${bot.settings.Command_Log_Channel}**\nThis can be changed via settings.json`);
CommandLog.send(CMDLog);
}
exports.help = {
name: bot.settings.Help_Command,
}
-48
View File
@@ -1,48 +0,0 @@
// SupportBot
// Command: Help
const Discord = require( "discord.js" );
const bot = new Discord.Client()
bot.settings = require( "../settings.json" );
exports.run = ( bot, message, args ) => {
message.delete();
let botLinks = bot.settings.LINKS;
let links = '';
for ( let name in botLinks ) {
links += `[${name}](${botLinks[ name ]})\n`;
}
let embed = new Discord.RichEmbed()
.setTitle( bot.settings.LINKS_TITLE )
.setDescription( links )
.setColor( bot.settings.colour )
.setFooter( bot.settings.footer )
message.channel.send( embed );
console.log( `\x1b[36m`, `${message.author} has executed ${bot.settings.prefix}${bot.settings.Link_Command}` )
const CMDLog = new Discord.RichEmbed()
.setTitle(bot.settings.Commands_Log_Title)
.addField(`User`, `<@${message.author.id}>`)
.addField(`Command`, bot.settings.Link_Command, true)
.addField(`Channel`, message.channel, true)
.addField(`Executed At`, message.createdAt, true)
.setColor(bot.settings.colour)
.setFooter(bot.settings.footer)
let CommandLog = message.guild.channels.find(LogsChannel => LogsChannel.name === `${bot.settings.Command_Log_Channel}`);
if(!CommandLog) return message.channel.send(`:x: Error! Could not find the logs channel. **${bot.settings.Command_Log_Channel}**\nThis can be changed via ``settings.json```);
CommandLog.send(CMDLog);
}
exports.help = {
name: bot.settings.Link_Command,
}
-52
View File
@@ -1,52 +0,0 @@
// SupportBot
// Command: Lockchat
const Discord = require("discord.js");
const bot = new Discord.Client()
bot.settings = require("../settings.json");
exports.run = async(bot, message, args) => {
message.delete();
let staffGroup = message.guild.roles.find(staffRole => staffRole.name === `${bot.settings.staff}`)
let everyoneRole = message.guild.roles.find(everyone => everyone.name === `${bot.settings.everyone}`)
const rolemissing = new Discord.RichEmbed()
.setDescription(`:x: Looks like this server doesn't have the role **${bot.settings.staff}**`)
.setColor(bot.settings.colour)
if (!staffGroup) return message.reply(rolemissing).catch(err=>{console.error(err)})
const donothaverole = new Discord.RichEmbed()
.setDescription(`:x: Sorry! You cannot use this command with the role **${bot.settings.staff}**`)
.setColor(bot.settings.colour)
if (!message.member.roles.has(staffGroup.id)) return message.reply(donothaverole)
message.channel.overwritePermissions(everyoneRole, { READ_MESSAGES: false, SEND_MESSAGES: false });
const lockmsg = new Discord.RichEmbed()
.setDescription(":white_check_mark: **Chat Locked**")
.setColor(bot.settings.colour)
message.channel.send(lockmsg)
console.log(`\x1b[36m`, `${message.author} has executed ${bot.settings.prefix}${bot.settings.Lockchat_Command}`)
const CMDLog = new Discord.RichEmbed()
.setTitle(bot.settings.Commands_Log_Title)
.addField(`User`, `<@${message.author.id}>`)
.addField(`Command`, bot.settings.Lockchat_Command, true)
.addField(`Channel`, message.channel, true)
.addField(`Executed At`, message.createdAt, true)
.setColor(bot.settings.colour)
.setFooter(bot.settings.footer)
let CommandLog = message.guild.channels.find(LogsChannel => LogsChannel.name === `${bot.settings.Command_Log_Channel}`);
if(!CommandLog) return message.channel.send(`:x: Error! Could not find the logs channel. **${bot.settings.Command_Log_Channel}**\nThis can be changed via ``settings.json```);
CommandLog.send(CMDLog);
}
exports.help = {
name: bot.settings.Lockchat_Command,
}
-37
View File
@@ -1,37 +0,0 @@
// SupportBot
// Command: Ping
const Discord = require("discord.js");
const bot = new Discord.Client()
bot.settings = require("../settings.json");
exports.run = (bot, message, args) => {
message.delete();
const embed = new Discord.RichEmbed()
.setDescription(`:ping_pong: **Pong!** \`${bot.ping}ms\` `)
.setColor(bot.settings.colour)
message.channel.send(embed).catch(console.error);
console.log(`\x1b[36m`, `${message.author} has executed ${bot.settings.prefix}${bot.settings.Ping_Command}`)
const CMDLog = new Discord.RichEmbed()
.setTitle(bot.settings.Commands_Log_Title)
.addField(`User`, `<@${message.author.id}>`)
.addField(`Command`, bot.settings.Ping_Command, true)
.addField(`Channel`, message.channel, true)
.addField(`Executed At`, message.createdAt, true)
.setColor(bot.settings.colour)
.setFooter(bot.settings.footer)
let CommandLog = message.guild.channels.find(LogsChannel => LogsChannel.name === `${bot.settings.Command_Log_Channel}`);
if(!CommandLog) return message.channel.send(`:x: Error! Could not find the logs channel. **${bot.settings.Command_Log_Channel}**\nThis can be changed via ``settings.json```);
CommandLog.send(CMDLog);
}
exports.help = {
name: bot.settings.Ping_Command,
}
-60
View File
@@ -1,60 +0,0 @@
// SupportBot
// Command: Poll
const Discord = require("discord.js");
const bot = new Discord.Client()
bot.settings = require("../settings.json");
exports.run = (bot, message, args) => {
message.delete();
let staffGroup = message.guild.roles.find(staffRole => staffRole.name === `${bot.settings.staff}`)
const rolemissing = new Discord.RichEmbed()
.setDescription(`:x: Looks like this server doesn't have the role **${bot.settings.staff}**`)
.setColor(bot.settings.colour)
if (!staffGroup) return message.reply(rolemissing).catch(err=>{console.error(err)})
const donothaverole = new Discord.RichEmbed()
.setDescription(`:x: Sorry! You cannot use this command with the role **${bot.settings.staff}**`)
.setColor(bot.settings.colour)
if (!message.member.roles.has(staffGroup.id)) return message.reply(donothaverole)
const embed = new Discord.RichEmbed()
.setTitle(`${bot.settings.Poll_Title}`)
.setDescription(args.join(" "))
.setTimestamp()
.setColor(bot.settings.colour)
.setFooter(bot.settings.footer, message.author.displayAvatarURL)
let ac = message.guild.channels.find(AnnounceChannel => AnnounceChannel.name === `${bot.settings.Poll_Channel}`)
if(!ac) return message.channel.send(`:x: Error! Could not find the logs channel **${bot.settings.Poll_Channel}**`)
ac.send(embed)
.then(async function(msg) {
msg.react(bot.settings.Reaction_Poll_1).then(() => msg.react(bot.settings.Reaction_Poll_2));
});
console.log(`\x1b[36m`, `${message.author} has executed ${bot.settings.prefix}${bot.settings.Poll_Command}`)
const CMDLog = new Discord.RichEmbed()
.setTitle(bot.settings.Commands_Log_Title)
.addField(`User`, `<@${message.author.id}>`)
.addField(`Command`, bot.settings.Close_Command, true)
.addField(`Channel`, message.channel, true)
.addField(`Executed At`, message.createdAt, true)
.setColor(bot.settings.colour)
.setFooter(bot.settings.footer)
let CommandLog = message.guild.channels.find(LogsChannel => LogsChannel.name === `${bot.settings.Command_Log_Channel}`);
if(!CommandLog) return message.channel.send(`:x: Error! Could not find the logs channel. **${bot.settings.Command_Log_Channel}**\nThis can be changed via ``settings.json```);
CommandLog.send(CMDLog);
}
exports.help = {
name: bot.settings.Poll_Command,
}
-74
View File
@@ -1,74 +0,0 @@
// SupportBot
// Command: Remove User
const Discord = require("discord.js");
const bot = new Discord.Client()
bot.settings = require("../settings.json");
module.exports.run = async (bot, message, args) => {
message.delete()
console.log(`\x1b[36m`, `${message.author} has executed ${bot.settings.prefix}${bot.settings.Add_Command}`)
let staffGroup = message.guild.roles.find(staffRole => staffRole.name === bot.settings.support)
const rolemissing = new Discord.RichEmbed()
.setDescription(`:x: Looks like this server doesn't have the role **${bot.settings.support}**`)
.setColor(bot.settings.colour)
if (!staffGroup) return message.reply({embed: rolemissing});
const donothaverole = new Discord.RichEmbed()
.setDescription(`:x: Sorry! You cannot use this command with the role **${bot.settings.support}**`)
.setColor(bot.settings.colour)
if (!message.member.roles.has(staffGroup.id)) return message.reply({embed: donothaverole});
const outsideticket = new Discord.RichEmbed()
.setDescription(`:x: Cannot use this command becase you are outside a ticket channel.`)
.setColor(bot.settings.colour)
if (!message.channel.name.startsWith(`ticket-`)) return message.channel.send({embed: outsideticket});
let rUser = message.guild.member(message.mentions.users.first() || message.guild.members.get(args[0]));
const cantfinduser = new Discord.RichEmbed()
.setDescription(`:x: Hmm! Does that user exist? I cannot find the user.`)
.setColor(bot.settings.colour)
if(!rUser) return message.channel.send({embed: cantfinduser});
const channel = message.guild.channels.find(channel => channel.name === message.channel.name);
const cantfindchannel = new Discord.RichEmbed()
.setDescription(`:x: Hmm! Does that ticket exist? I cannot find the ticket channel.`)
.setColor(bot.settings.colour)
if(!channel) return message.channel.send({embed: cantfindchannel});
message.delete().catch(O_o=>{});
message.channel.overwritePermissions(rUser, { READ_MESSAGES: false, SEND_MESSAGES: false });
const useradded = new Discord.RichEmbed()
.setColor(bot.settings.colour)
.setDescription(`:white_check_mark: Successfully remove ${rUser} from the ticket.`)
.setTimestamp();
message.channel.send({embed: useradded});
console.log(`\x1b[36m`, `${message.author} has successfully removed ${rUser} from ${message.channel}`)
const CMDLog = new Discord.RichEmbed()
.setTitle(bot.settings.Commands_Log_Title)
.addField(`User`, `<@${message.author.id}>`)
.addField(`Command`, bot.settings.Remove_Command, true)
.addField(`Channel`, message.channel, true)
.addField(`Executed At`, message.createdAt, true)
.setColor(bot.settings.colour)
.setFooter(bot.settings.footer)
let CommandLog = message.guild.channels.find(LogsChannel => LogsChannel.name === `${bot.settings.Command_Log_Channel}`);
if(!CommandLog) return message.channel.send(`:x: Error! Could not find the logs channel. **${bot.settings.Command_Log_Channel}**\nThis can be changed via ``settings.json```);
CommandLog.send(CMDLog);
}
exports.help = {
name: bot.settings.Remove_Command,
}
-63
View File
@@ -1,63 +0,0 @@
// SupportBot
// Command: Close Ticket
const Discord = require("discord.js");
const bot = new Discord.Client()
bot.settings = require("../settings.json");
exports.run = (bot, message, args) => {
message.delete();
let staffGroup = message.guild.roles.find(staffRole => staffRole.name === bot.settings.support)
const rolemissing = new Discord.RichEmbed()
.setDescription(`:x: Looks like this server doesn't have the role **${bot.settings.support}**`)
.setColor(bot.settings.colour)
if (!staffGroup) return message.reply({embed: rolemissing});
const donothaverole = new Discord.RichEmbed()
.setDescription(`:x: Sorry! You cannot use this command with the role **${bot.settings.support}**`)
.setColor(bot.settings.colour)
if (!message.member.roles.has(staffGroup.id)) return message.reply({embed: donothaverole});
const outsideticket = new Discord.RichEmbed()
.setDescription(`:x: Cannot use this command becase you are outside a ticket channel.`)
.setColor(bot.settings.colour)
if (!message.channel.name.startsWith(`ticket-`)) return message.channel.send({embed: outsideticket});
const renameto = args.join(" ")
message.channel.setName(`ticket-${renameto}-${message.author.username}`)
// Renamed Ticket Logistic
const logEmbed = new Discord.RichEmbed()
.setTitle(":ticket: Ticket Renamed")
.setDescription(`<@${message.author.id}> has renamed a ticket to ${renameto}`)
.setColor(bot.settings.colour)
.setFooter(bot.settings.footer)
let logChannel = message.guild.channels.find(TicketChannel => TicketChannel.name === `${bot.settings.Ticket_Logs}`);
if(!logChannel) return message.channel.send(`:x: Error! Could not find the logs channel **${bot.settings.Ticket_Logs}**`);
logChannel.send({embed: logEmbed})
console.log(`\x1b[36m`, `${message.author} has executed ${bot.settings.prefix}${bot.settings.Rename_Command}`)
const CMDLog = new Discord.RichEmbed()
.setTitle(bot.settings.Commands_Log_Title)
.addField(`User`, `<@${message.author.id}>`)
.addField(`Command`, bot.settings.Rename_Command, true)
.addField(`Channel`, message.channel, true)
.addField(`Executed At`, message.createdAt, true)
.setColor(bot.settings.colour)
.setFooter(bot.settings.footer)
let CommandLog = message.guild.channels.find(LogsChannel => LogsChannel.name === `${bot.settings.Command_Log_Channel}`);
if(!CommandLog) return message.channel.send(`:x: Error! Could not find the logs channel. **${bot.settings.Command_Log_Channel}**\nThis can be changed via ``settings.json```);
CommandLog.send(CMDLog);
}
exports.help = {
name: bot.settings.Rename_Command,
}
-75
View File
@@ -1,75 +0,0 @@
// SupportBot
// Command: Report
const Discord = require("discord.js");
const bot = new Discord.Client()
bot.settings = require("../settings.json");
exports.run = (bot, message, args) => {
message.delete();
let staffGroup = message.guild.roles.find(staffRole => staffRole.name === `${bot.settings.staff}`);
const rolemissing = new Discord.RichEmbed()
.setDescription(`:x: Looks like this server doesn't have the role **${bot.settings.staff}**`)
.setColor(bot.settings.colour);
if(!staffGroup) {
message.reply(rolemissing).catch(err => {
console.error(err);
});
} else {
const donothaverole = new Discord.RichEmbed()
.setDescription(`:x: Sorry! You cannot use this command with the role **${bot.settings.staff}**`)
.setColor(bot.settings.colour)
if(!message.member.roles.has(staffGroup.id)) {
message.reply(donothaverole);
} else {
if(!args[0]) {
message.reply(":x: Sorry! Please specify the user to report.");
} else {
if(!args[1]) {
message.reply(":x: Sorry! Specify the reason of your report.");
} else {
let reportDesc = args.slice(1).join(" ");
const embed = new Discord.RichEmbed()
.setTitle(`${bot.settings.Report_Title}`)
.setThumbnail(message.author.avatarURL)
.addField("Report by:", `<@${message.author.id}>`, false)
.addField("Description:", `${reportDesc}`, false)
.addField("Reported User:", `${args[0]}`, false)
.setTimestamp(new Date())
.setColor(bot.settings.colour)
.setFooter(`${message.author.username}#${message.author.discriminator}`, message.author.displayAvatarURL);
let rc = message.guild.channels.find(ReportChannel => ReportChannel.name === `${bot.settings.Report_Channel}`)
if(!rc) {
message.channel.send(`:x: Error! Could not find the logs channel **${bot.settings.Report_Channel}**`);
} else {
rc.send(embed);
console.log(`\x1b[36m`, `${message.author} has executed ${bot.settings.prefix}${bot.settings.Report_Command}`);
const CMDLog = new Discord.RichEmbed()
.setTitle(bot.settings.Commands_Log_Title)
.addField(`User`, `<@${message.author.id}>`)
.addField(`Command`, bot.settings.Report_Command, true)
.addField(`Channel`, message.channel, true)
.addField(`Executed At`, message.createdAt, true)
.setColor(bot.settings.colour)
.setFooter(bot.settings.footer)
let CommandLog = message.guild.channels.find(LogsChannel => LogsChannel.name === `${bot.settings.Command_Log_Channel}`);
if(!CommandLog) return message.channel.send(`:x: Error! Could not find the logs channel. **${bot.settings.Command_Log_Channel}**\nThis can be changed via ``settings.json```);
CommandLog.send(CMDLog);
}
}
}
}
}
}
exports.help = {
name: bot.settings.Report_Command
}
-52
View File
@@ -1,52 +0,0 @@
// SupportBot
// Command: Say
const Discord = require("discord.js");
const bot = new Discord.Client()
bot.settings = require("../settings.json");
exports.run = (bot, message, args) => {
message.delete();
let staffGroup = message.guild.roles.find(staffRole => staffRole.name === `${bot.settings.staff}`)
const rolemissing = new Discord.RichEmbed()
.setDescription(`:x: Looks like this server doesn't have the role **${bot.settings.staff}**`)
.setColor(bot.settings.colour)
if (!staffGroup) return message.reply(rolemissing).catch(err=>{console.error(err)})
const donothaverole = new Discord.RichEmbed()
.setDescription(`:x: Sorry! You cannot use this command with the role **${bot.settings.staff}**`)
.setColor(bot.settings.colour)
if (!message.member.roles.has(staffGroup.id)) return message.reply(donothaverole)
const embed = new Discord.RichEmbed()
.setTitle(`${bot.settings.Announcement_Title}`)
.setDescription(args.join(" "))
.setTimestamp()
.setColor(bot.settings.colour)
.setFooter(`${message.author.username}#${message.author.discriminator}`, message.author.displayAvatarURL)
message.channel.send(embed);
console.log(`\x1b[36m`, `${message.author} has executed ${bot.settings.prefix}${bot.settings.Say_Command}`)
const CMDLog = new Discord.RichEmbed()
.setTitle(bot.settings.Commands_Log_Title)
.addField(`User`, `<@${message.author.id}>`)
.addField(`Command`, bot.settings.Say_Command, true)
.addField(`Executed At`, message.createdAt, true)
.setColor(bot.settings.colour)
.setFooter(bot.settings.footer)
let CommandLog = message.guild.channels.find(LogsChannel => LogsChannel.name === `${bot.settings.Command_Log_Channel}`);
if(!CommandLog) return message.channel.send(`:x: Error! Could not find the logs channel. **${bot.settings.Command_Log_Channel}**\nThis can be changed via ``settings.json```);
CommandLog.send(CMDLog);
}
exports.help = {
name: bot.settings.Say_Command,
}
-53
View File
@@ -1,53 +0,0 @@
// SupportBot
// Command: Suggest
const Discord = require("discord.js");
const bot = new Discord.Client()
bot.settings = require("../settings.json");
exports.run = async(bot, message, args) => {
message.delete();
const SuggestionEmbed = new Discord.RichEmbed()
.setTitle(`${bot.settings.Suggestion_Title}`)
.setDescription(`\`\`\`${args.join(" ")}\`\`\`\nFrom <@${message.author.id}>`)
.setFooter(`${bot.settings.footer}`, message.author.avatarURL)
.setTimestamp(new Date())
.setColor(bot.settings.colour);
let sc = message.guild.channels.find(SuggestionChannel => SuggestionChannel.name === `${bot.settings.Suggestion_Channel}`);
if(!sc) return message.channel.send(`:x: Error! Could not find the suggestion channel **${bot.settings.Suggestion_Channel}**`);
sc.send(SuggestionEmbed)
.then(async function(msg) {
msg.react(bot.settings.suggestyes).then(() => msg.react(bot.settings.suggestno));
});
const SuggestionSuccessEmbed = new Discord.RichEmbed()
.setDescription(`:white_check_mark: You have successfully created your suggestion. <#${sc.id}>`)
.setColor(bot.settings.colour)
message.channel.send(SuggestionSuccessEmbed);
console.log(`\x1b[36m`, `${message.author} has executed ${bot.settings.prefix}${bot.settings.Suggest_Command}`)
const CMDLog = new Discord.RichEmbed()
.setTitle(bot.settings.Commands_Log_Title)
.addField(`User`, `<@${message.author.id}>`)
.addField(`Command`, bot.settings.Suggest_Command, true)
.addField(`Channel`, message.channel, true)
.addField(`Executed At`, message.createdAt, true)
.setColor(bot.settings.colour)
.setFooter(bot.settings.footer)
let CommandLog = message.guild.channels.find(LogsChannel => LogsChannel.name === `${bot.settings.Command_Log_Channel}`);
if(!CommandLog) return message.channel.send(`:x: Error! Could not find the logs channel. **${bot.settings.Command_Log_Channel}**`);
CommandLog.send(CMDLog);
}
exports.help = {
name: bot.settings.Suggest_Command,
}
-134
View File
@@ -1,134 +0,0 @@
// SupportBot
// Command: Ticket
const Discord = require("discord.js");
const bot = new Discord.Client()
bot.settings = require("../settings.json");
exports.run = (bot, message, args) => {
message.delete();
const ID = Math.floor(Math.random() * 10) + 2000;
const subject = args.join(" ") || `${bot.settings.Default_Ticket_Reason}`;
// Ticket Reactions
const reactembed = new Discord.RichEmbed()
.setColor(bot.settings.colour)
.setDescription(`${bot.settings.Ticket_React_Message}`);
message.channel.send(reactembed)
.then(function(msg) {
msg.react('✅').then(() => msg.react('❎'));
const filter = (reaction, user) => {
return ['✅', '❎'].includes(reaction.emoji.name) && user.id !== msg.author.id;
};
msg.awaitReactions(filter, { max: 1, time: 60000, errors: ['time'] })
.then(collected => {
const reaction = collected.first();
if (reaction.emoji.name === '❎') {
const successEmbed = new Discord.RichEmbed()
.setDescription(`:tickets: <@${message.author.id}> You have canceled your support request.`)
.setColor(bot.settings.colour);
message.channel.send(successEmbed);
}
if (reaction.emoji.name === '✅') {
const alreadyopen = new Discord.RichEmbed()
.setDescription(`:x: Cannot create a ticket because **ticket-${message.author.username}** already exists.`)
.setColor(bot.settings.colour)
if (message.guild.channels.find(TicketChannel => TicketChannel.name === 'ticket-' + message.author.username)) return message.channel.send(alreadyopen);
message.guild.createChannel(`ticket-${message.author.username}`, {
type: 'text',
}).then(TicketChannel => {
// Roles
let staff = message.guild.roles.find(staffRole => staffRole.name === `${bot.settings.support}`)
let everyone = message.guild.roles.find(everyoneRole => everyoneRole.name === `@everyone`)
// Permissions
TicketChannel.overwritePermissions(everyone, { SEND_MESSAGES: false, READ_MESSAGES: false })
TicketChannel.overwritePermissions(staff, { SEND_MESSAGES: true, READ_MESSAGES: true })
TicketChannel.overwritePermissions(message.author, { SEND_MESSAGES: true, READ_MESSAGES: true })
TicketChannel.overwritePermissions(bot.user, { SEND_MESSAGES: true, READ_MESSAGES: true })
// Category
let category = message.guild.channels.find(c => c.name === bot.settings.category);
if (category) {
TicketChannel.setParent(category.id);
} else {
if (message.guild.channels.get(bot.settings.category)) {
TicketChannel.setParent(message.guild.channels.get(bot.settings.category).id);
}
}
const ticketopened = new Discord.RichEmbed()
.setDescription(`:white_check_mark: <@${message.author.id}> You ticket has been created <#${TicketChannel.id}>`)
.setColor(bot.settings.colour)
message.channel.send({embed: ticketopened});
// Ticket Message - ( Able to edit this message via the settings.json file )
const ticketMessage = `Hi! <@${message.author.id}>\n${bot.settings.Ticket_Message}`;
const TicketMessage = new Discord.RichEmbed()
.setDescription(ticketMessage)
.setColor(bot.settings.colour)
.setFooter(bot.settings.footer)
TicketChannel.send({embed: TicketMessage});
if (subject != 'No Subject.') {
TicketChannel.setTopic(subject);
}
// Ticket Logging
const logEmbed = new Discord.RichEmbed()
.setTitle(":ticket: Logistics of your Ticket")
.addField("Ticket ID", ID, true)
.addField("User", `<@${message.author.id}>`, true)
.addField("Channel", `ticket#${ID}`, true)
.setColor(bot.settings.colour)
.setFooter(bot.settings.footer)
if (subject != 'No Subject.') {
logEmbed.addField('Subject', subject, true);
}
let logChannel = message.guild.channels.find(TicketChannel => TicketChannel.name === `${bot.settings.Ticket_Logs}`);
if(!logChannel) return message.channel.send(`:x: Error! Could not find the logs channel **${bot.settings.Ticket_Logs}**`);
logChannel.send({embed: logEmbed})
}).catch(err=>{console.error(err)});
console.log(`\x1b[36m`, `${message.author} has executed ${bot.settings.prefix}${bot.settings.Ticket_Command}`)
const CMDLog = new Discord.RichEmbed()
.setTitle(bot.settings.Commands_Log_Title)
.addField(`User`, `<@${message.author.id}>`)
.addField(`Command`, bot.settings.Ticket_Command, true)
.addField(`Channel`, message.channel, true)
.addField(`Executed At`, message.createdAt, true)
.setColor(bot.settings.colour)
.setFooter(bot.settings.footer)
let CommandLog = message.guild.channels.find(LogsChannel => LogsChannel.name === `${bot.settings.Command_Log_Channel}`);
if(!CommandLog) return message.channel.send(`:x: Error! Could not find the logs channel. **${bot.settings.Command_Log_Channel}**\nThis can be changed via ``settings.json```);
CommandLog.send(CMDLog);
}
})
})
};
exports.help = {
name: bot.settings.Ticket_Command,
}
-52
View File
@@ -1,52 +0,0 @@
// SupportBot
// Command: Lockchat
const Discord = require("discord.js");
const bot = new Discord.Client()
bot.settings = require("../settings.json");
exports.run = async(bot, message, args) => {
message.delete();
let staffGroup = message.guild.roles.find(staffRole => staffRole.name === `${bot.settings.staff}`)
let everyoneRole = message.guild.roles.find(everyone => everyone.name === `${bot.settings.everyone}`)
const rolemissing = new Discord.RichEmbed()
.setDescription(`:x: Looks like this server doesn't have the role **${bot.settings.staff}**`)
.setColor(bot.settings.colour)
if (!staffGroup) return message.reply(rolemissing).catch(err=>{console.error(err)})
const donothaverole = new Discord.RichEmbed()
.setDescription(`:x: Sorry! You cannot use this command with the role **${bot.settings.staff}**`)
.setColor(bot.settings.colour)
if (!message.member.roles.has(staffGroup.id)) return message.reply(donothaverole)
message.channel.overwritePermissions(everyoneRole, { READ_MESSAGES: true, SEND_MESSAGES: true });
const lockmsg = new Discord.RichEmbed()
.setDescription(":white_check_mark: **Chat Un-Locked**")
.setColor(bot.settings.colour)
message.channel.send(lockmsg)
console.log(`\x1b[36m`, `${message.author} has executed ${bot.settings.prefix}${bot.settings.UnLockchat_Command}`)
const CMDLog = new Discord.RichEmbed()
.setTitle(bot.settings.Commands_Log_Title)
.addField(`User`, `<@${message.author.id}>`)
.addField(`Command`, bot.settings.UnLockchat_Command, true)
.addField(`Executed At`, message.createdAt, true)
.setColor(bot.settings.colour)
.setFooter(bot.settings.footer)
let CommandLog = message.guild.channels.find(LogsChannel => LogsChannel.name === `${bot.settings.Command_Log_Channel}`);
if(!CommandLog) return message.channel.send(`:x: Error! Could not find the logs channel. **${bot.settings.Command_Log_Channel}**\nThis can be changed via ``settings.json```);
CommandLog.send(CMDLog);
}
exports.help = {
name: bot.settings.UnLockchat_Command,
}
+60 -101
View File
@@ -1,120 +1,79 @@
// ____ _ ____ _
// / ___| _ _ _ __ _ __ ___ _ __| |_| __ ) ___ | |_
// \___ \| | | | '_ \| '_ \ / _ \| '__| __| _ \ / _ \| __|
// ___) | |_| | |_) | |_) | (_) | | | |_| |_) | (_) | |_
// |____/ \__,_| .__/| .__/ \___/|_| \__|____/ \___/ \__|
// |_| |_|
// ___ _ ___ _
// / __> _ _ ___ ___ ___ _ _ _| |_ | . > ___ _| |_
// \__ \| | || . \| . \/ . \| '_> | | | . \/ . \ | |
// <___/`___|| _/| _/\___/|_| |_| |___/\___/ |_|
// |_| |_|
//
// SupportBot created by Emerald Services
// Installed with MIT License
//
// Discord Support: https://emeraldsrv.dev/discord
// Community Resources: https://community.emeraldsrv.dev
// Resource: SupportBot
// Developed by Emerald Services
// Version: 4.0.0
const Discord = require("discord.js");
const fs = require("fs");
const bot = new Discord.Client();
const path = require("path");
bot.commands = new Discord.Collection();
bot.settings = require("./settings.json");
fs.readdir("./commands/", (err, files) => {
if(err) console.log(err);
let jsfile = files.filter(f => f.split(".").pop() === "js")
if(jsfile.length <= 0) return console.log(`${bot.settings.botname} No commands found. Try to Re-download the resource`);
jsfile.forEach((f, i) =>{
let props = require(`./commands/${f}`);
console.log(`[${bot.settings.botname}] > Command Loaded > ${f}`);
bot.commands.set(props.help.name, props);
});
});
bot.addons = new Discord.Collection();
fs.readdir("./sb-addons/", (err, files) => {
if(err) console.log(err);
let jsfile = files.filter(f => f.split(".").pop() === "js")
if(jsfile.length <= 0) return console.log(`${bot.settings.botname} No addons detected nor default! Either download addons from https://itzemerald.tk/`);
jsfile.forEach((f, i) =>{
let props = require(`./sb-addons/${f}`);
console.log(`[${bot.settings.botname}] > Addons Loaded > ${f}`);
bot.addons.set(props.help.name, props);
});
});
bot.on("ready", async () => {
bot.user.setActivity(bot.settings.BotStatus, {type:"PLAYING"});
console.log(`\x1b[36m`, `=== [SupportBot] ===\n\nSupportBot - Created by Emerald Services\nInvite ${bot.user.username} to your server\nhttps://discordapp.com/api/oauth2/authorize?client_id=${bot.user.id}&permissions=8&scope=bot\n\n=== [SupportBot] ===`)
console.log(`\u001b[31m`, `------------[ SupportBot ]------------`)
console.log(`\u001b[32m`, `Thank you for using SupportBot\n If you have any issues\n contact our team and we will\n give you furthur instructions`)
console.log(`\u001b[31m`, `------------[ SupportBot ]------------`)
console.log(`\u001b[31m`, `\n\n------------[ SupportBot Stats ]------------`)
console.log(`\u001b[32m`, `Bot Username: ${bot.user.username}\nInvite Link: https://discordapp.com/api/oauth2/authorize?client_id=${bot.user.username}&permissions=8&scope=bot`)
console.log(`\u001b[31m`, `------------[ SupportBot Stats ]------------`)
const yaml = require("js-yaml");
const supportbot = yaml.load(
fs.readFileSync("./Configs/supportbot.yml", "utf8")
);
const Client = require("./Structures/Client.js");
const client = new Client({
intents: ['Guilds', 'GuildMembers', 'GuildMessages', 'MessageContent']
});
bot.on("message", async message => {
if(message.author.bot) return;
if(message.channel.type === "dm") return;
if (message.content.indexOf(bot.settings.prefix) !== 0) return;
const APIServer = require("./API/server.js");
let messageArray = message.content.split(" ");
const args = message.content.slice(bot.settings.prefix.length).trim().split(/ +/g);
const command = args.shift().toLowerCase();
client.start(supportbot.General.Token);
const cmd = bot.commands.get(command);
if(!cmd) return;
cmd.run(bot, message, args);
client.once('clientReady', () => {
const api = new APIServer(client);
api.start();
});
bot.on("message", async message => {
if(message.author.bot) return;
if(message.channel.type === "dm") return;
if (message.content.indexOf(bot.settings.prefix) !== 0) return;
// SupportBot - New Logging System
let messageArray = message.content.split(" ");
const args = message.content.slice(bot.settings.prefix.length).trim().split(/ +/g);
const addon = args.shift().toLowerCase();
const logTypes = ["Output", "Warn", "Error"];
const cmd = bot.addons.get(addon);
if(!cmd) return;
cmd.run(bot, message, args);
if (!fs.existsSync("./Logs")) {
fs.mkdirSync("./Logs");
}
logTypes.forEach((type) => {
const dir = `./Logs/${type}`;
if (!fs.existsSync(dir)) {
fs.mkdirSync(dir);
}
});
// [SupportBot] Welcome Message && Auto Join Role
function logToFile(type, data) {
const date = new Date().toISOString().split("T")[0];
const file = path.join(`./Logs/${type}`, `${type}-${date}.log`);
fs.appendFileSync(file, `[${new Date().toISOString()}] ${data}\n`);
}
bot.on("guildMemberAdd", (member) => {
let channel = member.guild.channels.find(channel => channel.name === `${bot.settings.Welcome_Channel}`)
let autorole = member.guild.roles.find(autorole => autorole.name === `${bot.settings.Auto_Role}`)
const WelcomeMsg= new Discord.RichEmbed()
.setColor(bot.settings.colour)
.setThumbnail(member.user.avatarURL)
.setDescription(`:wave: ${member.user.username}\n${bot.settings.Welcome_Message}`)
const origLog = console.log;
console.log = (...args) => {
origLog(...args);
logToFile("Output", args.join(" "));
};
channel.send(WelcomeMsg);
member.addRole(autorole).catch(console.error);
const origWarn = console.warn;
console.warn = (...args) => {
origWarn(...args);
logToFile("Warn", args.join(" "));
};
const origError = console.error;
console.error = (...args) => {
origError(...args);
logToFile("Error", args.join(" "));
};
process.on("unhandledRejection", (reason) => {
console.error("Unhandled Rejection:", reason);
});
// [SupportBot] Leave Message
bot.on("guildMemberRemove", (member) => {
let channel = member.guild.channels.find(channel => channel.name === `${bot.settings.Leave_Channel}`)
const LeaveMsg= new Discord.RichEmbed()
.setColor(bot.settings.colour)
.setThumbnail(member.user.avatarURL)
.setDescription(`:wave: ${member.user.username}\n${bot.settings.Leave_Message}`)
channel.send(LeaveMsg);
process.on("uncaughtException", (err) => {
console.error("Uncaught Exception:", err);
});
bot.login(bot.settings.token);
+26 -25
View File
@@ -1,37 +1,38 @@
{
"name": "SupportBot",
"version": "4.0",
"description": "SupportBot",
"name": "supportbot",
"version": "26.1.1",
"description": "SupportBot is an open-sourced support system for discord. It's completely free to use with high amounts of customization to match your own brand.",
"main": "index.js",
"private": "true",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"setup": "npm i && node index.js",
"start": "node index.js"
},
"engines": {
"node": "12.6.0",
"npm": "6.9.0"
},
"dependencies": {
"discord.js": "^11.5.1",
"array-sort": "^1.0.0",
"table": "^5.4.4"
},
"repository": {
"type": "git",
"url": "https://github.com/EmeraldRusher/SupportBot.git"
"url": "git+https://github.com/Emerald-Services/SupportBot.git"
},
"keywords": [
"SupportBot",
"Emerald Services"
],
"author": "Emerald Services",
"license": "MIT",
"bugs": {
"url": "https://github.com/EmeraldRusher/SupportBot/issues"
"url": "https://github.com/Emerald-Services/SupportBot/issues"
},
"homepage": "https://discord.gg/hmWgxdF",
"contributors": [
"iJosGCS",
"RedstoneGamez"
]
"homepage": "https://community.emeraldsrv.dev",
"dependencies": {
"@vitalets/google-translate-api": "^9.2.1",
"axios": "^1.7.2",
"better-sqlite3": "^12.2.0",
"cors": "^2.8.6",
"discord.js": "^14.13.0",
"express": "^5.2.1",
"figlet": "^1.9.3",
"google-translate-api": "^2.3.0",
"gradient-string": "^3.0.0",
"js": "^0.1.0",
"js-yaml": "^4.1.0",
"moment": "^2.29.3",
"ms": "^2.1.3",
"openai": "^4.50.0",
"systeminformation": "^5.31.5",
"yaml": "^2.8.3"
}
}
-18
View File
@@ -1,18 +0,0 @@
// SupportBot Addons
// Default Addon
const Discord = require("discord.js");
const bot = new Discord.Client()
bot.settings = require("../settings.json");
exports.run = async(bot, message, args) => {
message.delete();
message.channel.send(":white_check_mark: **SupportBot Addon**\nThis addon is here by default.\nWe are currently working on some super amazing addons for SupportBot\nHowever, If you would like to start creating your own support bot addon\ncontact us at EmeraldServices.\n")
}
exports.help = {
name: 'addon',
}
-75
View File
@@ -1,75 +0,0 @@
{
"SupportBot": "v4.0.0",
"token": "BOT_TOKEN_HERE",
"prefix": "!",
"botname": "SupportBot",
"colour": "#13bd2a",
"footer": "Support Bot, By Emerald Services",
"BotStatus": "Support Bot",
"staff": "Staff",
"support": "Support",
"everyone": "@everyone",
"Auto_Role": "Member",
"LINKS": {
"Discord": "https://discord.gg/",
"Twitter": "https://twitter.com/",
"Website": "https://example.com/",
"AddMore": "AddMoreIfYouWant"
},
"LINKS_TITLE": "SupportBot Links",
"category": "Tickets",
"Ticket_Message": "Your support ticket has been opened successfully\nPlease allow us some time to reach out to you.",
"Ticket_Logs": "ticket-logs",
"bot.settings.Default_Ticket_Reason": "No Subject",
"Ticket_React_Message": ":mailbox: React to create your support ticket.",
"Commands_Log_Title": "SupportBot Logs",
"Command_Log_Channel": "command-logs",
"Announcement_Title": "SupportBot Announcement",
"Announcement_Channel": "announcements",
"Announcement_Tag_Role": "@everyone",
"Welcome_Message": "Welcome to the server!",
"Welcome_Channel": "welcome",
"Leave_Message": "Thank you for visiting us!",
"Leave_Channel": "welcome",
"Poll_Channel": "polls",
"Poll_Title": "📊 Polls",
"Reaction_Poll_1": "✅",
"Reaction_Poll_2": "❎",
"Suggestion_Title": "SupportBot Suggestions",
"Suggestion_Channel": "suggestions",
"suggestyes": "✅",
"suggestno": "❎",
"Report_Channel": "reports",
"Report_Title": "SupportBot Report",
"Announcement_Command": "announce",
"Say_Command": "say",
"Suggest_Command": "suggest",
"Ping_Command": "ping",
"Ticket_Command": "ticket",
"Remove_Command": "remove",
"Add_Command": "add",
"Close_Command": "close",
"Forceclose_Command": "forceclose",
"Rename_Command": "rename",
"Help_Command": "help",
"Link_Command": "links",
"Lockchat_Command": "lock",
"UnLockchat_Command": "unlock",
"Poll_Command": "poll",
"Report_Command": "report"
}
-1
View File
@@ -1 +0,0 @@
node index.js
-1
View File
@@ -1 +0,0 @@
node index.js