discord-ticket-easy
Version:
- 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.
44 lines (32 loc) • 1.07 kB
JavaScript
// client.js
const fetch = require("node-fetch");
const ClientError = require("./ClientError");
module.exports = class Client {
static apiKey = '';
static data = {};
static async setApiKey(apiKey) {
if (!apiKey || apiKey === null) {
throw new Error("You need apiKey to use the module!")
}
Client.apiKey = apiKey;
await Client.getData()
}
static async isValidApiKey() {
if (!this.apiKey || this.apiKey === null) {
throw new ClientError(400).generate()
}
const reponse = await fetch(`https://vogzcorp-fr-nextjs.vercel.app/api/getkeys/${this.apiKey}`);
const reponse_data = await reponse.json();
if (reponse_data && reponse_data.data.product_name === "discord-ticket-easy") {
return true
} else {
return false
}
}
static async getData() {
const reponse = await fetch(`https://vogzcorp-fr-nextjs.vercel.app/api/getkeys/${this.apiKey}`)
const reponse_data = await reponse.json();
Client.data = reponse_data
return;
}
}