Reverted back
This commit is contained in:
parent
e6f9453b47
commit
79b65e43e5
5 changed files with 48 additions and 70 deletions
|
@ -1,12 +0,0 @@
|
||||||
module.exports = (client) => {
|
|
||||||
console.log(`${guild.name}\n${guild.memberCount} users\nOwner: ${guild.owner}`);
|
|
||||||
const channel = client.channels.get(statsChannel);
|
|
||||||
const addEmbed = {
|
|
||||||
color: 0x008000,
|
|
||||||
title: 'Someone added the bot! :D YAY',
|
|
||||||
description: `${guild.name}\n${guild.memberCount} users\nOwner: ${guild.owner}`,
|
|
||||||
timestamp: new Date(),
|
|
||||||
};
|
|
||||||
|
|
||||||
channel.send({ embed: addEmbed });
|
|
||||||
};
|
|
|
@ -1,12 +0,0 @@
|
||||||
module.exports = (client) => {
|
|
||||||
console.log(`***BOT KICKED***\n${guild.name}\n${guild.memberCount} users\nOwner: ${guild.owner}\n***BOT KICKED***`);
|
|
||||||
const channel = client.channels.get(statsChannel);
|
|
||||||
const kickEmbed = {
|
|
||||||
color: 0xFF0000,
|
|
||||||
title: 'Someone removed the bot :(',
|
|
||||||
description: `${guild.name}\n${guild.memberCount} users\nOwner: ${guild.owner}`,
|
|
||||||
timestamp: new Date(),
|
|
||||||
};
|
|
||||||
|
|
||||||
channel.send({ embed: kickEmbed });
|
|
||||||
};
|
|
|
@ -1,15 +0,0 @@
|
||||||
const responseObject = require("../reply.json");
|
|
||||||
const { Permissions } = require('discord.js');
|
|
||||||
const flags = [
|
|
||||||
'SEND_MESSAGES'
|
|
||||||
];
|
|
||||||
const permissions = new Permissions(flags);
|
|
||||||
|
|
||||||
module.exports = (client, message) => {
|
|
||||||
// Auto respond to messages
|
|
||||||
let message_content = message.content.toLowerCase();
|
|
||||||
if(responseObject[message_content]) {
|
|
||||||
message.channel.send(responseObject[message_content]);
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,12 +0,0 @@
|
||||||
module.exports = (client) => {
|
|
||||||
const { botID, statsChannel } = require('../config.json');
|
|
||||||
// Send stats to the console
|
|
||||||
console.log(`Logged in as ${client.user.tag}! (${client.user.id})`);
|
|
||||||
console.log(`Ready to serve in ${client.channels.size} channels on ${client.guilds.size} servers, for a total of ${client.users.size} users. ${client.readyAt}`);
|
|
||||||
// Send stats to the "stats" channel in the support server if its not the test bot
|
|
||||||
if (client.user.id == botID) {
|
|
||||||
const channel = client.channels.get(statsChannel);
|
|
||||||
channel.send(`Ready to serve in ${client.channels.size} channels on ${client.guilds.size} servers, for a total of ${client.users.size} users. ${client.readyAt}`);
|
|
||||||
}
|
|
||||||
client.user.setActivity('"haha help" or "@me help" for help');
|
|
||||||
}
|
|
67
index.js
67
index.js
|
@ -1,6 +1,7 @@
|
||||||
const { CommandoClient, Command } = require('discord.js-commando');
|
const { CommandoClient } = require('discord.js-commando');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const { token, prefix, ownerID, supportServer } = require('./config.json');
|
const { token, prefix, botID, statsChannel, ownerID, supportServer } = require('./config.json');
|
||||||
|
const responseObject = require("./reply.json");
|
||||||
const fs = require("fs");
|
const fs = require("fs");
|
||||||
|
|
||||||
// Prefix and ownerID and invite to support server
|
// Prefix and ownerID and invite to support server
|
||||||
|
@ -23,24 +24,52 @@ client.registry
|
||||||
.registerDefaultGroups()
|
.registerDefaultGroups()
|
||||||
.registerDefaultCommands()
|
.registerDefaultCommands()
|
||||||
.registerCommandsIn(path.join(__dirname, 'commands'));
|
.registerCommandsIn(path.join(__dirname, 'commands'));
|
||||||
|
// Ready messages
|
||||||
|
client.on('ready', () => {
|
||||||
|
// Send stats to the console
|
||||||
|
console.log(`Logged in as ${client.user.tag}! (${client.user.id})`);
|
||||||
|
console.log(`Ready to serve in ${client.channels.size} channels on ${client.guilds.size} servers, for a total of ${client.users.size} users. ${client.readyAt}`);
|
||||||
|
// Send stats to the "stats" channel in the support server if its not the test bot
|
||||||
|
if (client.user.id == botID) {
|
||||||
|
const channel = client.channels.get(statsChannel);
|
||||||
|
channel.send(`Ready to serve in ${client.channels.size} channels on ${client.guilds.size} servers, for a total of ${client.users.size} users. ${client.readyAt}`);
|
||||||
|
}
|
||||||
|
client.user.setActivity('"haha help" or "@me help" for help');
|
||||||
|
});
|
||||||
|
// When bot join a guild send embeds with details about it.
|
||||||
|
client.on("guildCreate", guild => {
|
||||||
|
console.log(`${guild.name}\n${guild.memberCount} users\nOwner: ${guild.owner}`);
|
||||||
|
const channel = client.channels.get(statsChannel);
|
||||||
|
const addEmbed = {
|
||||||
|
color: 0x008000,
|
||||||
|
title: 'Someone added the bot! :D YAY',
|
||||||
|
description: `${guild.name}\n${guild.memberCount} users\nOwner: ${guild.owner}`,
|
||||||
|
timestamp: new Date(),
|
||||||
|
};
|
||||||
|
|
||||||
fs.readdir("./events/", (err, files) => {
|
channel.send({ embed: addEmbed });
|
||||||
if (err) return console.error(err);
|
})
|
||||||
files.forEach(file => {
|
// When bot get kicked from a guild send embeds with details about it.
|
||||||
// If the file is not a JS file, ignore it (thanks, Apple)
|
client.on("guildDelete", guild => {
|
||||||
if (!file.endsWith(".js")) return;
|
console.log(`***BOT KICKED***\n${guild.name}\n${guild.memberCount} users\nOwner: ${guild.owner}\n***BOT KICKED***`);
|
||||||
// Load the event file itself
|
const channel = client.channels.get(statsChannel);
|
||||||
const event = require(`./events/${file}`);
|
const kickEmbed = {
|
||||||
// Get just the event name from the file name
|
color: 0xFF0000,
|
||||||
let eventName = file.split(".")[0];
|
title: 'Someone removed the bot :(',
|
||||||
// super-secret recipe to call events with all their proper arguments *after* the `client` var.
|
description: `${guild.name}\n${guild.memberCount} users\nOwner: ${guild.owner}`,
|
||||||
// without going into too many details, this means each event will be called with the client argument,
|
timestamp: new Date(),
|
||||||
// followed by its "normal" arguments, like message, member, etc etc.
|
};
|
||||||
// This line is awesome by the way. Just sayin'.
|
|
||||||
client.on(eventName, event.bind(null, client));
|
channel.send({ embed: kickEmbed });
|
||||||
delete require.cache[require.resolve(`./events/${file}`)];
|
})
|
||||||
});
|
|
||||||
});
|
// Auto respond to messages
|
||||||
|
client.on("message", (message) => {
|
||||||
|
let message_content = message.content.toLowerCase();
|
||||||
|
if(responseObject[message_content]) {
|
||||||
|
message.channel.send(responseObject[message_content]);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
client.on('error', console.error);
|
client.on('error', console.error);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue