Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/derpinou/discord-tickets
Usefull npm for managing tickets
https://github.com/derpinou/discord-tickets
discord javascript nodejs ticket
Last synced: 3 months ago
JSON representation
Usefull npm for managing tickets
- Host: GitHub
- URL: https://github.com/derpinou/discord-tickets
- Owner: Derpinou
- License: mit
- Created: 2020-12-06T20:01:27.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2021-11-13T18:39:28.000Z (about 3 years ago)
- Last Synced: 2024-09-29T09:22:39.207Z (3 months ago)
- Topics: discord, javascript, nodejs, ticket
- Language: TypeScript
- Homepage: https://discord-tickets.js.org
- Size: 67.4 KB
- Stars: 9
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## About
discord-tickets is a powerful [Node.js](https://nodejs.org) module that allows you to manage tickets very easily. Making your bot's code significantly tidier and easier to comprehend.
- Object-oriented
- Performant## Installation
**Node.js 16.6.0 or newer is required.**
```sh-session
npm install discord-tickets
```## Example usage
Init Text Ticket Manager:
```js
const {TicketManager} = require('discord-tickets');client.ticketManager = new TicketManager(client, {
enabled: true,//If Module is enabled
parentId: '696891020146638868',//Ticket's category
staffRole: '613426529623605268',//Role who have access to tickets
closeParentId: '613425648685547544',//Closed's tickets category
channelTopic: true,
storage: './tickets.json',//Storage
ticketCache: true//Save tickets on cache (TicketManager#tickets.get("channelId"))
});
```Init Threads Ticket Manager:
```js
const {ThreadManager} = require('discord-tickets');client.ticketManager = new ThreadManager(client, {
enabled: true,
channelId: "697138785317814292",
staffRole: "613426529623605268",
storage: `./tickets.json`,
ticketCache: true
});
```Create Ticket:
```js
await client.ticketManager.createTicket(message.guild, message.member);
```Get Ticket:
```js
const ticket = client.ticketManager.tickets.get('channelId');
```Close Ticket:
```js
await client.ticketManager.closeTicket(ticket);
//or
await ticket.close();
```ReOpen ticket:
```js
await client.ticketManager.reOpenTicket(ticket);
//or
ticket.reopen();
```Delete Ticket:
```js
await client.ticketManager.deleteTicket(ticket);
//or
ticket.delete();
```Using with Database:
```js
const {TicketManager} = require('discord-tickets');
const db = require('quick.db');class TicketManagerWithDB extends TicketManager {
async getOptions(id){
return db.get(`options_${id}`)
}
async getAllTickets(){
return db.get('tickets')
}
async saveTicketRaws(){
db.set('tickets', JSON.stringify(this.ticketRaws))
return true
}
}client.ticketManager = new TicketManagerWithDB(client);
```## Links
- [Website](https://discord-tickets.js.org/) ([source](https://github.com/Derpinou/discord-tickets-docs))
- [Documentation](https://discord-tickets.js.org/#/docs)
- [Support & Help Discord server](https://discord.gg/ncheNRHFR7)
- [discord.js Discord server](https://discord.gg/djs)
- [Discord API Discord server](https://discord.gg/discord-api)
- [GitHub](https://github.com/Derpinou/discord-tickets)
- [npm](https://www.npmjs.com/package/discord-tickets)