You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Haha-Yes/index.js

56 lines
2.2 KiB
JavaScript

const { CommandoClient } = require('discord.js-commando');
const path = require('path');
6 years ago
const { activity, token } = require('./config.json');
6 years ago
const responseObject = require("./reply.json");
6 years ago
const fs = require("fs");
6 years ago
// Prefix and ownerID and invite to support server
const client = new CommandoClient({
6 years ago
commandPrefix: 'haha ',
6 years ago
owner: '267065637183029248',
invite: 'https://discord.gg/SsMCsVY',
});
6 years ago
// Command groups
client.registry
6 years ago
.registerDefaultTypes()
.registerGroups([
['thing', 'some things i guess? i dont know how to name it'],
6 years ago
['admin', 'Commands to make admin life easier'],
['owner', 'Commands the owner can use to manage the bot'],
6 years ago
['fun', 'Fun commands'],
6 years ago
])
.registerDefaultGroups()
.registerDefaultCommands()
.registerCommandsIn(path.join(__dirname, 'commands'));
6 years ago
// Ready messages
6 years ago
client.on('ready', () => {
6 years ago
console.log(`Logged in as ${client.user.tag}! (${client.user.id})`);
6 years ago
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}`);
6 years ago
client.user.setActivity(activity);
6 years ago
const channel = client.channels.get('487766113292124160');
6 years ago
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}`);
6 years ago
});
// when bot join a guild send embeds with detail about it
client.on("guildCreate", guild => {
6 years ago
console.log(`${guild.name}\n${guild.memberCount} users\nOwner: ${guild.owner}`);
const channel = client.channels.get('487766113292124160');
const exampleEmbed = {
color: 0x0099ff,
title: 'New guild!',
description: `${guild.name}\n${guild.memberCount} users\nOwner: ${guild.owner}`,
timestamp: new Date(),
};
channel.send({ embed: exampleEmbed });
})
6 years ago
// Auto respond to messages
// client.on("message", (message) => {
// if(responseObject[message.content]) {
// message.channel.send(responseObject[message.content]);
// }
// });
6 years ago
6 years ago
client.on('error', console.error);
6 years ago
client.login(token);