Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const Discord = require('discord.js');
- const client = new Discord.Client({
- partials: ["MESSAGE", "CHANNEL"]
- });
- client.commands = new Discord.Collection();
- const cooldowns = new Discord.Collection();
- const { prefix, token } = require('./config.json') // for vps
- const Enmap = require("enmap");
- const invoices = new Enmap({
- name: "invoices",
- autoFetch: true,
- fetchAll: true
- });
- const warnings = new Enmap({
- name: "warnings",
- autoFetch: true,
- fetchAll: true
- })
- const tickets = new Enmap({
- name: "tickets",
- autoFetch: true,
- fetchAll: true
- });
- const fs = require('fs');
- const commandFiles = fs.readdirSync('./commands');
- for (const file of commandFiles) {
- const command = require(`./commands/${file}`);
- client.commands.set(command.name, command);
- }
- client.on('messageReactionAdd', (reaction, user) => {
- if(reaction.message.partial) { reaction.message.fetch(); }
- console.log(reaction.emoji.name);
- })
- client.on('guildMemberAdd', member => {
- const welcomechannel = member.guild.channels.get("621913481620226069");
- const welcomebed = new Discord.MessageEmbed()
- .setTitle(`Welcome ${member.user.tag}`)
- .setDescription(`Welcome ${member} to Endurable Services. Make sure to read <#621913561295487007> before ordering. To order type \`-order\` in <#621924425142370315>.`)
- welcomechannel.send(welcomebed);
- member.roles.add("621914044852338698");
- })
- client.on('ready', async () => {
- console.log("Ready!");
- client.user.setActivity("-new | -order", {type: 'PLAYING'});
- })
- client.on('message', async message => {
- const args = message.content.slice(prefix.length).split(/ +/);
- const commandName = args.shift().toLowerCase();
- if (!client.commands.has(commandName)) return;
- const command = client.commands.get(commandName);
- if (command.args && !args.length) {
- let reply = `You didn't provide any arguments, ${message.author}!`;
- if (command.usage) {
- reply += `\nThe proper usage would be: \`${prefix}${command.name} ${command.usage}\``;
- }
- return message.channel.send(reply);
- }
- try {
- command.execute(client, message, args);
- }
- catch (error) {
- console.error(error);
- message.reply('there was an error trying to execute that command!');
- }
- });
- client.login(token);
- module.exports.invoices = invoices;
- module.exports.tickets = tickets;
- module.exports.warnings = warnings;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement