npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

djs-ticketsystem

v2.1.1

Published

DJS-TicketSystem is a package designed to make creating "tickets" in discord servers easier.

Downloads

46

Readme

DJS-TicketSystem

DJS-TicketSystem is a package designed to make creating "tickets" in discord servers easier

Install

npm install --save djs-ticketsystem

Setup

To setup djs-ticketsystem add this code at the top of your index file

const ticketSystem = require('djs-ticketsystem');

For example:

const ticketSystem = require('djs-ticketsystem');
const { Client } = require('discord.js');

const client = new Client();

client.on('ready', () => console.log('Online!'));

client.on('message', message => {
    if (message.content == '-ticket') {
        message.guild.createTicket({ owner: message.author })
            .catch(console.error);
    };
});

client.login('token');

Create a ticket

<guild>.createTicket({ options }); Where <guild> is the guild class (see below if you are unsure)

Options

name This is the name of the ticket. You can use custom variables here (see below) owner REQUIRED This is the owner of the ticket. It must be a user. category This is the category the the ticket it is. It can be either a id, name, or category object. type This is the type of ticket it is. The default is text. nsfw Boolean to show whether the ticket is nsfw or not. bitrate The bitrate. Voice tickets only. userLimit The user limit. Voice tickets only. permissionOverwrites The permission data for the ticket. position The position of the ticket. rateLimitPerUser The slowmode setting of the ticket. reason The reason for opening the ticket. openMessage.text If you want to send a message in the ticket when it opens. openMessage.embed If you want to send an embed in the ticket when it opens.

The default config is

{
    name: 'ticket-{OWNER.USERNAME}',
    type: 'text',
    nsfw: false,
    permissionOverwrites: [
        {
            id: '{OWNER.ID}',
            allow: ['CREATE_INSTANT_INVITE', 'KICK_MEMBERS', 'BAN_MEMBERS', 'ADMINISTRATOR', 'MANAGE_CHANNELS', 'MANAGE_GUILD', 'ADD_REACTIONS', 'VIEW_AUDIT_LOG', 'PRIORITY_SPEAKER', 'STREAM', 'VIEW_CHANNEL', 'SEND_MESSAGES', 'SEND_TTS_MESSAGES', 'MANAGE_MESSAGES', 'EMBED_LINKS', 'ATTACH_FILES', 'READ_MESSAGE_HISTORY', 'MENTION_EVERYONE', 'USE_EXTERNAL_EMOJIS', 'VIEW_GUILD_INSIGHTS', 'CONNECT', 'SPEAK', 'MUTE_MEMBERS', 'DEAFEN_MEMBERS', 'MOVE_MEMBERS', 'USE_VAD', 'CHANGE_NICKNAME', 'MANAGE_NICKNAMES', 'MANAGE_ROLES', 'MANAGE_WEBHOOKS', 'MANAGE_EMOJIS' ]
        },
        {
            id: '{GUILD.ID}',
            deny: ['CREATE_INSTANT_INVITE', 'KICK_MEMBERS', 'BAN_MEMBERS', 'ADMINISTRATOR', 'MANAGE_CHANNELS', 'MANAGE_GUILD', 'ADD_REACTIONS', 'VIEW_AUDIT_LOG', 'PRIORITY_SPEAKER', 'STREAM', 'VIEW_CHANNEL', 'SEND_MESSAGES', 'SEND_TTS_MESSAGES', 'MANAGE_MESSAGES', 'EMBED_LINKS', 'ATTACH_FILES', 'READ_MESSAGE_HISTORY', 'MENTION_EVERYONE', 'USE_EXTERNAL_EMOJIS', 'VIEW_GUILD_INSIGHTS', 'CONNECT', 'SPEAK', 'MUTE_MEMBERS', 'DEAFEN_MEMBERS', 'MOVE_MEMBERS', 'USE_VAD', 'CHANGE_NICKNAME', 'MANAGE_NICKNAMES', 'MANAGE_ROLES', 'MANAGE_WEBHOOKS', 'MANAGE_EMOJIS' ]
            }
    ],
    openMessage: {
        embed: new MessageEmbed().setColor('RANDOM').setDescription('Welcome to your ticket {OWNER}')
    },
}

Custom variables

There are custom variables built in that allow for easily including data in messages. You are able to use them on permissionOverwrites id as seen above, and in the openingMessage embed and/or text. {OWNER} Used if you want to mention the owner {OWNER.USERNAME} Used if you want to display the owner's username {OWNER.TAG} Used if you want to display the owner's tag {OWNER.DISCRIMINATOR} Used if you want to display the owner's discriminator {OWNER.ID} Used if you want to display the owner's id {GUILD} Used if you want to display the guild {GUILD.ID} Used if you want to display the guild's id {GUILD.NAME} Used if you want to display the guild's name

Examples of where to create a ticket

client.on('message', message => {
    if (message.content == '-ticket') {
        message.guild.createTicket({ owner: message.author })
            .catch(console.error);
    };
});

Other Methods

<channel>.isTicket() For Example

client.on('message', message => {
    if (message.content == 'close' && message.channel.isTicket()) {
        console.log('Closed a ticket channel!');
        message.channel.delete();
    }
});

ticketSystem.defaults({ options }) You are able to edit the default options using this method For Example

const ticketSystem = require('djs-ticketsystem');

ticketSystem.defaults({
    name: 'ticket-{OWNER.USERNAME}-{OWNER.DISCRIMINATOR}'
});

Support

You can message me on discord: GHOST#7524 or create a issue on the github