Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const Discord = require('discord.js');
- const client = new Discord.Client();
- const auth = require('./auth.json');
- client.on('ready', () => {
- console.log(`Logged in as ${client.user.tag}!`);
- client.user.setActivity('ITS NOT A LIE');
- });
- client.login(auth.token);
- var StaffPanel = '655926844830253089';
- var Welcome = '655897329915658243';
- var CDChannel = '655900238204108808';
- var prefix = '>';
- function spopen() {
- var Fiber = require('fibers');
- function sleep(ms) {
- var fiber = Fiber.current;
- setTimeout(function() {
- fiber.run();
- }, ms);
- Fiber.yield();
- }
- Fiber(function() {
- client.channels.get(StaffPanel).setName("▶ ✅ OPEN ✅");
- }).run();
- }
- function spclosed() {
- var Fiber = require('fibers');
- function sleep(ms) {
- var fiber = Fiber.current;
- setTimeout(function() {
- fiber.run();
- }, ms);
- Fiber.yield();
- }
- Fiber(function() {
- client.channels.get(StaffPanel).setName("▶ ❌ CLOSED ❌");
- }).run();
- }
- client.on('message', message => {
- if (!message.content.startsWith(prefix) || message.author.bot) return;
- const args = message.content.slice(prefix.length).split(/ +/);
- const command = args.shift().toLowerCase();
- if (command === 'closed')
- {
- if(message.member.roles.find(role => role.name ==="Matthew"))
- {
- spclosed();
- client.channels.get(CDChannel).send('Sorry, we are temporarily not accepting any custom art requests at the moment. They will re-open again very soon! We apologize for any inconvenience. @here.')
- }
- if(!message.member.roles.find(role => role.name ==="Matthew"))
- {
- message.channel.send("You do not have permission to use this command.");
- }
- } else if (command === 'open')
- {
- if(message.member.roles.find(role => role.name ==="Matthew"))
- {
- client.channels.get(CDChannel).send('Matthew is currently opened to taking custom art requests. If you would like to submit a request, please head to the <#655897329915658243> channel and react with 📩 @here.')
- spopen();
- }
- if(!message.member.roles.find(role => role.name ==="Matthew"))
- {
- message.channel.send("You do not have permission to use this command.");
- }
- }
- });
- client.on("message", async message => {
- if(message.author.bot) return;
- if(message.content.indexOf(prefix) !== 0) return;
- const args = message.content.slice(prefix.length).trim().split(/ +/g);
- const command = args.shift().toLowerCase();
- if(command === "purge") {
- const deleteCount = parseInt(args[0], 10);
- if(!deleteCount || deleteCount < 2 || deleteCount > 100)
- return message.reply("Please provide a number between 2 and 100 for the number of messages to delete");
- const fetched = await message.channel.fetchMessages({limit: deleteCount});
- message.channel.bulkDelete(fetched)
- .catch(error => message.reply(`Couldn't delete messages because of: ${error}`));
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement