added reactionRoles & changed links to wiki
The reaction roles work now!
This commit is contained in:
@@ -11,7 +11,7 @@ This is an open-source discord ticket bot, you can configure it and it comes wit
|
|||||||
|
|
||||||
<img src="logo.png" alt="Open Ticket logo" style="height: 200px; width:200px;"/>
|
<img src="logo.png" alt="Open Ticket logo" style="height: 200px; width:200px;"/>
|
||||||
|
|
||||||
[](./TEMPDOCS.md)
|
[](https://www.github.com/DJj123dj/open-ticket/wiki/q&a)
|
||||||
|
|
||||||
## features
|
## features
|
||||||
- discord interaction buttons
|
- discord interaction buttons
|
||||||
@@ -27,8 +27,8 @@ This is an open-source discord ticket bot, you can configure it and it comes wit
|
|||||||
- uses discord.js 13
|
- uses discord.js 13
|
||||||
- configure your own ticket options
|
- configure your own ticket options
|
||||||
- remove credits if you want
|
- remove credits if you want
|
||||||
- up to 6 tickets at the same time
|
- unlimited tickets at the same time
|
||||||
- change all bot messages
|
- localisation in +5 languages (soon™)
|
||||||
|
|
||||||
## installation
|
## installation
|
||||||
**You need `node.js 16` to run this project!**
|
**You need `node.js 16` to run this project!**
|
||||||
@@ -50,7 +50,7 @@ if there are any errors, you can open an **issue on github** or **contact me in
|
|||||||
|
|
||||||
### config
|
### config
|
||||||
Our config documentation is moved to another file:
|
Our config documentation is moved to another file:
|
||||||
[click here to view](./TEMPDOCS.md)
|
[click here to view](https://www.github.com/DJj123dj/open-ticket/wiki/config-v2.0.0)
|
||||||
|
|
||||||
### intents & permissions
|
### 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
|
||||||
@@ -64,6 +64,6 @@ You can also configure your own permissions
|
|||||||
|
|
||||||
_v2.0.0 unstable_
|
_v2.0.0 unstable_
|
||||||
|
|
||||||
changelog: [click here](./TEMPDOCS.md)
|
changelog: [click here](https://www.github.com/DJj123dj/open-ticket/wiki/Changelog)
|
||||||
|
|
||||||
© 2022 - DJdj Development | [website](https://www.dj-dj.be) | [discord](https://discord.com/invite/26vT9wt3n3)
|
© 2022 - DJdj Development | [website](https://www.dj-dj.be) | [discord](https://discord.com/invite/26vT9wt3n3)
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
const discord = require('discord.js')
|
||||||
|
const bot = require('../index')
|
||||||
|
const client = bot.client
|
||||||
|
const config = bot.config
|
||||||
|
|
||||||
|
const storage = bot.storage
|
||||||
|
|
||||||
|
module.exports = async () => {
|
||||||
|
const chalk = await (await import("chalk")).default
|
||||||
|
|
||||||
|
client.on("interactionCreate",(interaction) => {
|
||||||
|
if (!interaction.isButton()) return
|
||||||
|
if (!interaction.customId.startsWith("newR")) return
|
||||||
|
|
||||||
|
interaction.deferUpdate()
|
||||||
|
|
||||||
|
const optionid = interaction.customId.split("newR")[1]
|
||||||
|
if (!optionid){
|
||||||
|
interaction.reply({content:"This button doesn't exist anymore"})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
const option = require("./utils/getButton").getOption(optionid)
|
||||||
|
/**@type {"add"|"remove"|"add&remove"} */
|
||||||
|
const mode = option.mode
|
||||||
|
const user = interaction.member
|
||||||
|
|
||||||
|
if (mode == "add"){
|
||||||
|
option.roles.forEach((role) => {
|
||||||
|
interaction.guild.members.cache.find(u => u.id == user.id).roles.add(role)
|
||||||
|
console.log("[system] added role",role,"to",user.user.tag)
|
||||||
|
})
|
||||||
|
}else if (mode == "remove"){
|
||||||
|
option.roles.forEach((role) => {
|
||||||
|
interaction.guild.members.cache.find(u => u.id == user.id).roles.remove(role)
|
||||||
|
console.log("[system] removed role",role,"from",user.user.tag)
|
||||||
|
})
|
||||||
|
}else if (mode == "add&remove"){
|
||||||
|
option.roles.forEach((role) => {
|
||||||
|
if (interaction.guild.members.cache.find(u => u.id == user.id).roles.cache.has(role)){
|
||||||
|
interaction.guild.members.cache.find(u => u.id == user.id).roles.remove(role)
|
||||||
|
console.log("[system] removed role",role,"from",user.user.tag)
|
||||||
|
}else {
|
||||||
|
interaction.guild.members.cache.find(u => u.id == user.id).roles.add(role)
|
||||||
|
console.log("[system] added role",role,"to",user.user.tag)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
}catch{
|
||||||
|
interaction.reply({ephemeral:true,content:"Something went wrong! Contact the owner of this bot for more information"})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
@@ -65,6 +65,7 @@ if (process.argv[2] != "slash"){
|
|||||||
require('./core/ticketOpener')()
|
require('./core/ticketOpener')()
|
||||||
require("./core/ticketCloser").runThis()
|
require("./core/ticketCloser").runThis()
|
||||||
require("./core/closebuttons")()
|
require("./core/closebuttons")()
|
||||||
|
require("./core/reactionRoles")()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* We need:
|
* We need:
|
||||||
|
|||||||
Reference in New Issue
Block a user