forked from greeveu/discord-ticketbot
-
Notifications
You must be signed in to change notification settings - Fork 1
Add privilegedSupporterRoles option and refactor some hard to maintain code #10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
brentspine
wants to merge
21
commits into
NoRiskClient:master
Choose a base branch
from
brentspine:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 16 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
1e0706d
chore: update config.example.yml to clarify xpApiUrl usage
brentspine bd33feb
docs: add setup instructions for Discord Ticket Bot
brentspine bef3d28
fix: set SQLite temp directory to avoid permission issues
brentspine 0223eeb
chore: clean-up sonar issues
brentspine 17c8eee
refactor(duplicates): streamline transcript generation and notificati…
brentspine 707fef0
chore: revert bogus sonar warning
brentspine dd1c3cf
fix: Send Close Embed again
brentspine a8a3549
doc: update readme
brentspine 11640eb
fix: improve ticket creation error handling and add info message logging
brentspine 7832a8f
fix: add info message logging for ticket category and additional details
brentspine f7fa3b4
feat: add privileged supporter roles and config dump command. 2 Sonar…
brentspine b866615
chore(warnings): Reduce Warnings and Sonar Issues
brentspine 86e04c2
doc: remove IntelliJ IDEA setup instructions from HOST_IT.md
brentspine 9c4fc68
feat: refactor supporter rating stats handling with a new helper clas…
brentspine 192028e
fix: handle potential null member in GetTranscript class for ticket o…
brentspine ee233b0
fix: Make config-dump command dev-only
brentspine 1367fe1
refactor: Use TimeUnit instead of multiplying seconds
brentspine c627d56
refactor: remove config-dump
brentspine 83acf0d
refactor: Remove usage of var in old and new code
brentspine 9abe249
refactor: Replace TimeUnit.SECONDS multiplication with TimeUnit const…
brentspine 26e97ff
Merge branch 'master' into master
brentspine File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,152 @@ | ||
| # How to Run the Discord Ticket Bot | ||
|
|
||
| ## Prerequisites | ||
| - **Java 21 or higher** installed | ||
| - A **Discord Bot Token** (from Discord Developer Portal) | ||
| - Your **Discord Server (Guild) ID** | ||
|
|
||
| --- | ||
|
|
||
| ## Method 1: Run Locally with Gradle (Recommended for Development) | ||
|
|
||
| ### Step 1: Build the Project | ||
| Open PowerShell in the project directory and run: | ||
| ```powershell | ||
| .\gradlew.bat shadowJar | ||
| ``` | ||
|
|
||
| This will compile the code and create a JAR file at: | ||
| `build\libs\discord-ticketbot.jar` | ||
|
|
||
| ### Step 2: Create Configuration Directory | ||
| ```powershell | ||
| mkdir Tickets | ||
| ``` | ||
|
|
||
| ### Step 3: Create Configuration File | ||
| Copy the example config and edit it: | ||
| ```powershell | ||
| Copy-Item config.example.yml Tickets\config.yml | ||
| ``` | ||
|
|
||
| Now open `Tickets\config.yml` in a text editor and **at minimum** set: | ||
| - `token: "YOUR_BOT_TOKEN_HERE"` - Replace with your Discord bot token | ||
|
|
||
| Optional settings you may want to configure: | ||
| - `staffId` - Role ID for staff members who can manage tickets | ||
| - `logChannel` - Channel ID for ticket transcripts | ||
| - `maxTicketsPerUser` - Maximum open tickets per user (default: 3) | ||
| - Other settings as needed | ||
|
|
||
| ### Step 4: Run the Bot | ||
| ```powershell | ||
| java -jar build\libs\discord-ticketbot.jar | ||
| ``` | ||
|
|
||
| ### Step 5: Set Up in Discord | ||
| 1. Invite your bot to your Discord server (needs permissions: Manage Channels, Manage Threads, Send Messages, Embed Links, Attach Files, Manage Roles) | ||
| 2. In Discord, run the command: `/ticket setup` | ||
| 3. This will automatically configure your `serverId` and create necessary channels/categories | ||
|
|
||
| --- | ||
|
|
||
| ## Method 2: Run with Docker | ||
|
|
||
| ### Using Docker Compose (Easiest) | ||
| ```powershell | ||
| docker-compose up -d | ||
| ``` | ||
|
|
||
| Before running, make sure to: | ||
| 1. Create the `Tickets` directory: `mkdir Tickets` | ||
| 2. Copy and edit the config: `Copy-Item config.example.yml Tickets\config.yml` | ||
| 3. Set your bot token in `Tickets\config.yml` | ||
|
|
||
| ### Using Docker Directly | ||
| ```powershell | ||
| # Build the image | ||
| docker build -t discord-ticketbot . | ||
|
|
||
| # Run the container | ||
| docker run -d --name ticketbot -v ${PWD}/Tickets:/app/Tickets discord-ticketbot | ||
| ``` | ||
|
|
||
| --- | ||
|
|
||
| ## Getting Your Bot Token | ||
|
|
||
| 1. Go to [Discord Developer Portal](https://discord.com/developers/applications) | ||
| 2. Create a new application or select an existing one | ||
| 3. Go to the "Bot" section | ||
| 4. Click "Reset Token" to get your bot token (keep it secret!) | ||
| 5. Enable these Privileged Gateway Intents: | ||
| - SERVER MEMBERS INTENT | ||
| - MESSAGE CONTENT INTENT | ||
| 6. Go to OAuth2 > URL Generator: | ||
| - Select scope: `bot`, `applications.commands` | ||
| - Select permissions: Administrator (or specific permissions as needed) | ||
| - Copy the generated URL and use it to invite the bot to your server | ||
|
|
||
| --- | ||
|
|
||
| ## Configuration Overview | ||
|
|
||
| Key settings in `Tickets/config.yml`: | ||
|
|
||
| | Setting | Required | Description | | ||
| |---------|----------|-------------| | ||
| | `token` | ✓ | Your Discord bot token | | ||
| | `serverId` | Auto | Set automatically by `/ticket setup` | | ||
| | `staffId` | - | Staff role ID for ticket management | | ||
| | `logChannel` | - | Where transcripts are posted | | ||
| | `ratingStatsChannel` | - | Daily rating statistics | | ||
| | `pendingRatingCategory` | - | Category for tickets awaiting rating | | ||
| | `maxTicketsPerUser` | - | Max open tickets per user (default: 3) | | ||
| | `xpApiUrl` / `xpApiKey` | - | Optional XP system integration | | ||
|
|
||
| --- | ||
|
|
||
| ## Troubleshooting | ||
|
|
||
| **"Invalid Token" error**: | ||
| - Check that your bot token is correct in `Tickets/config.yml` | ||
| - Make sure there are no extra spaces or quotes | ||
|
|
||
| **"Missing Permissions" error**: | ||
| - Ensure your bot has Administrator permission or at least: | ||
| - Manage Channels, Manage Threads, Send Messages, Embed Links, Attach Files, Manage Roles | ||
|
|
||
| **"Database error"**: | ||
| - The bot creates a SQLite database automatically in the `Tickets` folder | ||
| - Make sure the bot has write permissions to this directory | ||
|
|
||
| **Commands not showing**: | ||
| - Make sure you've enabled `applications.commands` scope when inviting the bot | ||
| - Wait a few minutes for Discord to sync commands | ||
| - Try running `/ticket setup` to register commands | ||
|
|
||
| --- | ||
|
|
||
| ## Default Ticket Categories | ||
|
|
||
| The bot supports these ticket types: | ||
| - General Support | ||
| - Bug Report | ||
| - Crash Report | ||
| - Payment Issue | ||
| - Report User | ||
| - Security Issue | ||
|
|
||
| You can customize categories by modifying the category classes in `src/main/java/eu/greev/dcbot/ticketsystem/categories/` | ||
|
|
||
| --- | ||
|
|
||
| ## Next Steps After Running | ||
|
|
||
| 1. Run `/ticket setup` in your Discord server | ||
| 2. Configure staff roles with `staffId` in config | ||
| 3. Set up log channels for transcripts | ||
| 4. Test creating a ticket | ||
| 5. Explore other commands like `/stats`, `/cleanup`, etc. | ||
|
|
||
| Enjoy your new ticket system! 🎫 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,10 @@ | ||
| # Greev Ticket Bot | ||
|
|
||
| The self coded ticket bot of Greev.eu with many features.\ | ||
| [Join the Greev.eu Discord](https://grv.sh/discord) | ||
| [Join the Greev.eu Discord](https://grv.sh/discord)\ | ||
| Fork by NoriskClient\ | ||
| [Join the NoriskClient Discord](https://discord.norisk.gg) | ||
|
|
||
| ## How to use? | ||
|
|
||
| Copy the built Jar file from the Actions tab of this repository, run it the first time and paste afterwards your bot token into `./Tickets/config.yml`\ | ||
| Then run the bot again, use `/ticket setup` in Discord and enjoy your new ticket bot :) | ||
| See the [self host guide](HOST_IT.md) for instructions on how to host the bot yourself. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.