Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const Discord = require("discord.js");
- const config = require("../config.json");
- const fs = require("fs");
- const ticket = require("../data/tickets.json");
- module.exports.run = async (bot, message, args) => {
- if(!ticket[message.author.id]) {
- ticket[message.author.id] = {
- tickets: 0
- };
- }
- let guild = message.guild;
- let curtick = ticket[message.author.id].tickets;
- if(!message.author.bot) return;
- if(curtick === 1) return message.channel.send("You already have a ticket.");
- guild.createChannel(`ticket-${message.author.id}`, {
- type: 'text',
- permissionOverwrites: [
- {
- allow: 'VIEW_CHANNEL',
- id: message.author.id
- },
- {
- deny: 'VIEW_CHANNEL',
- id: guild.id
- },
- {
- allow: 'VIEW_CHANNEL',
- id: '669429112557010944'
- }
- ]
- }).then(ch => {
- message.channel.send(`Your ticket was created in ${ch}`);
- let tickAdd = 0 + 1;
- ticket[message.author.id].tickets = curtick + tickAdd;
- fs.writeFile("../data/tickets.json", JSON.stringify(ticket), (err) => {
- if(err) console.log(err);
- });
- });
- };
- module.exports.help = {
- name: "new",
- aliases: ["ticket"]
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement