Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6df23d84bc | ||
|
|
8cab4cc686 | ||
|
|
21e3a88b87 | ||
|
|
1451769ebf | ||
|
|
da3017ff95 | ||
|
|
43186c8a0e | ||
|
|
63632e3a66 | ||
|
|
8981c9e60e | ||
|
|
4a90a2d19a | ||
|
|
49b71ecdc6 | ||
|
|
af1c3288c0 | ||
|
|
7d89ac713b | ||
|
|
1fb8ece6ff | ||
|
|
001ae9f86a | ||
|
|
7c15812253 |
@@ -0,0 +1,2 @@
|
|||||||
|
node_modules/
|
||||||
|
package-lock.json
|
||||||
@@ -1,128 +0,0 @@
|
|||||||
# Contributor Covenant Code of Conduct
|
|
||||||
|
|
||||||
## Our Pledge
|
|
||||||
|
|
||||||
We as members, contributors, and leaders pledge to make participation in our
|
|
||||||
community a harassment-free experience for everyone, regardless of age, body
|
|
||||||
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
|
||||||
identity and expression, level of experience, education, socio-economic status,
|
|
||||||
nationality, personal appearance, race, religion, or sexual identity
|
|
||||||
and orientation.
|
|
||||||
|
|
||||||
We pledge to act and interact in ways that contribute to an open, welcoming,
|
|
||||||
diverse, inclusive, and healthy community.
|
|
||||||
|
|
||||||
## Our Standards
|
|
||||||
|
|
||||||
Examples of behavior that contributes to a positive environment for our
|
|
||||||
community include:
|
|
||||||
|
|
||||||
* Demonstrating empathy and kindness toward other people
|
|
||||||
* Being respectful of differing opinions, viewpoints, and experiences
|
|
||||||
* Giving and gracefully accepting constructive feedback
|
|
||||||
* Accepting responsibility and apologizing to those affected by our mistakes,
|
|
||||||
and learning from the experience
|
|
||||||
* Focusing on what is best not just for us as individuals, but for the
|
|
||||||
overall community
|
|
||||||
|
|
||||||
Examples of unacceptable behavior include:
|
|
||||||
|
|
||||||
* The use of sexualized language or imagery, and sexual attention or
|
|
||||||
advances of any kind
|
|
||||||
* Trolling, insulting or derogatory comments, and personal or political attacks
|
|
||||||
* Public or private harassment
|
|
||||||
* Publishing others' private information, such as a physical or email
|
|
||||||
address, without their explicit permission
|
|
||||||
* Other conduct which could reasonably be considered inappropriate in a
|
|
||||||
professional setting
|
|
||||||
|
|
||||||
## Enforcement Responsibilities
|
|
||||||
|
|
||||||
Community leaders are responsible for clarifying and enforcing our standards of
|
|
||||||
acceptable behavior and will take appropriate and fair corrective action in
|
|
||||||
response to any behavior that they deem inappropriate, threatening, offensive,
|
|
||||||
or harmful.
|
|
||||||
|
|
||||||
Community leaders have the right and responsibility to remove, edit, or reject
|
|
||||||
comments, commits, code, wiki edits, issues, and other contributions that are
|
|
||||||
not aligned to this Code of Conduct, and will communicate reasons for moderation
|
|
||||||
decisions when appropriate.
|
|
||||||
|
|
||||||
## Scope
|
|
||||||
|
|
||||||
This Code of Conduct applies within all community spaces, and also applies when
|
|
||||||
an individual is officially representing the community in public spaces.
|
|
||||||
Examples of representing our community include using an official e-mail address,
|
|
||||||
posting via an official social media account, or acting as an appointed
|
|
||||||
representative at an online or offline event.
|
|
||||||
|
|
||||||
## Enforcement
|
|
||||||
|
|
||||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
|
||||||
reported to the community leaders responsible for enforcement at
|
|
||||||
.
|
|
||||||
All complaints will be reviewed and investigated promptly and fairly.
|
|
||||||
|
|
||||||
All community leaders are obligated to respect the privacy and security of the
|
|
||||||
reporter of any incident.
|
|
||||||
|
|
||||||
## Enforcement Guidelines
|
|
||||||
|
|
||||||
Community leaders will follow these Community Impact Guidelines in determining
|
|
||||||
the consequences for any action they deem in violation of this Code of Conduct:
|
|
||||||
|
|
||||||
### 1. Correction
|
|
||||||
|
|
||||||
**Community Impact**: Use of inappropriate language or other behavior deemed
|
|
||||||
unprofessional or unwelcome in the community.
|
|
||||||
|
|
||||||
**Consequence**: A private, written warning from community leaders, providing
|
|
||||||
clarity around the nature of the violation and an explanation of why the
|
|
||||||
behavior was inappropriate. A public apology may be requested.
|
|
||||||
|
|
||||||
### 2. Warning
|
|
||||||
|
|
||||||
**Community Impact**: A violation through a single incident or series
|
|
||||||
of actions.
|
|
||||||
|
|
||||||
**Consequence**: A warning with consequences for continued behavior. No
|
|
||||||
interaction with the people involved, including unsolicited interaction with
|
|
||||||
those enforcing the Code of Conduct, for a specified period of time. This
|
|
||||||
includes avoiding interactions in community spaces as well as external channels
|
|
||||||
like social media. Violating these terms may lead to a temporary or
|
|
||||||
permanent ban.
|
|
||||||
|
|
||||||
### 3. Temporary Ban
|
|
||||||
|
|
||||||
**Community Impact**: A serious violation of community standards, including
|
|
||||||
sustained inappropriate behavior.
|
|
||||||
|
|
||||||
**Consequence**: A temporary ban from any sort of interaction or public
|
|
||||||
communication with the community for a specified period of time. No public or
|
|
||||||
private interaction with the people involved, including unsolicited interaction
|
|
||||||
with those enforcing the Code of Conduct, is allowed during this period.
|
|
||||||
Violating these terms may lead to a permanent ban.
|
|
||||||
|
|
||||||
### 4. Permanent Ban
|
|
||||||
|
|
||||||
**Community Impact**: Demonstrating a pattern of violation of community
|
|
||||||
standards, including sustained inappropriate behavior, harassment of an
|
|
||||||
individual, or aggression toward or disparagement of classes of individuals.
|
|
||||||
|
|
||||||
**Consequence**: A permanent ban from any sort of public interaction within
|
|
||||||
the community.
|
|
||||||
|
|
||||||
## Attribution
|
|
||||||
|
|
||||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
|
||||||
version 2.0, available at
|
|
||||||
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
|
|
||||||
|
|
||||||
Community Impact Guidelines were inspired by [Mozilla's code of conduct
|
|
||||||
enforcement ladder](https://github.com/mozilla/diversity).
|
|
||||||
|
|
||||||
[homepage]: https://www.contributor-covenant.org
|
|
||||||
|
|
||||||
For answers to common questions about this code of conduct, see the FAQ at
|
|
||||||
https://www.contributor-covenant.org/faq. Translations are available at
|
|
||||||
https://www.contributor-covenant.org/translations.
|
|
||||||
@@ -1,58 +1,68 @@
|
|||||||
# open-ticket
|
# open-ticket
|
||||||
This is an open-source discord ticket bot, you can configure it and it comes with cool features like a transcript.
|
[](https://discord.com/invite/26vT9wt3n3)
|
||||||
|
[](https://github.com/DJj123dj/open-ticket/releases/tag/v1.3.2)
|
||||||
|
[](#packages)
|
||||||
|
[](https://github.com/DJj123dj/open-ticket/blob/main/LICENSE)
|
||||||
|
|
||||||
(WARNING: the bot's language is Dutch, there will be an English version soon!)
|
This is an open-source discord ticket bot, you can configure it and it comes with cool features like transcripts & custom options!
|
||||||
|
|
||||||
|
<img src="logo.png" alt="Open Ticket logo" style="height: 200px; width:200px;"/>
|
||||||
|
|
||||||
|
[](https://github.com/DJj123dj/open-ticket/discussions/3)
|
||||||
|
|
||||||
|
[](./documentation/Q&A.md)
|
||||||
|
|
||||||
## features
|
## features
|
||||||
- discord interaction buttons
|
- discord interaction buttons
|
||||||
- transcripts
|
- transcripts
|
||||||
- add/remove users from ticket
|
- add/remove users from ticket
|
||||||
- custom colors & name
|
- custom colors & name
|
||||||
- has tickets for questions, partners & job applications
|
- create custom ticket names, icons & colors
|
||||||
|
- create url buttons for websites
|
||||||
|
- uses discord.js 13
|
||||||
|
- configure your own ticket options
|
||||||
|
- remove credits if you want
|
||||||
|
- up to 6 tickets at the same time
|
||||||
|
- change all bot messages
|
||||||
|
|
||||||
## installation
|
## installation
|
||||||
You need `node.js 16` to run this project, if you don't want to install `node.js 16` then there is a npm package that can help you.
|
**You need `node.js 16` to run this project!**
|
||||||
|
|
||||||
You can clone this project for download.
|
You can clone or download this project.
|
||||||
|
|
||||||
### packages
|
### packages
|
||||||
- canvas => version `^2.8.0`
|
- chalk => version `latest`
|
||||||
- discord.js => version `^13.2.0`
|
- discord.js => version `latest`
|
||||||
- express => version `^4.17.1`
|
- express => version `latest`
|
||||||
- node-localstorage => version `^2.2.1`
|
- node-localstorage => version `latest`
|
||||||
|
|
||||||
The packages are also in package.json!
|
You can install all of them by running `npm install`
|
||||||
|
|
||||||
### node.js 16 package
|
|
||||||
if you don't want to install `node.js 16`, you can install this package too
|
|
||||||
- node => version ^16.10.0
|
|
||||||
|
|
||||||
_npm install node@16_
|
|
||||||
|
|
||||||
## running
|
## running
|
||||||
you can run `node index.js` but i would recommend you to use `npm start`
|
you can run `node index.js` but i would recommend you to use `npm start`
|
||||||
|
|
||||||
if there are any errors, you can open an issue on github.
|
if there are any errors, you can open an **issue on github** or **contact me in the discord server**.
|
||||||
|
|
||||||
### config (required)
|
### config
|
||||||
- `server_name` => the name from your server.
|
Our config documentation is moved to another file:
|
||||||
- `server_logo`=> the logo from your server.
|
[click here to view](./documentation/CONFIG.md)
|
||||||
- `bot_name`=> the bot's name.
|
|
||||||
- `main_color`=> the color used in all embeds.
|
|
||||||
- `auth_token`=> the bot's token (Discord Developer Portal)
|
|
||||||
- `botperms_role`=> the id from a role that can run admin commands with the bot.
|
|
||||||
- `ticket_msg/ticket_channel` => the channel where you are gonna put the !ticket msg.
|
|
||||||
- `ticket_system/ticket_category` => the category for tickets.
|
|
||||||
- `ticket_system/member_role` => this role doesn't have access to tickets
|
|
||||||
(WARNING: @everyone does have access to tickets, so make sure all members have a member role!).
|
|
||||||
- `ticket_system/transcript_channel` => the channel for transcripts.
|
|
||||||
|
|
||||||
### intents
|
### intents & permissions
|
||||||
In the discord developer portal in the "bot" panel you will find 3 switches under the title "Gateaway Intents". The following switches should always be turned on
|
In the discord developer portal in the "bot" panel you will find 3 switches under the title "Gateaway Intents". The following switches should always be turned on
|
||||||
- `SERVER MEMBERS INTENT`
|
- `SERVER MEMBERS INTENT`
|
||||||
- `MESSAGE CONTENT INTENT`
|
- `MESSAGE CONTENT INTENT`
|
||||||
|
|
||||||
## credits
|
To work the best, the bot needs `ADMINISTRATOR` permissions.
|
||||||
the package contains a license, there are also credits in the bot. It is forbidden to extract these licenses and credits from it!
|
You can also configure your own permissions
|
||||||
|
|
||||||
© 2021 - DJdj Development | [website](https://www.dj-dj.be) | [discord](https://discord.com/invite/26vT9wt3n3)
|
## v1.4.0 announcement
|
||||||
|
Hello everyone, soon open-ticket v1.4.0 will be launched, it contains a lot of new features. You can view them below.
|
||||||
|
[click here to view the announcement](https://github.com/DJj123dj/open-ticket/discussions/3)
|
||||||
|
|
||||||
|
## information
|
||||||
|
|
||||||
|
_v1.3.2_
|
||||||
|
|
||||||
|
changelog: [click here](./documentation/CHANGELOG.md)
|
||||||
|
|
||||||
|
© 2022 - DJdj Development | [website](https://www.dj-dj.be) | [discord](https://discord.com/invite/26vT9wt3n3)
|
||||||
+214
@@ -0,0 +1,214 @@
|
|||||||
|
module.exports = async () => {
|
||||||
|
const chalk = await (await import("chalk")).default
|
||||||
|
const config = require("./config.json")
|
||||||
|
var errorList = []
|
||||||
|
var isError = false
|
||||||
|
var warnList = []
|
||||||
|
var isWarn = false
|
||||||
|
const createError = (message) => {
|
||||||
|
isError = true
|
||||||
|
errorList.push("open-ticket ERROR: "+message)
|
||||||
|
}
|
||||||
|
const createWarn = (message) => {
|
||||||
|
isWarn = true
|
||||||
|
warnList.push("open-ticket WARNING: "+message)
|
||||||
|
}
|
||||||
|
|
||||||
|
//checker
|
||||||
|
|
||||||
|
//token
|
||||||
|
if (config.auth_token.includes(" ")){
|
||||||
|
createError("invalid token | there are spaces in your token!")
|
||||||
|
}
|
||||||
|
if (config.auth_token.length < 40){
|
||||||
|
createError("invalid token | length not correct!")
|
||||||
|
}
|
||||||
|
|
||||||
|
//color
|
||||||
|
if (!config.main_color.startsWith("#")){
|
||||||
|
createError("color not detected | 'main_color' doesn't start with a '#'!")
|
||||||
|
}
|
||||||
|
if (config.main_color.length > 7 || config.main_color.length < 7){
|
||||||
|
createError("color not detected | 'main_color' is not a valid hex color!")
|
||||||
|
}
|
||||||
|
|
||||||
|
//admin
|
||||||
|
if (config.botperms_role.includes(" ")){
|
||||||
|
createError("invalid role id | 'botperms_role' is not a valid role id!")
|
||||||
|
}
|
||||||
|
if (config.botperms_role.length > 20|| config.botperms_role.length < 16){
|
||||||
|
createError("invalid role id | 'botperms_role' is not a valid role id!")
|
||||||
|
}
|
||||||
|
|
||||||
|
//prefix
|
||||||
|
if (config.prefix == ""){
|
||||||
|
createError("no prefix | 'prefix' is empty!")
|
||||||
|
}
|
||||||
|
if (config.prefix.length > 3){
|
||||||
|
createWarn("long prefix | your prefix is a little bit long!")
|
||||||
|
}
|
||||||
|
|
||||||
|
//status
|
||||||
|
if (config.status.enabled && (config.status.type != "PLAYING" && config.status.type != "LISTENING" && config.status.type != "WATCHING" && config.status.type != "CUSTOM")){
|
||||||
|
createError("status error | 'status/type' is invalid!")
|
||||||
|
}
|
||||||
|
if (config.status.enabled && config.status.text.length < 1){
|
||||||
|
createError("status error | 'status/text' must be at least 1 character long!")
|
||||||
|
}
|
||||||
|
|
||||||
|
//ticketchannel
|
||||||
|
if (config.system.ticket_channel.includes(" ")){
|
||||||
|
createWarn("invalid channel id | 'system/ticket_channel' is not a valid channel id!")
|
||||||
|
}
|
||||||
|
if (config.system.ticket_channel.length < 1){
|
||||||
|
createWarn("no ticket channel | 'system/ticket_channel' is empty")
|
||||||
|
}else if (config.system.ticket_channel.length > 20|| config.system.ticket_channel.length < 16){
|
||||||
|
createWarn("invalid channel id | 'system/ticket_channel' is not a valid channel id!")
|
||||||
|
}
|
||||||
|
|
||||||
|
//maxticket
|
||||||
|
if (config.system.max_allowed_tickets < 1){
|
||||||
|
createWarn("no tickets | if 'system/max_allowed_tickets' is under 1 you can't create any ticket")
|
||||||
|
}
|
||||||
|
|
||||||
|
//category
|
||||||
|
if (config.system.enable_category == true && config.system.ticket_category.includes(" ")){
|
||||||
|
createError("invalid category id | 'system/ticket_category' is not a valid category id!")
|
||||||
|
}
|
||||||
|
if (config.system.enable_category && config.system.ticket_category > 20 || config.system.ticket_category < 16){
|
||||||
|
createError("invalid category id | 'system/ticket_category' is not a valid category id!")
|
||||||
|
}
|
||||||
|
|
||||||
|
//everyoneaccess
|
||||||
|
if (config.system["has@everyoneaccess"] == true){
|
||||||
|
createWarn("access | everyone has access to the tickets!")
|
||||||
|
}
|
||||||
|
|
||||||
|
//memberrole
|
||||||
|
if (config.system.member_role.includes(" ")){
|
||||||
|
createError("invalid role id | 'system/member_role' is not a valid role id!")
|
||||||
|
}
|
||||||
|
if (config.system.member_role.length > 20){
|
||||||
|
createError("invalid role id | 'system/member_role' is not a valid role id!")
|
||||||
|
}
|
||||||
|
if (config.system.member_role == "" || config.system.member_role == " " || config.system.member_role == "false" || config.system.member_role == "null" || config.system.member_role == "0"){
|
||||||
|
createWarn("no member role | 'system/member_role' is not valid so technically everyone can view a ticket!")
|
||||||
|
}
|
||||||
|
|
||||||
|
//transcript
|
||||||
|
if (config.system.enable_transcript && config.system.transcript_channel.includes(" ")){
|
||||||
|
createError("invalid channel id | 'system/transcript_channel' is not a valid channel id!")
|
||||||
|
}
|
||||||
|
if (config.system.enable_transcript && config.system.transcript_channel.length > 20 || config.system.transcript_channel.length < 16){
|
||||||
|
createError("invalid channel id | 'system/transcript_channel' is not a valid channel id!")
|
||||||
|
}
|
||||||
|
|
||||||
|
//messages
|
||||||
|
if (config.messages.general.nopermissions.length < 1){
|
||||||
|
createError("no message | 'messages/general/nopermissions' is empty!")
|
||||||
|
}
|
||||||
|
if (config.messages.ticket.newTicketEmbed.length < 1){
|
||||||
|
createError("no message | 'messages/ticket/newTicketEmbed' is empty!")
|
||||||
|
}
|
||||||
|
if (config.messages.dm.alreadyCreated.length < 1){
|
||||||
|
createError("no message | 'messages/dm/alreadyCreated' is empty!")
|
||||||
|
}
|
||||||
|
if (config.messages.dm.newTicket.length < 1){
|
||||||
|
createError("no message | 'messages/dm/newTicket' is empty!")
|
||||||
|
}
|
||||||
|
if (config.messages.dm.closeTicket.length < 1){
|
||||||
|
createError("no message | 'messages/dm/closeTicket' is empty!")
|
||||||
|
}
|
||||||
|
|
||||||
|
//layout
|
||||||
|
const checkLayout = (layout,layoutname,color,footer,thumbnail) => {
|
||||||
|
if (color){
|
||||||
|
if (!layout.customColor.startsWith("#")){
|
||||||
|
createError("color not detected | 'layout/"+layoutname+"/customColor' doesn't start with a '#'!")
|
||||||
|
}
|
||||||
|
if (layout.customColor.length > 7 || layout.customColor.length < 7){
|
||||||
|
createError("color not detected | 'layout/"+layoutname+"/customColor' is not a valid hex color!")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (footer){
|
||||||
|
if (layout.footer.length < 1){
|
||||||
|
createError("no footer | 'layout/"+layoutname+"/footer' doesn't have a footer!")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (thumbnail){
|
||||||
|
if (!layout.thumbnailURL.startsWith("https://") && !layout.thumbnailURL.startsWith("http://")){
|
||||||
|
createError("thumbnail | the thumbnail url in 'layout/"+layoutname+"/thumbnailURL' is not a valid url!")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
checkLayout(config.layout.ticketEmbed,"ticketEmbed",config.layout.ticketEmbed.customColorEnabled,config.layout.ticketEmbed.footerEnabled,config.layout.ticketEmbed.thumbnailEnabled)
|
||||||
|
checkLayout(config.layout.ticketMsg,"ticketMsg",config.layout.ticketMsg.customColorEnabled,config.layout.ticketMsg.footerEnabled,config.layout.ticketMsg.thumbnailEnabled)
|
||||||
|
checkLayout(config.layout.transcripts,"transcripts",config.layout.transcripts.customColorEnabled,false,config.layout.transcripts.thumbnailEnabled)
|
||||||
|
|
||||||
|
const checkOption = (ticket,ticketname,enabled,urlmode) => {
|
||||||
|
if (enabled){
|
||||||
|
if (ticket.icon.length > 0){
|
||||||
|
const emojiRegex = /\p{Emoji}/u
|
||||||
|
const isEmoji = emojiRegex.test(ticket.icon)
|
||||||
|
if (isEmoji == false){
|
||||||
|
createWarn("invalid emoji | 'options/"+ticketname+"/icon' is not a valid emoji (code can be wrong)")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (ticket.description.length < 1){
|
||||||
|
createWarn("no description | 'options/"+ticketname+"/description' is empty")
|
||||||
|
}
|
||||||
|
if (ticket.name.length < 1){
|
||||||
|
createWarn("no description | 'options/"+ticketname+"/name' is empty")
|
||||||
|
}
|
||||||
|
if (ticket.channel_prefix.length < 1){
|
||||||
|
createWarn("no description | 'options/"+ticketname+"/channel_prefix' is empty")
|
||||||
|
}
|
||||||
|
if (ticket.isURL == true && ticket.color != "red" && ticket.color != "blue" && ticket.color != "green" && ticket.color != "gray" && ticket.color != "none"){
|
||||||
|
createWarn("invalid button color | 'options/"+ticketname+"/color' must be one of (red,green,blue,gray,none)")
|
||||||
|
}
|
||||||
|
|
||||||
|
if (urlmode && (!ticket.url.startsWith("https://") && !ticket.url.startsWith("http://"))){
|
||||||
|
createError("url invalid | the url in 'options/"+ticketname+"/url' is not a valid url!")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
checkOption(config.options.ticket1,"ticket1",config.options.ticket1.enabled,config.options.ticket1.isURL)
|
||||||
|
checkOption(config.options.ticket2,"ticket2",config.options.ticket2.enabled,config.options.ticket2.isURL)
|
||||||
|
checkOption(config.options.ticket3,"ticket3",config.options.ticket3.enabled,config.options.ticket3.isURL)
|
||||||
|
checkOption(config.options.ticket4,"ticket4",config.options.ticket4.enabled,config.options.ticket4.isURL)
|
||||||
|
checkOption(config.options.ticket5,"ticket5",config.options.ticket5.enabled,config.options.ticket5.isURL)
|
||||||
|
checkOption(config.options.ticket6,"ticket6",config.options.ticket6.enabled,config.options.ticket6.isURL)
|
||||||
|
|
||||||
|
//the end
|
||||||
|
if (errorList.length > 0 || warnList.length > 0){
|
||||||
|
console.log("REPORT:\n===========================")
|
||||||
|
}
|
||||||
|
warnList.forEach((w) => {
|
||||||
|
const splitw = w.split("'")
|
||||||
|
if (splitw.length > 1){
|
||||||
|
var splitstring = chalk.yellow(splitw[0])+chalk.blue("'"+splitw[1]+"'")+chalk.yellow(splitw[2])
|
||||||
|
}else {var splitstring = chalk.yellow(splitw[0])}
|
||||||
|
console.log(splitstring)
|
||||||
|
})
|
||||||
|
errorList.forEach((e) => {
|
||||||
|
const splite = e.split("'")
|
||||||
|
if (splite.length > 1){
|
||||||
|
var splitstring = chalk.red(splite[0])+chalk.blue("'"+splite[1]+"'")+chalk.red(splite[2])
|
||||||
|
}else {var splitstring = chalk.red(splite[0])}
|
||||||
|
console.log(splitstring)
|
||||||
|
})
|
||||||
|
if (isError){
|
||||||
|
console.log("===========================")
|
||||||
|
console.log("=> "+chalk.bgRed("your bot doesn't work if you don't fix the above errors!"))
|
||||||
|
if (isWarn){
|
||||||
|
console.log("\n=> "+chalk.bgYellow("if you ignore warns, some things may work differently than expected!"))
|
||||||
|
}
|
||||||
|
process.exit(0)
|
||||||
|
}else if (isWarn == true && isError == false){
|
||||||
|
console.log("===========================")
|
||||||
|
console.log("=> "+chalk.bgYellow("if you ignore warns, some things may work differently than expected!"))
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
const discord = require('discord.js')
|
||||||
|
const bot = require('../index')
|
||||||
|
const client = bot.client
|
||||||
|
const config = require("../config.json")
|
||||||
|
|
||||||
|
|
||||||
|
module.exports = () => {
|
||||||
|
client.on("messageCreate",(msg) => {
|
||||||
|
var args = msg.content.split(" ")
|
||||||
|
if (args[0] == config.prefix+"resetdatabase" || args[0] == config.prefix+"resetdb"){
|
||||||
|
const databaseEmbed = new discord.MessageEmbed()
|
||||||
|
.setColor(config.main_color)
|
||||||
|
.setTitle("How to reset the database:")
|
||||||
|
.setDescription("1: Go to the folder `./storage` in your bot's directory.\n\n2: If posible remove the folders\n`./tickets`, `./transcripts` & `./userTickets`\nfrom the folder `./storage`\n\n3: Restart the bot")
|
||||||
|
.setFooter({text:"if it doesn't work, create an issue on github or DM me on discord!"})
|
||||||
|
|
||||||
|
msg.channel.send({embeds:[databaseEmbed]})
|
||||||
|
if (config.logs){console.log("[command] "+config.prefix+"resetdatabase (user:"+msg.author.username+")")}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
+218
-29
@@ -3,51 +3,240 @@ const bot = require('../index')
|
|||||||
const client = bot.client
|
const client = bot.client
|
||||||
const config = require("../config.json")
|
const config = require("../config.json")
|
||||||
|
|
||||||
var name = require('./ticketExtra').name
|
|
||||||
var stringDecoder = require('./ticketSystem').stringDecoder
|
|
||||||
|
|
||||||
|
|
||||||
module.exports = () => {
|
module.exports = () => {
|
||||||
client.on("messageCreate", msg => {
|
client.on("messageCreate", msg => {
|
||||||
if (msg.content == "!ticket msg"){
|
if (msg.content == config.prefix+"ticket msg"){
|
||||||
if (msg.member.roles.cache.has(config.botperms_role) == false && msg.author.id != "779742674932072469"){
|
if (msg.member.roles.cache.has(config.botperms_role) == false){
|
||||||
msg.channel.send({content:"Je hebt geen permissions voor deze command!"})
|
msg.channel.send({content:config.messages.general.nopermissions})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var currentTicketButtons = 0
|
||||||
var ticketButton = new discord.MessageActionRow()
|
var ticketButton = new discord.MessageActionRow()
|
||||||
.addComponents(
|
var ticketButton2 = new discord.MessageActionRow()
|
||||||
|
|
||||||
|
const getColor = (color) => {
|
||||||
|
if (color.toLowerCase() == "red"){
|
||||||
|
return "DANGER"
|
||||||
|
}else if (color.toLowerCase() == "green"){
|
||||||
|
return "SUCCESS"
|
||||||
|
}else if (color.toLowerCase() == "blue" || color.toLowerCase() == "blurple"){
|
||||||
|
return "PRIMARY"
|
||||||
|
}else if (color.toLowerCase() == "black" || color.toLowerCase() == "gray" || color.toLowerCase() == "grey"){
|
||||||
|
return "SECONDARY"
|
||||||
|
}else if (color == "DANGER" || color == "SECONDARY" || color == "SUCCESS" || color == "PRIMARY"){
|
||||||
|
return color
|
||||||
|
}else if (color.toLowerCase() == "none" || color.toLowerCase() == "false" || color.toLowerCase() == ""){
|
||||||
|
return "SECONDARY"
|
||||||
|
}else return "SECONDARY"
|
||||||
|
}
|
||||||
|
|
||||||
|
if (config.options.ticket1.enabled){
|
||||||
|
if (currentTicketButtons < 4){
|
||||||
|
var localTicketButton = ticketButton
|
||||||
|
}else{
|
||||||
|
var localTicketButton = ticketButton2
|
||||||
|
}
|
||||||
|
|
||||||
|
currentTicketButtons = currentTicketButtons + 1
|
||||||
|
|
||||||
|
if (config.options.ticket1.isURL == false){
|
||||||
|
localTicketButton.addComponents(
|
||||||
|
new discord.MessageButton()
|
||||||
|
.setCustomId("newTicket1")
|
||||||
|
.setDisabled(false)
|
||||||
|
.setStyle(getColor(config.options.ticket1.color))
|
||||||
|
.setEmoji(config.options.ticket1.icon)
|
||||||
|
)
|
||||||
|
}else{
|
||||||
|
localTicketButton.addComponents(
|
||||||
|
new discord.MessageButton()
|
||||||
|
.setDisabled(false)
|
||||||
|
.setStyle("LINK")
|
||||||
|
.setEmoji(config.options.ticket1.icon)
|
||||||
|
.setURL(config.options.ticket1.url)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (config.options.ticket2.enabled){
|
||||||
|
if (currentTicketButtons < 4){
|
||||||
|
var localTicketButton = ticketButton
|
||||||
|
}else{
|
||||||
|
var localTicketButton = ticketButton2
|
||||||
|
}
|
||||||
|
|
||||||
|
currentTicketButtons = currentTicketButtons + 1
|
||||||
|
|
||||||
|
if (config.options.ticket2.isURL == false){
|
||||||
|
localTicketButton.addComponents(
|
||||||
new discord.MessageButton()
|
new discord.MessageButton()
|
||||||
.setCustomId("newTicketVraag")
|
.setCustomId("newTicket2")
|
||||||
.setDisabled(false)
|
.setDisabled(false)
|
||||||
.setStyle("SECONDARY")
|
.setStyle(getColor(config.options.ticket2.color))
|
||||||
.setEmoji("❓")
|
.setEmoji(config.options.ticket2.icon)
|
||||||
)
|
|
||||||
.addComponents(
|
|
||||||
new discord.MessageButton()
|
|
||||||
.setCustomId("newTicketSolli")
|
|
||||||
.setDisabled(false)
|
|
||||||
.setStyle("SECONDARY")
|
|
||||||
.setEmoji("📝")
|
|
||||||
)
|
|
||||||
.addComponents(
|
|
||||||
new discord.MessageButton()
|
|
||||||
.setCustomId("newTicketPartner")
|
|
||||||
.setDisabled(false)
|
|
||||||
.setStyle("SECONDARY")
|
|
||||||
.setEmoji("💼")
|
|
||||||
)
|
)
|
||||||
|
}else{
|
||||||
|
localTicketButton.addComponents(
|
||||||
|
new discord.MessageButton()
|
||||||
|
.setDisabled(false)
|
||||||
|
.setStyle("LINK")
|
||||||
|
.setEmoji(config.options.ticket2.icon)
|
||||||
|
.setURL(config.options.ticket2.url)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (config.options.ticket3.enabled){
|
||||||
|
if (currentTicketButtons < 4){
|
||||||
|
var localTicketButton = ticketButton
|
||||||
|
}else{
|
||||||
|
var localTicketButton = ticketButton2
|
||||||
|
}
|
||||||
|
|
||||||
|
currentTicketButtons = currentTicketButtons + 1
|
||||||
|
|
||||||
|
if (config.options.ticket3.isURL == false){
|
||||||
|
localTicketButton.addComponents(
|
||||||
|
new discord.MessageButton()
|
||||||
|
.setCustomId("newTicket3")
|
||||||
|
.setDisabled(false)
|
||||||
|
.setStyle(getColor(config.options.ticket3.color))
|
||||||
|
.setEmoji(config.options.ticket3.icon)
|
||||||
|
)
|
||||||
|
}else{
|
||||||
|
localTicketButton.addComponents(
|
||||||
|
new discord.MessageButton()
|
||||||
|
.setDisabled(false)
|
||||||
|
.setStyle("LINK")
|
||||||
|
.setEmoji(config.options.ticket3.icon)
|
||||||
|
.setURL(config.options.ticket3.url)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (config.options.ticket4.enabled){
|
||||||
|
if (currentTicketButtons < 4){
|
||||||
|
var localTicketButton = ticketButton
|
||||||
|
}else{
|
||||||
|
var localTicketButton = ticketButton2
|
||||||
|
}
|
||||||
|
|
||||||
|
currentTicketButtons = currentTicketButtons + 1
|
||||||
|
|
||||||
|
if (config.options.ticket4.isURL == false){
|
||||||
|
localTicketButton.addComponents(
|
||||||
|
new discord.MessageButton()
|
||||||
|
.setCustomId("newTicket4")
|
||||||
|
.setDisabled(false)
|
||||||
|
.setStyle(getColor(config.options.ticket4.color))
|
||||||
|
.setEmoji(config.options.ticket4.icon)
|
||||||
|
)
|
||||||
|
}else{
|
||||||
|
localTicketButton.addComponents(
|
||||||
|
new discord.MessageButton()
|
||||||
|
.setDisabled(false)
|
||||||
|
.setStyle("LINK")
|
||||||
|
.setEmoji(config.options.ticket4.icon)
|
||||||
|
.setURL(config.options.ticket4.url)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (config.options.ticket5.enabled){
|
||||||
|
if (currentTicketButtons < 4){
|
||||||
|
var localTicketButton = ticketButton
|
||||||
|
}else{
|
||||||
|
var localTicketButton = ticketButton2
|
||||||
|
}
|
||||||
|
|
||||||
|
currentTicketButtons = currentTicketButtons + 1
|
||||||
|
|
||||||
|
if (config.options.ticket5.isURL == false){
|
||||||
|
localTicketButton.addComponents(
|
||||||
|
new discord.MessageButton()
|
||||||
|
.setCustomId("newTicket5")
|
||||||
|
.setDisabled(false)
|
||||||
|
.setStyle(getColor(config.options.ticket5.color))
|
||||||
|
.setEmoji(config.options.ticket5.icon)
|
||||||
|
)
|
||||||
|
}else{
|
||||||
|
localTicketButton.addComponents(
|
||||||
|
new discord.MessageButton()
|
||||||
|
.setDisabled(false)
|
||||||
|
.setStyle("LINK")
|
||||||
|
.setEmoji(config.options.ticket5.icon)
|
||||||
|
.setURL(config.options.ticket5.url)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (config.options.ticket6.enabled){
|
||||||
|
if (currentTicketButtons < 4){
|
||||||
|
var localTicketButton = ticketButton
|
||||||
|
}else{
|
||||||
|
var localTicketButton = ticketButton2
|
||||||
|
}
|
||||||
|
|
||||||
|
currentTicketButtons = currentTicketButtons + 1
|
||||||
|
|
||||||
|
if (config.options.ticket6.isURL == false){
|
||||||
|
localTicketButton.addComponents(
|
||||||
|
new discord.MessageButton()
|
||||||
|
.setCustomId("newTicket6")
|
||||||
|
.setDisabled(false)
|
||||||
|
.setStyle(getColor(config.options.ticket6.color))
|
||||||
|
.setEmoji(config.options.ticket6.icon)
|
||||||
|
)
|
||||||
|
}else{
|
||||||
|
localTicketButton.addComponents(
|
||||||
|
new discord.MessageButton()
|
||||||
|
.setDisabled(false)
|
||||||
|
.setStyle("LINK")
|
||||||
|
.setEmoji(config.options.ticket6.icon)
|
||||||
|
.setURL(config.options.ticket6.url)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var categorylist = ""
|
||||||
|
if (config.options.ticket1.enabled){categorylist = categorylist+"\n"+config.options.ticket1.icon+": **"+config.options.ticket1.name+"**\n"+config.options.ticket1.description}
|
||||||
|
|
||||||
|
if (config.options.ticket2.enabled){categorylist = categorylist+"\n\n"+config.options.ticket2.icon+": **"+config.options.ticket2.name+"**\n"+config.options.ticket2.description}
|
||||||
|
|
||||||
|
if (config.options.ticket3.enabled){categorylist = categorylist+"\n\n"+config.options.ticket3.icon+": **"+config.options.ticket3.name+"**\n"+config.options.ticket3.description}
|
||||||
|
|
||||||
|
if (config.options.ticket4.enabled){categorylist = categorylist+"\n\n"+config.options.ticket4.icon+": **"+config.options.ticket4.name+"**\n"+config.options.ticket4.description}
|
||||||
|
|
||||||
|
if (config.options.ticket5.enabled){categorylist = categorylist+"\n\n"+config.options.ticket5.icon+": **"+config.options.ticket5.name+"**\n"+config.options.ticket5.description}
|
||||||
|
|
||||||
|
if (config.options.ticket6.enabled){categorylist = categorylist+"\n\n"+config.options.ticket6.icon+": **"+config.options.ticket6.name+"**\n"+config.options.ticket6.description}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var ticketEmbed = new discord.MessageEmbed()
|
var ticketEmbed = new discord.MessageEmbed()
|
||||||
.setColor(config.main_color)
|
if (config.layout.ticketMsg.customColorEnabled){
|
||||||
.setDescription("**Maak een ticket:**\nKlik op een van de onderstaande knoppen om een ticket aan te maken.\n\n__kies een categorie:__\n\n❓: **Vragen**\nOverige vragen.\n\n📝: **Sollicitatie**\nDoe een sollicitatie.\n\n💼: **Partner**\nWord partner met ons.\n\n**opgepast: **_u kan maar één ticket tegelijkertijd aanmaken!_")
|
ticketEmbed.setColor(config.layout.ticketMsg.customColor)
|
||||||
.setFooter("bot "+stringDecoder+name+" - https://www.dj-dj.be")
|
}else{ticketEmbed.setColor(config.main_color)}
|
||||||
|
|
||||||
|
if (config.layout.ticketMsg.footerEnabled){
|
||||||
|
ticketEmbed.setFooter({text:config.layout.ticketMsg.footer})
|
||||||
|
}
|
||||||
|
if (config.layout.ticketMsg.thumbnailEnabled){
|
||||||
|
ticketEmbed.setThumbnail(config.layout.ticketMsg.thumbnailURL)
|
||||||
|
}
|
||||||
|
|
||||||
|
ticketEmbed.setDescription("**Create a ticket:**\nClick one of the buttons below to create a ticket.\n\n__choose a category:__"+categorylist+"\n\n**watch out:**_You can only create "+config.system.max_allowed_tickets+" ticket(s) at a time!_")
|
||||||
|
|
||||||
|
|
||||||
|
if (currentTicketButtons <= 4){
|
||||||
|
var embedComponents = [ticketButton]
|
||||||
|
}else{var embedComponents = [ticketButton,ticketButton2]}
|
||||||
|
|
||||||
msg.channel.send({embeds:[ticketEmbed],components:[ticketButton]})
|
msg.channel.send({embeds:[ticketEmbed],components:embedComponents})
|
||||||
|
|
||||||
|
|
||||||
|
if (config.logs){console.log("[command] "+config.prefix+"ticket msg (user:"+msg.author.username+")")}
|
||||||
|
if (config.logs){console.log("[system] created ticket message")}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
+43
-48
@@ -2,70 +2,50 @@ const discord = require('discord.js')
|
|||||||
const bot = require('../index')
|
const bot = require('../index')
|
||||||
const client = bot.client
|
const client = bot.client
|
||||||
const config = require("../config.json")
|
const config = require("../config.json")
|
||||||
var name = "DJdj Development"
|
|
||||||
exports.name = name
|
|
||||||
var stringDecoder = require('./ticketSystem').stringDecoder
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
module.exports = () => {
|
module.exports = () => {
|
||||||
client.on("messageCreate",msg => {
|
client.on("messageCreate",msg => {
|
||||||
var args = msg.content.split(" ")
|
var args = msg.content.split(" ")
|
||||||
if (args[0] == "!solli"){
|
if (args[0] == config.prefix+"ticket" && (args[1] == undefined ||args[1] == "" ||args[1] == null)){
|
||||||
var SolliMsg = new discord.MessageEmbed()
|
|
||||||
.setColor(config.main_color)
|
|
||||||
.setDescription("**Hier is de informatie die wij nodig hebben voor een sollicitatie**\n\n**naam:** Je echte naam.\n**leeftijd:** Je leeftijd.\n**discord naam:** Je discord naam + tag (bv:Wumpus#0001).\n**minecraft naam:** Je minecraft naam.\n**waarom wil je staff worden:** De reden waarom je staff wilt worden.\n**+ punten:** Je plus punten.\n**- punten:** Je min punten.\n**Jou of iemand anders:** Waarom zouden we jou aan moeten nemen en niet een andere sollicitant?\n**ervaring:** Wat is je ervaring met MT servers?\n**andere server:** Ben je op dit moment staff op een andere server?\n**online:** Hoeveel uur per dag/week kan je online zijn?\n**functie:** Voor welke functie solliciteert u?")
|
|
||||||
.setTitle("Sollicitatie")
|
|
||||||
|
|
||||||
msg.channel.send({embeds:[SolliMsg]})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
client.on("messageCreate",msg => {
|
|
||||||
var args = msg.content.split(" ")
|
|
||||||
if (args[0] == "!ticket" && (args[1] == undefined ||args[1] == "" ||args[1] == null)){
|
|
||||||
var TicketHelpMsg = new discord.MessageEmbed()
|
var TicketHelpMsg = new discord.MessageEmbed()
|
||||||
.setColor(config.main_color)
|
.setColor(config.main_color)
|
||||||
.setDescription("**Ga naar <#"+config.ticket_msg.ticket_channel+"> om een ticket te maken!**\n\n`!ticket msg` ➜ _Maak een ticket reageer bericht (staff only)._\n`!ticket rename` ➜ _Rename een ticket (geen spaties)._\n`!ticket close` ➜ _Close een ticket._\n`!ticket add <user>` ➜ _Voeg een speler toe aan het ticket._\n`!ticket remove <user>` ➜ _Verwijder een speler van het ticket._\n`!partner` ➜ _De informatie voor partners._\n`!solli` ➜ _De informatie voor solliciteren._")
|
|
||||||
.setTitle("Ticket commands")
|
.setTitle("Ticket commands")
|
||||||
.setFooter(stringDecoder+name)
|
|
||||||
|
const prefix = config.prefix
|
||||||
|
TicketHelpMsg.setDescription("**Go to <#"+config.system.ticket_channel+"> to create a ticket!**\n\n`"+prefix+"ticket msg` ➜ _Admin command._\n`"+prefix+"ticket rename` ➜ _Rename a ticket (no spaces)._\n`"+prefix+"ticket close` ➜ _Close a ticket._\n`"+prefix+"ticket add <user>` ➜ _Add a user to the ticket._\n`"+prefix+"ticket remove <user>` ➜ _Remove a user from the ticket._\n`"+prefix+"resetdatabase` ➜ _Steps to reset the database._\n`"+prefix+"resetdb` ➜ _Also database stuff._")
|
||||||
|
|
||||||
|
if (config.credits){
|
||||||
|
TicketHelpMsg.setFooter({text:"Open-Ticket by DJdj Development | view on github for source code"})
|
||||||
|
}
|
||||||
|
|
||||||
msg.channel.send({embeds:[TicketHelpMsg]})
|
msg.channel.send({embeds:[TicketHelpMsg]})
|
||||||
|
if (config.logs){console.log("[command] "+config.prefix+"ticket help (user:"+msg.author.username+")")}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
client.on("messageCreate",msg => {
|
client.on("messageCreate",msg => {
|
||||||
var args = msg.content.split(" ")
|
var args = msg.content.split(" ")
|
||||||
if (args[0] == "!partner"){
|
if (args[0] == config.prefix+"ticket" && args[1] == "close"){
|
||||||
var PartnerMsg = new discord.MessageEmbed()
|
|
||||||
.setColor(config.main_color)
|
|
||||||
.setDescription("**Hier zijn de doelen die je moet hebben voor een partnership**\n\n**server:** De naam van je server.\n**beschrijving:** Waar gaat je server over?\n**members:** Het aantal members in je server.\n**invite:** Een oneindige invite.\n\n_als wij dit goedkeuren, kan je je 'invite bericht' plaatsen._")
|
|
||||||
.setTitle("Partnership")
|
|
||||||
|
|
||||||
msg.channel.send({embeds:[PartnerMsg]})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
client.on("messageCreate",msg => {
|
|
||||||
var args = msg.content.split(" ")
|
|
||||||
if (args[0] == "!ticket" && args[1] == "close"){
|
|
||||||
|
|
||||||
msg.channel.messages.fetchPinned().then(msglist => {
|
msg.channel.messages.fetchPinned().then(msglist => {
|
||||||
var firstmsg = msglist.last()
|
var firstmsg = msglist.last()
|
||||||
|
|
||||||
if (firstmsg == undefined){
|
if (firstmsg == undefined){
|
||||||
msg.channel.send({content:"Ik heb de sluit knop niet gevonden!"})
|
msg.channel.send({content:"I didn't find the close button!"})
|
||||||
}
|
}
|
||||||
if (firstmsg.author.id != client.user.id){
|
if (firstmsg.author.id != client.user.id){
|
||||||
msg.channel.send({content:"Je bent niet in een ticket!"})
|
msg.channel.send({content:"You are not in a ticket!"})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
var CloseMsg = new discord.MessageEmbed()
|
var CloseMsg = new discord.MessageEmbed()
|
||||||
.setColor(config.main_color)
|
.setColor(config.main_color)
|
||||||
.setDescription("klik [hier]("+firstmsg.url+") om het ticket te sluiten.")
|
.setDescription("Click [here]("+firstmsg.url+") to close this ticket.")
|
||||||
.setTitle("Sluit dit ticket:")
|
.setTitle("Close this ticket:")
|
||||||
|
|
||||||
msg.channel.send({embeds:[CloseMsg]})
|
msg.channel.send({embeds:[CloseMsg]})
|
||||||
|
if (config.logs){console.log("[command] "+config.prefix+"ticket close (user:"+msg.author.username+")")}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
@@ -74,43 +54,51 @@ module.exports = () => {
|
|||||||
|
|
||||||
client.on("messageCreate",msg => {
|
client.on("messageCreate",msg => {
|
||||||
var args = msg.content.split(" ")
|
var args = msg.content.split(" ")
|
||||||
if (args[0] == "!ticket" && args[1] == "rename"){
|
if (args[0] == config.prefix+"ticket" && args[1] == "rename"){
|
||||||
|
|
||||||
if (msg.member.roles.cache.has(config.botperms_role) == false && msg.author.id != "779742674932072469"){
|
if (msg.member.roles.cache.has(config.botperms_role) == false && msg.author.id != "779742674932072469"){
|
||||||
msg.channel.send({content:"Je hebt geen permissions voor deze command!"})
|
msg.channel.send({content:config.messages.general.nopermissions})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (args[2] == null || args[2] == undefined || args[2] == "" || args[2] == false){
|
||||||
|
msg.channel.send({content:"Not enough parameters!"})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
var name = args[2]
|
var name = args[2]
|
||||||
|
var oldname = msg.channel.name
|
||||||
msg.channel.messages.fetchPinned().then(msglist => {
|
msg.channel.messages.fetchPinned().then(msglist => {
|
||||||
if (msglist.last().author.id == client.user.id){
|
if (msglist.last().author.id == client.user.id){
|
||||||
msg.channel.send({content:"De naam is veranderd!"}).then(rmsg => {
|
msg.channel.send({content:"The name from the ticket is changed!"}).then(rmsg => {
|
||||||
rmsg.channel.setName(name)
|
rmsg.channel.setName(name)
|
||||||
|
if (config.logs){console.log("[system] renamed a ticket (name:"+oldname+",newname:"+name+")")}
|
||||||
})
|
})
|
||||||
}else{
|
}else{
|
||||||
msg.channel.send({content:"Je bent niet in een ticket!"})
|
msg.channel.send({content:"You are not in a ticket!"})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
if (config.logs){console.log("[command] "+config.prefix+"ticket rename (user:"+msg.author.username+")")}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
client.on("messageCreate",msg => {
|
client.on("messageCreate",msg => {
|
||||||
var args = msg.content.split(" ")
|
var args = msg.content.split(" ")
|
||||||
if (args[0] == "!ticket" && args[1] == "add"){
|
if (args[0] == config.prefix+"ticket" && args[1] == "add"){
|
||||||
|
|
||||||
if (msg.member.roles.cache.has(config.botperms_role) == false && msg.author.id != "779742674932072469"){
|
if (msg.member.roles.cache.has(config.botperms_role) == false && msg.author.id != "779742674932072469"){
|
||||||
msg.channel.send({content:"Je hebt geen permissions voor deze command!"})
|
msg.channel.send({content:config.messages.general.nopermissions})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
msg.channel.messages.fetch().then(msglist => {
|
msg.channel.messages.fetch().then(msglist => {
|
||||||
if (msglist.last().author.id != client.user.id){
|
if (msglist.last().author.id != client.user.id){
|
||||||
msg.channel.send({content:"Je bent niet in een ticket!"})
|
msg.channel.send({content:"You are not in a ticket!"})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args[2] == null || args[2] == undefined || args[2] == "" || args[2] == false){
|
if (args[2] == null || args[2] == undefined || args[2] == "" || args[2] == false){
|
||||||
msg.channel.send({content:"Niet genoeg parameters!"})
|
msg.channel.send({content:"Not enough parameters!"})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
var user = msg.mentions.users.first()
|
var user = msg.mentions.users.first()
|
||||||
@@ -119,28 +107,31 @@ module.exports = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
msg.channel.permissionOverwrites.create(user.id, { VIEW_CHANNEL:true, ADD_REACTIONS:true,ATTACH_FILES:true, EMBED_LINKS:true, SEND_MESSAGES:true})
|
msg.channel.permissionOverwrites.create(user.id, { VIEW_CHANNEL:true, ADD_REACTIONS:true,ATTACH_FILES:true, EMBED_LINKS:true, SEND_MESSAGES:true})
|
||||||
|
if (config.logs){console.log("[system] added user to ticket (name:"+user.username+",ticket:"+msg.channel.name+")")}
|
||||||
|
|
||||||
})
|
})
|
||||||
|
var loguser = msg.mentions.users.first()
|
||||||
|
if (config.logs){console.log("[command] "+config.prefix+"ticket add "+loguser.username+" (user:"+msg.author.username+")")}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
client.on("messageCreate",msg => {
|
client.on("messageCreate",msg => {
|
||||||
var args = msg.content.split(" ")
|
var args = msg.content.split(" ")
|
||||||
if (args[0] == "!ticket" && args[1] == "remove"){
|
if (args[0] == config.prefix+"ticket" && args[1] == "remove"){
|
||||||
|
|
||||||
if (msg.member.roles.cache.has(config.botperms_role) == false && msg.author.id != "779742674932072469"){
|
if (msg.member.roles.cache.has(config.botperms_role) == false && msg.author.id != "779742674932072469"){
|
||||||
msg.channel.send({content:"Je hebt geen permissions voor deze command!"})
|
msg.channel.send({content:config.messages.general.nopermissions})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
msg.channel.messages.fetchPinned().then(msglist => {
|
msg.channel.messages.fetchPinned().then(msglist => {
|
||||||
if (msglist.last().author.id != client.user.id){
|
if (msglist.last().author.id != client.user.id){
|
||||||
msg.channel.send({content:"Je bent niet in een ticket!"})
|
msg.channel.send({content:"You aren't in a ticket!"})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args[2] == null || args[2] == undefined || args[2] == "" || args[2] == false){
|
if (args[2] == null || args[2] == undefined || args[2] == "" || args[2] == false){
|
||||||
msg.channel.send({content:"Niet genoeg parameters!"})
|
msg.channel.send({content:"Not enough parameters!"})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
var user = msg.mentions.users.first()
|
var user = msg.mentions.users.first()
|
||||||
@@ -149,8 +140,12 @@ module.exports = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
msg.channel.permissionOverwrites.delete(user.id)
|
msg.channel.permissionOverwrites.delete(user.id)
|
||||||
|
if (config.logs){console.log("[system] removed user from ticket (name:"+user.username+",ticket:"+msg.channel.name+")")}
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
var loguser = msg.mentions.users.first()
|
||||||
|
if (config.logs){console.log("[command] "+config.prefix+"ticket remove "+loguser.username+" (user:"+msg.author.username+")")}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
+144
-83
@@ -7,9 +7,6 @@ const ticketStorage = bot.TicketStorage
|
|||||||
const userTicketStorage = bot.userTicketStorage
|
const userTicketStorage = bot.userTicketStorage
|
||||||
const transcriptStorage = bot.transcriptStorage
|
const transcriptStorage = bot.transcriptStorage
|
||||||
|
|
||||||
var stringDecoder = "Created By "
|
|
||||||
exports.stringDecoder = stringDecoder
|
|
||||||
|
|
||||||
module.exports = () => {
|
module.exports = () => {
|
||||||
|
|
||||||
var closeButton = new discord.MessageActionRow()
|
var closeButton = new discord.MessageActionRow()
|
||||||
@@ -18,90 +15,133 @@ module.exports = () => {
|
|||||||
.setCustomId("closeTicket")
|
.setCustomId("closeTicket")
|
||||||
.setDisabled(false)
|
.setDisabled(false)
|
||||||
.setStyle("SECONDARY")
|
.setStyle("SECONDARY")
|
||||||
.setLabel("Sluit Ticket")
|
.setLabel("Close Ticket")
|
||||||
.setEmoji("❌")
|
.setEmoji("❌")
|
||||||
)
|
)
|
||||||
|
|
||||||
|
//ticket button click / create ticket
|
||||||
client.on("interactionCreate",interaction => {
|
client.on("interactionCreate",interaction => {
|
||||||
|
|
||||||
if (interaction.isButton() == false){
|
if (interaction.isButton() == false){
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (interaction.customId == "newTicketVraag"||interaction.customId == "newTicketSolli"||interaction.customId == "newTicketPartner"){
|
if (interaction.customId == "newTicket1"||interaction.customId == "newTicket2"||interaction.customId == "newTicket3"||interaction.customId == "newTicket4"||interaction.customId == "newTicket5"||interaction.customId == "newTicket6"){
|
||||||
|
|
||||||
interaction.deferUpdate()
|
interaction.deferUpdate()
|
||||||
|
|
||||||
if (ticketStorage.getItem(interaction.member.id) == null ||ticketStorage.getItem(interaction.member.id) == "false"){
|
if (ticketStorage.getItem(interaction.member.id) == null ||ticketStorage.getItem(interaction.member.id) == "false"|| Number(ticketStorage.getItem(interaction.member.id)) < config.system.max_allowed_tickets){
|
||||||
|
|
||||||
try{
|
try{
|
||||||
interaction.member.send("**Je ticket is aangemaakt!**")
|
if (config.system.enable_DM_Messages){
|
||||||
|
interaction.member.send(config.messages.dm.newTicket)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch{console.log("cant send DM to member")}
|
catch{console.log("can't send DM to member || member doesn't allow dm's")}
|
||||||
|
|
||||||
|
|
||||||
|
//update storage
|
||||||
ticketStorage.setItem(interaction.member.id,"true")
|
ticketStorage.setItem(interaction.member.id,Number(ticketStorage.getItem(interaction.member.id))+1)
|
||||||
|
|
||||||
var ticketNumber = interaction.member.user.username
|
var ticketNumber = interaction.member.user.username
|
||||||
|
|
||||||
if (interaction.customId == "newTicketVraag"){
|
//set ticketName
|
||||||
var ticketName = "vraag-"+ticketNumber
|
if (interaction.customId == "newTicket1"){
|
||||||
}else if (interaction.customId == "newTicketSolli"){
|
var ticketName = config.options.ticket1.channel_prefix+ticketNumber
|
||||||
var ticketName = "solli-"+ticketNumber
|
var logsname = config.options.ticket1.name
|
||||||
}else if (interaction.customId == "newTicketPartner"){
|
}else if (interaction.customId == "newTicket2"){
|
||||||
var ticketName = "partner-"+ticketNumber
|
var ticketName = config.options.ticket2.channel_prefix+ticketNumber
|
||||||
|
var logsname = config.options.ticket2.name
|
||||||
|
}else if (interaction.customId == "newTicket3"){
|
||||||
|
var ticketName = config.options.ticket3.channel_prefix+ticketNumber
|
||||||
|
var logsname = config.options.ticket3.name
|
||||||
|
}else if (interaction.customId == "newTicket4"){
|
||||||
|
var ticketName = config.options.ticket4.channel_prefix+ticketNumber
|
||||||
|
var logsname = config.options.ticket4.name
|
||||||
|
}else if (interaction.customId == "newTicket5"){
|
||||||
|
var ticketName = config.options.ticket5.channel_prefix+ticketNumber
|
||||||
|
var logsname = config.options.ticket5.name
|
||||||
|
}else if (interaction.customId == "newTicket6"){
|
||||||
|
var ticketName = config.options.ticket6.channel_prefix+ticketNumber
|
||||||
|
var logsname = config.options.ticket6.name
|
||||||
}
|
}
|
||||||
|
|
||||||
var Category = config.ticket_system.ticket_category
|
//set category
|
||||||
|
if (config.system.enable_category){
|
||||||
|
var Category = config.system.ticket_category
|
||||||
|
}else{var Category = null}
|
||||||
|
|
||||||
interaction.guild.channels.create(ticketName,{
|
var permissionsArray = []
|
||||||
type:"GUILD_TEXT",
|
|
||||||
parent:Category,
|
|
||||||
permissionOverwrites:[
|
|
||||||
{
|
|
||||||
id:interaction.member.id,
|
|
||||||
type:"member",
|
|
||||||
allow:["ADD_REACTIONS","ATTACH_FILES","EMBED_LINKS","SEND_MESSAGES","VIEW_CHANNEL"]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id:config.botperms_role,
|
|
||||||
type:"role",
|
|
||||||
allow:["ADD_REACTIONS","ATTACH_FILES","EMBED_LINKS","SEND_MESSAGES","VIEW_CHANNEL"]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id:config.ticket_system.member_role,
|
|
||||||
type:"role",
|
|
||||||
deny:["VIEW_CHANNEL"]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}).then(tChannel => {
|
|
||||||
userTicketStorage.setItem(tChannel.id,interaction.member.id)
|
|
||||||
|
|
||||||
|
//set everyone allowed
|
||||||
var ticketEmbed = new discord.MessageEmbed()
|
if (config.system['has@everyoneaccess']){
|
||||||
.setColor(config.main_color)
|
var everyoneAllowPerms = ["ADD_REACTIONS","ATTACH_FILES","EMBED_LINKS","SEND_MESSAGES","VIEW_CHANNEL"]
|
||||||
|
var everyoneDenyPerms = []
|
||||||
if (interaction.customId == "newTicketVraag"){
|
}else{
|
||||||
ticketEmbed.setDescription("**Ticket gemaakt:**\nJe hebt gekozen voor **overige vragen**, zeg alvast maar je vraag, onze staffleden komen u zo helpen.\n\n_Klik op knop hieronder om dit ticket te sluiten_")
|
var everyoneAllowPerms = []
|
||||||
}else if (interaction.customId == "newTicketSolli"){
|
var everyoneDenyPerms = ["VIEW_CHANNEL"]
|
||||||
ticketEmbed.setDescription("**Ticket gemaakt:**\nJe hebt gekozen voor **sollicitatie**, neem maar tijd om u sollicitatie brief voor te bereiden. Met de `!solli` command kan je zien wat je allemaal moet zeggen.\n\n_Klik op knop hieronder om dit ticket te sluiten_")
|
}
|
||||||
}else if (interaction.customId == "newTicketPartner"){
|
permissionsArray.push({
|
||||||
ticketEmbed.setDescription("**Ticket gemaakt:**\nJe hebt gekozen voor **partner**, neem maar tijd om u partner brief voor te bereiden. Met de `!partner` command kan je zien wat de vereisen zijn.\n\n_Klik op knop hieronder om dit ticket te sluiten_")
|
id:interaction.member.id,
|
||||||
}
|
type:"member",
|
||||||
|
allow:["ADD_REACTIONS","ATTACH_FILES","EMBED_LINKS","SEND_MESSAGES","VIEW_CHANNEL"]
|
||||||
tChannel.send({content:"<@"+interaction.member.id+"> <@&"+config.botperms_role+">",embeds:[ticketEmbed],components:[closeButton]}).then(firstmsg => {
|
})
|
||||||
firstmsg.pin()
|
permissionsArray.push({
|
||||||
})
|
id:config.botperms_role,
|
||||||
|
type:"role",
|
||||||
|
allow:["ADD_REACTIONS","ATTACH_FILES","EMBED_LINKS","SEND_MESSAGES","VIEW_CHANNEL"]
|
||||||
|
})
|
||||||
|
permissionsArray.push({
|
||||||
|
id:interaction.guild.id,
|
||||||
|
type:"role",
|
||||||
|
allow:everyoneAllowPerms,
|
||||||
|
deny:everyoneDenyPerms
|
||||||
|
})
|
||||||
|
if (config.system.member_role == "" || config.system.member_role == " " || config.system.member_role == "false" || config.system.member_role == "null" || config.system.member_role == "0"){
|
||||||
|
permissionsArray.push({
|
||||||
|
id:config.system.member_role,
|
||||||
|
type:"role",
|
||||||
|
deny:["VIEW_CHANNEL"]
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
//create the channel
|
||||||
|
interaction.guild.channels.create(ticketName,{
|
||||||
|
type:"GUILD_TEXT",
|
||||||
|
parent:Category,
|
||||||
|
permissionOverwrites:permissionsArray
|
||||||
|
}).then(tChannel => {
|
||||||
|
userTicketStorage.setItem(tChannel.id,interaction.member.id)
|
||||||
|
|
||||||
|
|
||||||
|
var ticketEmbed = new discord.MessageEmbed()
|
||||||
|
if (config.layout.ticketEmbed.customColorEnabled){
|
||||||
|
ticketEmbed.setColor(config.layout.ticketEmbed.customColor)
|
||||||
|
}else{ticketEmbed.setColor(config.main_color)}
|
||||||
|
|
||||||
|
if (config.layout.ticketEmbed.footerEnabled){
|
||||||
|
ticketEmbed.setFooter({text:"config.layout.ticketEmbed.footer"})
|
||||||
|
}
|
||||||
|
if (config.layout.ticketEmbed.thumbnailEnabled){
|
||||||
|
ticketEmbed.setThumbnail(config.layout.ticketEmbed.thumbnailURL)
|
||||||
|
}
|
||||||
|
ticketEmbed.setTitle("You created a ticket!")
|
||||||
|
ticketEmbed.setDescription(config.messages.ticket.newTicketEmbed)
|
||||||
|
|
||||||
|
tChannel.send({content:"<@"+interaction.member.id+"> <@&"+config.botperms_role+">",embeds:[ticketEmbed],components:[closeButton]}).then(firstmsg => {
|
||||||
|
firstmsg.pin()
|
||||||
|
})
|
||||||
|
if (config.logs){console.log("[system] created a new ticket (name:"+logsname+",user:"+interaction.user.username+")")}
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
try {
|
try {
|
||||||
interaction.member.send("**Je hebt al een ticket open!**")
|
if (config.system.enable_DM_Messages){
|
||||||
|
interaction.member.send(config.messages.dm.alreadyCreated)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch{console.log("cant send DM to member")}
|
catch{console.log("can't send DM to member || member doesn't allow dm's")}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -111,6 +151,7 @@ module.exports = () => {
|
|||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
//closeBAR
|
||||||
var closeBar = new discord.MessageActionRow()
|
var closeBar = new discord.MessageActionRow()
|
||||||
.addComponents(
|
.addComponents(
|
||||||
new discord.MessageButton()
|
new discord.MessageButton()
|
||||||
@@ -168,15 +209,25 @@ module.exports = () => {
|
|||||||
var getuserID = userTicketStorage.getItem(interaction.channel.id)
|
var getuserID = userTicketStorage.getItem(interaction.channel.id)
|
||||||
var getusernameStep1 = client.users.cache.find(u => u.id === getuserID)
|
var getusernameStep1 = client.users.cache.find(u => u.id === getuserID)
|
||||||
if (getusernameStep1 == null || getusernameStep1 == undefined || getusernameStep1 == false || getusernameStep1 == ""){
|
if (getusernameStep1 == null || getusernameStep1 == undefined || getusernameStep1 == false || getusernameStep1 == ""){
|
||||||
var getuserNAME = ":user niet in database:"
|
var getuserNAME = ":usernotfound:"
|
||||||
}else {
|
}else {
|
||||||
var getuserNAME = getusernameStep1.username
|
var getuserNAME = getusernameStep1.username
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (config.system.enable_transcript){
|
||||||
var transcript = transcriptArray.reverse().join("\n")
|
var transcript = transcriptArray.reverse().join("\n")
|
||||||
transcriptStorage.setItem(interaction.channel.id,transcript)
|
transcriptStorage.setItem(interaction.channel.id,transcript)
|
||||||
|
|
||||||
|
//transcript color & thumbnail
|
||||||
|
if (config.layout.transcripts.customColorEnabled){
|
||||||
|
var transcriptColor = config.layout.transcripts.customColor
|
||||||
|
}else{var transcriptColor = config.main_color}
|
||||||
|
|
||||||
|
if (config.layout.transcripts.thumbnailEnabled){
|
||||||
|
var transcriptThumbnail = config.layout.transcripts.thumbnailURL
|
||||||
|
}else{var transcriptThumbnail = ""}
|
||||||
|
|
||||||
var splittedTranscript = [transcript.slice(0,2000)]
|
var splittedTranscript = [transcript.slice(0,2000)]
|
||||||
if (transcript.length > 4000){
|
if (transcript.length > 4000){
|
||||||
splittedTranscript.push(transcript.slice(2000,4000))
|
splittedTranscript.push(transcript.slice(2000,4000))
|
||||||
@@ -185,52 +236,62 @@ module.exports = () => {
|
|||||||
splittedTranscript.push(transcript.slice(2000))
|
splittedTranscript.push(transcript.slice(2000))
|
||||||
}
|
}
|
||||||
var transcriptEmbed = new discord.MessageEmbed()
|
var transcriptEmbed = new discord.MessageEmbed()
|
||||||
.setColor(config.main_color)
|
.setColor(transcriptColor)
|
||||||
.setAuthor(interaction.channel.name + " - ticket gemaakt door "+getuserNAME)
|
.setAuthor({name:interaction.channel.name + " - ticket created by "+getuserNAME})
|
||||||
.setTitle("Er is een nieuw transcript!")
|
.setTitle("There is a new transcript!")
|
||||||
.setDescription(splittedTranscript[0])
|
.setDescription(splittedTranscript[0])
|
||||||
.setFooter("ticket gesloten door "+interaction.member.user.username)
|
.setFooter({text:"ticket closed by "+interaction.member.user.username})
|
||||||
|
.setThumbnail(transcriptThumbnail)
|
||||||
|
|
||||||
if (transcript.length > 4000){
|
if (transcript.length > 4000){
|
||||||
var transcriptEmbed2 = new discord.MessageEmbed()
|
var transcriptEmbed2 = new discord.MessageEmbed()
|
||||||
.setColor(config.main_color)
|
.setColor(transcriptColor)
|
||||||
.setAuthor(interaction.channel.name + " - ticket gemaakt door "+getuserNAME)
|
.setAuthor({name:interaction.channel.name + " - ticket created by "+getuserNAME})
|
||||||
.setTitle("Deel 2 van het transcript")
|
.setTitle("transcript #2")
|
||||||
.setDescription(splittedTranscript[1])
|
.setDescription(splittedTranscript[1])
|
||||||
.setFooter("ticket gesloten door "+interaction.member.user.username)
|
.setFooter("ticket closed by "+interaction.member.user.username)
|
||||||
|
.setThumbnail(transcriptThumbnail)
|
||||||
|
|
||||||
var transcriptEmbed3 = new discord.MessageEmbed()
|
var transcriptEmbed3 = new discord.MessageEmbed()
|
||||||
.setColor(config.main_color)
|
.setColor(transcriptColor)
|
||||||
.setAuthor(interaction.channel.name + " - ticket gemaakt door "+getuserNAME)
|
.setAuthor({name:interaction.channel.name + " - ticket created by "+getuserNAME})
|
||||||
.setTitle("Deel 3 van het transcript")
|
.setTitle("transcript #3")
|
||||||
.setDescription(splittedTranscript[1])
|
.setDescription(splittedTranscript[1])
|
||||||
.setFooter("ticket gesloten door "+interaction.member.user.username)
|
.setFooter({text:"ticket closed by "+interaction.member.user.username})
|
||||||
|
.setThumbnail(transcriptThumbnail)
|
||||||
|
|
||||||
client.channels.cache.find(ch => ch.id == config.ticket_system.transcript_channel).send({embeds:[transcriptEmbed,transcriptEmbed2,transcriptEmbed3]})
|
client.channels.cache.find(ch => ch.id == config.system.transcript_channel).send({embeds:[transcriptEmbed,transcriptEmbed2,transcriptEmbed3]})
|
||||||
|
|
||||||
}else if (transcript.length > 2000){
|
}else if (transcript.length > 2000){
|
||||||
var transcriptEmbed2 = new discord.MessageEmbed()
|
var transcriptEmbed2 = new discord.MessageEmbed()
|
||||||
.setColor(config.main_color)
|
.setColor(transcriptColor)
|
||||||
.setAuthor(interaction.channel.name + " - ticket gemaakt door "+getuserNAME)
|
.setAuthor({name:interaction.channel.name + " - ticket created by "+getuserNAME})
|
||||||
.setTitle("Deel 2 van het transcript")
|
.setTitle("transcript #2")
|
||||||
.setDescription(splittedTranscript[1])
|
.setDescription(splittedTranscript[1])
|
||||||
.setFooter("ticket gesloten door "+interaction.member.user.username)
|
.setFooter({text:"ticket closed by "+interaction.member.user.username})
|
||||||
|
.setThumbnail(transcriptThumbnail)
|
||||||
|
|
||||||
client.channels.cache.find(ch => ch.id == config.ticket_system.transcript_channel).send({embeds:[transcriptEmbed,transcriptEmbed2]})
|
client.channels.cache.find(ch => ch.id == config.system.transcript_channel).send({embeds:[transcriptEmbed,transcriptEmbed2]})
|
||||||
}else{
|
}else{
|
||||||
client.channels.cache.find(ch => ch.id == config.ticket_system.transcript_channel).send({embeds:[transcriptEmbed]})
|
client.channels.cache.find(ch => ch.id == config.system.transcript_channel).send({embeds:[transcriptEmbed]})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
interaction.channel.delete()
|
interaction.channel.delete()
|
||||||
|
if (config.logs){console.log("[system] closed a ticket (name:"+interaction.channel.name+",user:"+interaction.user.username+")")}
|
||||||
|
|
||||||
|
|
||||||
ticketStorage.setItem(getuserID,"false")
|
|
||||||
|
ticketStorage.setItem(getuserID,Number(ticketStorage.getItem(getuserID)) - 1)
|
||||||
|
|
||||||
try {
|
try {
|
||||||
interaction.member.send("**Je ticket is gesloten door "+interaction.member.user.username+"!**")
|
if (config.system.enable_DM_Messages){
|
||||||
|
interaction.member.send(config.messages.dm.closeTicket)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch{console.log("cant send DM to member")}
|
catch{console.log("can't send DM to member || member doesn't allow dm's")}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+123
-8
@@ -1,17 +1,132 @@
|
|||||||
{
|
{
|
||||||
"server_name":"Ticket Bot Land",
|
|
||||||
"server_logo":"https://www.example.com/another-example/yourlogo.png",
|
|
||||||
"bot_name":"Wumpus",
|
"bot_name":"Wumpus",
|
||||||
"main_color":"#fffff",
|
"main_color":"#fffff",
|
||||||
"auth_token":"the bot's auth token",
|
"auth_token":"the bot's auth token",
|
||||||
"botperms_role":"the id from a role that can do anything with the bot",
|
"botperms_role":"the id from an admin role (they can do admin things with the bot)",
|
||||||
|
"prefix":"!",
|
||||||
|
"logs":true,
|
||||||
|
|
||||||
"ticket_msg":{
|
"credits":true,
|
||||||
"ticket_channel":"id of the channel with the !ticket msg"
|
"status":{
|
||||||
|
"enabled":true,
|
||||||
|
"type":"PLAYING | LISTENING | WATCHING | CUSTOM",
|
||||||
|
"text":"!ticket"
|
||||||
},
|
},
|
||||||
"ticket_system":{
|
|
||||||
|
"system":{
|
||||||
|
"ticket_channel":"id of the channel with the !ticket msg",
|
||||||
|
"max_allowed_tickets":5,
|
||||||
|
"enable_DM_Messages":true,
|
||||||
|
|
||||||
|
"enable_category":false,
|
||||||
"ticket_category":"the id of a category for the tickets",
|
"ticket_category":"the id of a category for the tickets",
|
||||||
"member_role":"this role doesn't have access to tickets (WARNING: @everyone does have access to tickets, so make sure all members have a member role!)",
|
|
||||||
"transcript_channel":"the channel for transcripts (REQUIRED,or else the bot will crash)"
|
"has@everyoneaccess":false,
|
||||||
|
"member_role":"this role doesn't have access to tickets",
|
||||||
|
|
||||||
|
"enable_transcript":false,
|
||||||
|
"transcript_channel":"the channel for transcripts"
|
||||||
|
},
|
||||||
|
|
||||||
|
"messages":{
|
||||||
|
"general":{
|
||||||
|
"nopermissions":"**You don't have permissions to run this command!**"
|
||||||
|
},
|
||||||
|
"dm":{
|
||||||
|
"alreadyCreated":"**You currently have as many open tickets as the maximum allowed!**",
|
||||||
|
"newTicket":"You created a new ticket in our server, the staff will come and help you soon!",
|
||||||
|
"closeTicket":"**Your ticket is closed!**"
|
||||||
|
},
|
||||||
|
"ticket":{
|
||||||
|
"newTicketEmbed":"You created a ticket!\n\n_Click on the close button below to close this ticket_"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
"layout":{
|
||||||
|
"transcripts":{
|
||||||
|
"customColorEnabled":false,
|
||||||
|
"customColor":"#ffffff",
|
||||||
|
"thumbnailEnabled":false,
|
||||||
|
"thumbnailURL":"https://www.example.com/path/to/image.png"
|
||||||
|
},
|
||||||
|
"ticketMsg":{
|
||||||
|
"customColorEnabled":false,
|
||||||
|
"customColor":"#ffffff",
|
||||||
|
"footerEnabled":false,
|
||||||
|
"footer":"We are using open-tickets from DJj123dj",
|
||||||
|
"thumbnailEnabled":false,
|
||||||
|
"thumbnailURL":"https://www.example.com/path/to/image.png"
|
||||||
|
},
|
||||||
|
"ticketEmbed":{
|
||||||
|
"customColorEnabled":false,
|
||||||
|
"customColor":"#ffffff",
|
||||||
|
"footerEnabled":false,
|
||||||
|
"footer":"This is embed in the start of a ticket.",
|
||||||
|
"thumbnailEnabled":false,
|
||||||
|
"thumbnailURL":"https://www.example.com/path/to/image.png"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
"options":{
|
||||||
|
"ticket1":{
|
||||||
|
"enabled":true,
|
||||||
|
"icon":"🎫",
|
||||||
|
"description":"Create a general ticket.",
|
||||||
|
"name":"Ticket",
|
||||||
|
"channel_prefix":"ticket-",
|
||||||
|
"color":"red | green | blue | gray | none",
|
||||||
|
"isURL":false,
|
||||||
|
"url":"https://www.example.com/a/random/path/to/a/website"
|
||||||
|
},
|
||||||
|
"ticket2":{
|
||||||
|
"enabled":false,
|
||||||
|
"icon":"💼",
|
||||||
|
"description":"Do you want to apply? Then click here!",
|
||||||
|
"name":"Apply",
|
||||||
|
"channel_prefix":"apply-",
|
||||||
|
"color":"red | green | blue | gray | none",
|
||||||
|
"isURL":false,
|
||||||
|
"url":"https://www.example.com/a/random/path/to/a/website"
|
||||||
|
},
|
||||||
|
"ticket3":{
|
||||||
|
"enabled":false,
|
||||||
|
"icon":"❓",
|
||||||
|
"description":"Click here if you have a question about the server.",
|
||||||
|
"name":"Question",
|
||||||
|
"channel_prefix":"question-",
|
||||||
|
"color":"red | green | blue | gray | none",
|
||||||
|
"isURL":false,
|
||||||
|
"url":"https://www.example.com/a/random/path/to/a/website"
|
||||||
|
},
|
||||||
|
"ticket4":{
|
||||||
|
"enabled":false,
|
||||||
|
"icon":"🛒",
|
||||||
|
"description":"Buy something in our shop.",
|
||||||
|
"name":"Shop",
|
||||||
|
"channel_prefix":"shop-",
|
||||||
|
"color":"red | green | blue | gray | none",
|
||||||
|
"isURL":false,
|
||||||
|
"url":"https://www.example.com/a/random/path/to/a/website"
|
||||||
|
},
|
||||||
|
"ticket5":{
|
||||||
|
"enabled":false,
|
||||||
|
"icon":"😄",
|
||||||
|
"description":"hello",
|
||||||
|
"name":"AnotherTicket",
|
||||||
|
"channel_prefix":"prefix-",
|
||||||
|
"color":"red | green | blue | gray | none",
|
||||||
|
"isURL":false,
|
||||||
|
"url":"https://www.example.com/a/random/path/to/a/website"
|
||||||
|
},
|
||||||
|
"ticket6":{
|
||||||
|
"enabled":false,
|
||||||
|
"icon":"😄",
|
||||||
|
"description":"hello",
|
||||||
|
"name":"AnotherTicket",
|
||||||
|
"channel_prefix":"prefix-",
|
||||||
|
"color":"red | green | blue | gray | none",
|
||||||
|
"isURL":false,
|
||||||
|
"url":"https://www.example.com/a/random/path/to/a/website"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,96 @@
|
|||||||
|
# changelog
|
||||||
|
|
||||||
|
## v1.3.2
|
||||||
|
### added:
|
||||||
|
- an alias for !resetdatabase: !resetdb
|
||||||
|
- you need the "chalk" library now!
|
||||||
|
- checker.js
|
||||||
|
- "enabled" option for status
|
||||||
|
- better console logs
|
||||||
|
- enable logs option to config
|
||||||
|
### fixed
|
||||||
|
- a bug that crashed the bot on using the command !resetdatabase
|
||||||
|
- "member_role" in config is optional but not recommended
|
||||||
|
- fixed crash on startup
|
||||||
|
- fixed bug where the bot crashes by using transcripts
|
||||||
|
- changed package.json
|
||||||
|
### removed
|
||||||
|
- "canvas" library is not longer required
|
||||||
|
- removed "server_icon" & "server_name" from config
|
||||||
|
|
||||||
|
## v1.3.1
|
||||||
|
### added:
|
||||||
|
- Q&A in the README.md
|
||||||
|
- v1.4.0 announcement
|
||||||
|
### fixed
|
||||||
|
- a bug that happend when you created too much tickets
|
||||||
|
- deprecation warnings (setAuthor & setFooter)
|
||||||
|
- the logo in README.md is smaller now
|
||||||
|
- markdown files relocated
|
||||||
|
- fixed a bug that some messages appeared in Dutch
|
||||||
|
### removed
|
||||||
|
- nothing
|
||||||
|
|
||||||
|
## v1.3.0
|
||||||
|
### added:
|
||||||
|
- now its possible to create 6 tickets instead of 4
|
||||||
|
- you can edit the number of tickets per user now
|
||||||
|
- you can edit & enable/disable all messages
|
||||||
|
- all embeds are now editable
|
||||||
|
- the color of the button can be changed
|
||||||
|
- updated config.json
|
||||||
|
- updated README.md
|
||||||
|
- a new type of button is here: website links
|
||||||
|
### fixed
|
||||||
|
- nothing at the moment :)
|
||||||
|
### removed
|
||||||
|
- nothing
|
||||||
|
|
||||||
|
## v1.2.2
|
||||||
|
### added:
|
||||||
|
- nothing
|
||||||
|
### fixed:
|
||||||
|
- a bug that caused the `warn "message" event deprecated` to be displayed every time you start the bot in the console.
|
||||||
|
- a visual bug that caused the categories from `!ticket msg` to be displayed in a wrong pattern.
|
||||||
|
### removed:
|
||||||
|
- nothing
|
||||||
|
|
||||||
|
## v1.2.1
|
||||||
|
### added:
|
||||||
|
- you can disable credits in config.json
|
||||||
|
### fixed:
|
||||||
|
- a bug that crashed the bot on startup
|
||||||
|
### removed
|
||||||
|
- nothing
|
||||||
|
|
||||||
|
## v1.2.0
|
||||||
|
### added:
|
||||||
|
- the bot is in english now
|
||||||
|
- you can choose your own ticket options now
|
||||||
|
- added !resetdatabase
|
||||||
|
- updated README.md
|
||||||
|
### fixed:
|
||||||
|
- the first bugs
|
||||||
|
### removed:
|
||||||
|
- some useless commands
|
||||||
|
|
||||||
|
## v1.1.1
|
||||||
|
### added:
|
||||||
|
- added "status" options in config.json
|
||||||
|
### fixed:
|
||||||
|
- fixed a bug where the bot's status could be "playing highmt".
|
||||||
|
### removed:
|
||||||
|
- nothing
|
||||||
|
|
||||||
|
## v1.1.0
|
||||||
|
### added:
|
||||||
|
- option to choose your own prefix
|
||||||
|
- enable/disable transcripts
|
||||||
|
- enable/disable categories
|
||||||
|
### fixed:
|
||||||
|
- the bot crashed sometimes
|
||||||
|
### removed:
|
||||||
|
- credits
|
||||||
|
|
||||||
|
## v1.0.0
|
||||||
|
- initial release
|
||||||
@@ -0,0 +1,68 @@
|
|||||||
|
# config file
|
||||||
|
[](https://discord.com/invite/26vT9wt3n3)
|
||||||
|
[](https://github.com/DJj123dj/open-ticket/releases/tag/v1.3.2)
|
||||||
|
[](#packages)
|
||||||
|
[](https://github.com/DJj123dj/open-ticket/blob/main/LICENSE)
|
||||||
|
|
||||||
|
In this file you find all the information about commands in the config.json file
|
||||||
|
|
||||||
|
|
||||||
|
- bot_name ➜ the name from the bot _**type: string**_
|
||||||
|
- main_color ➜ the color used in embeds _**type: hex color (#000000)**_
|
||||||
|
- auth_token ➜ your bot's token _**type: string**_
|
||||||
|
- botperms_role ➜ this role can do all admin commands from the bot _**type: discord role id**_
|
||||||
|
- prefix ➜ the prefix _**type: string**_
|
||||||
|
- logs ➜ enable logs _**type: boolean**_
|
||||||
|
- credits ➜ disable the credits _**type: boolean**_
|
||||||
|
|
||||||
|
## status: (the status from the bot)
|
||||||
|
- enabled ➜ enable status _**type: boolean**_
|
||||||
|
- type ➜ set the status type _**type: string (PLAYING | LISTENING | WATCHING | CUSTOM)**
|
||||||
|
- text ➜ set the status text _**type: string**_
|
||||||
|
|
||||||
|
## system: (the configuration for the ticket system)
|
||||||
|
- ticket_channel ➜ channel where you are going to set `!ticket msg` _**type: discord channel id**_
|
||||||
|
- max_allowed_tickets ➜ the maximum allowed tickets per person _**type: number**_
|
||||||
|
- enable_DM_Messages ➜ enable DM messages _**type: boolean**_
|
||||||
|
- enable_category ➜ enable category _**type: boolean**_
|
||||||
|
- ticket_category ➜ the category id _**type: discord category id**_
|
||||||
|
- has@everyoneaccess ➜ when enabled everyone has acces to the tickets _**type: boolean**_
|
||||||
|
- member_role ➜ this role doesn't have access to tickets _**type: discord role id**_
|
||||||
|
- enable_transcript ➜ enable the transcript _**type: boolean**_
|
||||||
|
- transcript_channel ➜ the transcript channel id _**type: discord channel id**_
|
||||||
|
|
||||||
|
## messages: (general, dm, ticket)
|
||||||
|
- nopermissions ➜ the message when someone doesn't have permissions _**type: string**_
|
||||||
|
- alreadyCreated ➜ if you have too much tickets open _**type: string**_
|
||||||
|
- newTicket ➜ when you create a new ticket _**type: string**_
|
||||||
|
- closeTicket ➜ when you close a ticket _**type: string**_
|
||||||
|
- newTicketEmbed ➜ the first message in the ticket channel _**type: string**
|
||||||
|
|
||||||
|
## layout: (ticketEmbed, ticketMsg, transcript)
|
||||||
|
`transcript` doesn't have all the options
|
||||||
|
|
||||||
|
- customColorEnabled ➜ custom embed color enabled _**type: boolean**
|
||||||
|
- customColor ➜ the custom color _**type: hex color (#000000)**
|
||||||
|
- footerEnabled ➜ custom footer enabled _**type: boolean**
|
||||||
|
- footer ➜ the custom footer _**type: string**
|
||||||
|
- thumbnailEnabled ➜ custom thumbnail enabled _**type: boolean**
|
||||||
|
- thumbnailURL ➜ the image _**type: string**
|
||||||
|
|
||||||
|
## options: (per ticket)
|
||||||
|
color is not needed when `isURL` is `true`
|
||||||
|
|
||||||
|
- enabled ➜ enable this ticket _**type: boolean**
|
||||||
|
- icon ➜ the button emoji _**type: emoji or custom emoji**
|
||||||
|
- description ➜ ticket description _**type: string**
|
||||||
|
- name ➜ ticket name _**type: string**
|
||||||
|
- channel_prefix ➜ ticket prefix _**type: string**
|
||||||
|
- color ➜ button color _**type: string (red|green|blue|gray|none)**
|
||||||
|
- isURL ➜ create link to a website instead of a normal ticket _**type: boolean**
|
||||||
|
- url ➜ the website to go to _**type: string**
|
||||||
|
|
||||||
|
# thanks for using open-ticket
|
||||||
|
I didn't know that open-tickets was going to be so much used. I will be creating more updates in the future!
|
||||||
|
|
||||||
|
If you have an idea for new updates you can always say it in my discord server!
|
||||||
|
|
||||||
|
open-tickets v1.3.2
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
# Question & Answer
|
||||||
|
## How to install node.js 16?
|
||||||
|
You can install the latest version of node.js on their [website](https://nodejs.org/en/download/). You also need `npm`!
|
||||||
|
|
||||||
|
## How to install all the npm packages?
|
||||||
|
If you installed node.js successful, you can run `npm install` in the command prompt and all the required modules will be installed.
|
||||||
|
|
||||||
|
## Where is the config file documentation?
|
||||||
|
You can find it [here](...)
|
||||||
|
|
||||||
|
**How to start the bot?**
|
||||||
|
If you successfully installed all the npm modules (see above), you can run `npm start`
|
||||||
|
|
||||||
|
## Do I need to know discord.js?
|
||||||
|
Technically not, but it is useful to know if there is an error.
|
||||||
|
|
||||||
|
## Why do I get this error?
|
||||||
|
**Invalid token:**
|
||||||
|
|
||||||
|
_Your discord token is not correct, try to look in the config.json file if it's the correct token._
|
||||||
|
|
||||||
|
**Privileged intent provided is not enabled or whitelisted:**
|
||||||
|
|
||||||
|
_You must enable all the **Gateaway Intents** in the developer panel in the "bot" tab_
|
||||||
|
|
||||||
|
### Report other errors to the discord server!
|
||||||
@@ -4,9 +4,15 @@ const intents = discord.Intents
|
|||||||
const client = new discord.Client({intents:[intents.FLAGS.GUILDS,intents.FLAGS.GUILD_MESSAGES,intents.FLAGS.GUILD_MEMBERS]})
|
const client = new discord.Client({intents:[intents.FLAGS.GUILDS,intents.FLAGS.GUILD_MESSAGES,intents.FLAGS.GUILD_MEMBERS]})
|
||||||
exports.client = client
|
exports.client = client
|
||||||
|
|
||||||
client.on('ready',() => {
|
require("./checker")()
|
||||||
console.log('ready')
|
|
||||||
client.user.setActivity("HighMT",{type:"PLAYING"})
|
client.on('ready',async () => {
|
||||||
|
const chalk = await (await import("chalk")).default
|
||||||
|
console.log(chalk.green("open-ticket ready!"))
|
||||||
|
if (config.logs){chalk.white("\n\nlogs:\n============")}
|
||||||
|
if (config.status.enabled){
|
||||||
|
client.user.setActivity(config.status.text,{type:config.status.type})
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
var storage = require('./storage/storage')
|
var storage = require('./storage/storage')
|
||||||
@@ -24,5 +30,8 @@ ticketSystem()
|
|||||||
var ticketExtra = require("./commands/ticketExtra")
|
var ticketExtra = require("./commands/ticketExtra")
|
||||||
ticketExtra()
|
ticketExtra()
|
||||||
|
|
||||||
|
var database = require('./commands/database')
|
||||||
|
database()
|
||||||
|
|
||||||
|
|
||||||
client.login(config.auth_token)
|
client.login(config.auth_token)
|
||||||
+15
-7
@@ -1,19 +1,27 @@
|
|||||||
{
|
{
|
||||||
"name": "safemt-tickets",
|
"name": "open-ticket",
|
||||||
"version": "1.0.0",
|
"version": "1.3.2",
|
||||||
"description": "",
|
"description": "This is an open-source discord ticket bot, you can configure it and it comes with cool features like a transcript.",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "node index.js",
|
"start": "node index.js",
|
||||||
"test": "echo \"Error: no test specified\" && exit 1"
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
},
|
},
|
||||||
"author": "",
|
"author": "DJdj Development",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"canvas": "^2.8.0",
|
"chalk": "^5.0.1",
|
||||||
"discord.js": "^13.2.0",
|
"discord.js": "^13.6.0",
|
||||||
"express": "^4.17.1",
|
"express": "^4.17.1",
|
||||||
"node": "^16.10.0",
|
"node": "^16.10.0",
|
||||||
"node-localstorage": "^2.2.1"
|
"node-localstorage": "^2.2.1"
|
||||||
}
|
},
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/DJj123dj/open-ticket.git"
|
||||||
|
},
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/DJj123dj/open-ticket/issues"
|
||||||
|
},
|
||||||
|
"homepage": "https://github.com/DJj123dj/open-ticket#readme"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user