# Discord-Ticket

- A module allowing the simple creation of a discord ticket with your client supported by Discord.js^14.0.0
- The easiest to use ticket module.
    
## News

- nothing for the moment

## Installation

[![npm](https://img.shields.io/npm/v/discord-ticket-easy)](https://npmjs.org/discord-ticket-easy)

[![NPM](https://nodei.co/npm/discord-ticket-easy.png)](https://npmjs.org/package/discord-ticket-easy)

## Set an api Key

```js
(index.js)

const { Client } = require("discord-ticket-easy");

Client.setApiKey("<your-api-key>")

```

## Setup a new ticket.
```js
const { Setup } = require("discord-ticket-easy");
const Discord = require("discord.js");
const intents = new Discord.IntentsBitField(3276799);
const client = new Discord.Client({intents});

client.on("ready", () => {
    console.log("I'm login !")
});

client.on("interactionCreate", async (interaction) => {

      if (interaction.isChatInputCommand() && interaction.commandName === 'tsetup') {

        let manager = new Setup(bot, {
          interaction: interaction
        })

        manager.setupMessageTicket()
    
    }
});
```

## Setup the interaction

⚠️ The interaction handler must be placed either in a Client.on function which takes "interactionCreate" as a parameter or in a file defined by your bot which retrieves this same parameter. If you enter the handler in a Client.on which supports the "interactionCreate" event and which itself is in a file containing this last parameter, then the handler will not work.

In the example below, the manager is only in the client.on which supports the "interactionCreate" event.

```js
const { Interaction } = require("discord-ticket-easy");
const Discord = require("discord.js");
const intents = new Discord.IntentsBitField(3276799);
const client = new Discord.Client({intents});
  

client.on("ready", () => {
    console.log("I'm login !")
});


client.on("interactionCreate", async (interaction) => {

  new Interaction(client, interaction).start()
})

```

# Other

To contact the owner of this module, you can join his [discord server](discord.gg/DXbpKPk6FX) and ask him a question.\
For anything else, ditto, join his [discord server](discord.gg/DXbpKPk6FX).

*(careful, this discord server is on french!)*