Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Creates automatic question tickets (with close feature) and notifies via reactions.
- //This Discord bot requires the Eris module to run. To install: npm install Eris
- //Get your own bot token at: https://discordapp.com/developers/applications/me
- const token = " ";
- const Eris = require('eris');
- const bot = new Eris(token);
- bot.on("ready", () => {
- process.title = "TicketBot by SmilerRyan | " + bot.user.id + " | " + bot.user.username + "#" + bot.user.discriminator;
- console.log("To create a ticket, ask a question.\nTo close a ticket, type close.\n\nTo ignore ticket creation in specified channels,\ndeny the bot the read messages permission in the channel.\n\nThis bot needs the following permissions:\n- Read messages (to check for questions)\n- Add reactions (to tell them about it)\n- Manage channels (to manage channels)\n\nTicket bot by SmilerRyan\nID: " + bot.user.id + "\n"+bot.user.username + "#" + bot.user.discriminator);
- bot.editStatus("dnd");
- });
- bot.on("messageCreate", (msg) => {
- if(msg.channel.guild != null && msg.author.id != bot.user.id) {
- if(msg.content.startsWith("close") && msg.channel.name.startsWith("ticket-")) {msg.channel.delete();}
- if((msg.content.endsWith("?") && msg.content.length >= 10) && !msg.channel.name.startsWith("ticket-")) {
- msg.channel.guild.createChannel("ticket-" + msg.author.username.replace(/[\W_]+/g," "), "0", "Ticket Created.").then(c => {
- c.editPermission(msg.author.id, 1024, 0, "member", "Ticket Auto-Permissions.");
- c.editPermission(bot.user.id, 1024, 0, "member", "Ticket Auto-Permissions.");
- c.editPermission("450689860710301716", 0, 1024, "role", "Ticket Auto-Permissions.");
- c.createMessage(msg.author.mention + " asks: " + msg.cleanContent);
- });
- msg.addReaction("🎟"); //Add Ticket Reaction
- }}
- });
- bot.connect();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement