forked from Supositware/Haha-Yes
commit
1e6e47c39b
@ -0,0 +1,21 @@
|
|||||||
|
const { Command } = require('discord-akairo');
|
||||||
|
|
||||||
|
class creditCommand extends Command {
|
||||||
|
constructor() {
|
||||||
|
super('credit', {
|
||||||
|
aliases: ['credit'],
|
||||||
|
category: 'utility',
|
||||||
|
description: {
|
||||||
|
content: 'Show credits for the bot',
|
||||||
|
usage: '(optional) [@user]',
|
||||||
|
examples: ['', '@user']
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async exec(message) {
|
||||||
|
message.channel.send('Thanks to Tina the Cyclops girl#0064 for inspiring me making a bot,\nThanks to discord.js team for making discord.js\nThanks to 1computer1 for making discord-akairo and the help command');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = creditCommand;
|
@ -1,33 +1,49 @@
|
|||||||
const { AkairoClient } = require('discord-akairo');
|
const { AkairoClient, CommandHandler, InhibitorHandler, ListenerHandler } = require('discord-akairo');
|
||||||
const { token, prefix, ownerID, statsChannel } = require('./config.json');
|
const { token, prefix, ownerID } = require('./config.json');
|
||||||
|
|
||||||
const client = new AkairoClient({
|
|
||||||
|
class hahaYesClient extends AkairoClient {
|
||||||
|
constructor() {
|
||||||
|
super({
|
||||||
ownerID: ownerID,
|
ownerID: ownerID,
|
||||||
|
}, {
|
||||||
|
disableEveryone: true
|
||||||
|
});
|
||||||
|
|
||||||
|
this.commandHandler = new CommandHandler(this, {
|
||||||
|
directory: './commands/',
|
||||||
prefix: prefix,
|
prefix: prefix,
|
||||||
|
commandUtil: true,
|
||||||
|
commandUtilLifetime: 60000,
|
||||||
allowMention: true,
|
allowMention: true,
|
||||||
handleEdits: true,
|
handleEdits: true,
|
||||||
|
});
|
||||||
|
|
||||||
|
this.inhibitorHandler = new InhibitorHandler(this, {
|
||||||
|
directory: './inhibitors/',
|
||||||
emitters: {
|
emitters: {
|
||||||
process
|
process
|
||||||
},
|
},
|
||||||
commandUtil: true,
|
|
||||||
commandUtilLifetime: 600000,
|
|
||||||
commandDirectory: './commands/',
|
|
||||||
inhibitorDirectory: './inhibitors/',
|
|
||||||
listenerDirectory: './listeners/'
|
|
||||||
}, {
|
|
||||||
disableEveryone: true
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Ready messages dosent work on the listeners event for some reasons
|
this.listenerHandler = new ListenerHandler(this, {
|
||||||
client.on('ready', async () => {
|
directory: './listeners/'
|
||||||
// Send stats to the console
|
|
||||||
console.log(`\x1b[32mLogged in as \x1b[34m${client.user.tag}\x1b[0m! (\x1b[33m${client.user.id}\x1b[0m)`);
|
|
||||||
console.log(`Ready to serve in \x1b[33m${client.channels.size}\x1b[0m channels on \x1b[33m${client.guilds.size}\x1b[0m servers, for a total of \x1b[33m${client.users.size}\x1b[0m users. \x1b${client.readyAt}\x1b[0m`);
|
|
||||||
// Send stats to the 'stats' channel in the support server if its not the test bot
|
|
||||||
if (client.user.id == 377563711927484418) {
|
|
||||||
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(`${prefix} feedback <feedback> to tell me what you think of the bot! | ${prefix} help`); }
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.listenerHandler.setEmitters({
|
||||||
|
commandHandler: this.commandHandler,
|
||||||
|
inhibitorHandler: this.inhibitorHandler,
|
||||||
|
listenerHandler: this.listenerHandler
|
||||||
|
});
|
||||||
|
|
||||||
|
this.commandHandler.useInhibitorHandler(this.inhibitorHandler);
|
||||||
|
this.commandHandler.useListenerHandler(this.listenerHandler);
|
||||||
|
|
||||||
|
this.listenerHandler.loadAll();
|
||||||
|
this.inhibitorHandler.loadAll();
|
||||||
|
this.commandHandler.loadAll();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const client = new hahaYesClient();
|
||||||
client.login(token);
|
client.login(token);
|
@ -0,0 +1 @@
|
|||||||
|
{}
|
@ -0,0 +1 @@
|
|||||||
|
[]
|
@ -1,16 +0,0 @@
|
|||||||
const { Listener } = require('discord-akairo');
|
|
||||||
|
|
||||||
class UnhandledRejectionListener extends Listener {
|
|
||||||
constructor() {
|
|
||||||
super('unhandledRejection', {
|
|
||||||
eventName: 'unhandledRejection',
|
|
||||||
emitter: 'process'
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
exec(error) {
|
|
||||||
console.error(error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = UnhandledRejectionListener;
|
|
@ -1,50 +1,56 @@
|
|||||||
const { Listener } = require('discord-akairo');
|
const { Listener } = require('discord-akairo');
|
||||||
const Discord = require('discord.js');
|
const { MessageEmbed } = require('discord.js');
|
||||||
const reload = require('auto-reload');
|
const reload = require('auto-reload');
|
||||||
|
let messageID = require('../json/starboard.json');
|
||||||
|
|
||||||
class MessageReactionAddListener extends Listener {
|
class MessageReactionAddListener extends Listener {
|
||||||
constructor() {
|
constructor() {
|
||||||
super('messagereactionadd', {
|
super('messagereactionadd', {
|
||||||
emitter: 'client',
|
emitter: 'client',
|
||||||
eventName: 'messageReactionAdd'
|
event: 'messageReactionAdd'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async exec(reaction, message, client) {
|
async exec(reaction) {
|
||||||
let messageContent = reaction.message.content;
|
let messageContent = reaction.message.content;
|
||||||
let messageAttachments = reaction.message.attachments.map(u=> `${u.url}`);
|
let messageAttachments = reaction.message.attachments.map(u=> `${u.url}`);
|
||||||
|
|
||||||
if (reaction.emoji.name === '🌟' && reaction.count === 4) {
|
if (reaction.emoji.name === '🌟' && reaction.count === 4) {
|
||||||
|
if (messageID.includes(reaction.message.id))
|
||||||
|
return console.log('Message already in starboard!');
|
||||||
|
|
||||||
|
messageID.push(reaction.message.id);
|
||||||
|
|
||||||
let starboardChannel = reload(`../starboard/${reaction.message.guild.id}.json`);
|
let starboardChannel = reload(`../starboard/${reaction.message.guild.id}.json`);
|
||||||
const channel = this.client.channels.get(starboardChannel['starboard']);
|
const channel = this.client.channels.get(starboardChannel['starboard']);
|
||||||
|
|
||||||
const starEmbed = new Discord.RichEmbed()
|
const starEmbed = new MessageEmbed()
|
||||||
.setColor()
|
.setColor()
|
||||||
.setDescription(messageContent)
|
.setDescription(messageContent)
|
||||||
.setAuthor(reaction.message.author.username, reaction.message.author.displayAvatarURL)
|
.setAuthor(reaction.message.author.username, reaction.message.author.displayAvatarURL)
|
||||||
.setTimestamp()
|
.setTimestamp();
|
||||||
|
|
||||||
channel.send({ embed: starEmbed});
|
channel.send({ embed: starEmbed});
|
||||||
return channel.send(`From: ${reaction.message.channel}\n${messageAttachments}`);
|
return channel.send(`From: ${reaction.message.channel} ID: ${reaction.message.id} \n${messageAttachments}`);
|
||||||
}
|
}
|
||||||
if (reaction.emoji.name === '✡' && reaction.count === 4) {
|
if (reaction.emoji.name === '✡' && reaction.count === 4) {
|
||||||
let shameboardChannel = reload(`../starboard/${message.guild.id}.json`);
|
if (messageID.includes(reaction.message.id))
|
||||||
const channel = client.channels.get(shameboardChannel['shameboard']);
|
return console.log('Message already in starboard!');
|
||||||
|
|
||||||
|
messageID.push(reaction.message.id);
|
||||||
|
|
||||||
|
let shameboardChannel = reload(`../starboard/${reaction.message.guild.id}.json`);
|
||||||
|
const channel = this.client.channels.get(shameboardChannel['shameboard']);
|
||||||
|
|
||||||
const starEmbed = new Discord.RichEmbed()
|
const shameEmbed = new MessageEmbed()
|
||||||
.setColor()
|
.setColor()
|
||||||
.setDescription(messageContent)
|
.setDescription(messageContent)
|
||||||
.setAuthor(reaction.message.author.username, reaction.message.author.displayAvatarURL)
|
.setAuthor(reaction.message.author.username, reaction.message.author.displayAvatarURL)
|
||||||
.setTimestamp()
|
.setTimestamp();
|
||||||
|
|
||||||
try {
|
channel.send({ embed: shameEmbed});
|
||||||
channel.send({ embed: starEmbed});
|
return channel.send(`From: ${reaction.message.channel} ID: ${reaction.message.id} \n${messageAttachments}`);
|
||||||
await channel.send(messageAttachments);
|
|
||||||
} catch(err) {
|
|
||||||
console.error('There is no shameboard');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,26 @@
|
|||||||
|
const { Listener } = require('discord-akairo');
|
||||||
|
const { prefix, statsChannel } = require('../config.json');
|
||||||
|
|
||||||
|
|
||||||
|
class ReadyListener extends Listener {
|
||||||
|
constructor() {
|
||||||
|
super('ready', {
|
||||||
|
emitter: 'client',
|
||||||
|
event: 'ready'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async exec() {
|
||||||
|
// Send stats to the console
|
||||||
|
console.log(`\x1b[32mLogged in as \x1b[34m${this.client.user.tag}\x1b[0m! (\x1b[33m${this.client.user.id}\x1b[0m)`);
|
||||||
|
console.log(`Ready to serve in \x1b[33m${this.client.channels.size}\x1b[0m channels on \x1b[33m${this.client.guilds.size}\x1b[0m servers, for a total of \x1b[33m${this.client.users.size}\x1b[0m users. \x1b${this.client.readyAt}\x1b[0m`);
|
||||||
|
// Send stats to the 'stats' channel in the support server if its not the test bot
|
||||||
|
if (this.client.user.id == 377563711927484418) {
|
||||||
|
const channel = this.client.channels.get(statsChannel);
|
||||||
|
channel.send(`Ready to serve in ${this.client.channels.size} channels on ${this.client.guilds.size} servers, for a total of ${this.client.users.size} users. ${this.client.readyAt}`);
|
||||||
|
this.client.user.setActivity(`${prefix} feedback <feedback> to tell me what you think of the bot! | ${prefix} help`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = ReadyListener;
|
@ -1,37 +1,32 @@
|
|||||||
{
|
{
|
||||||
"name": "discordbot",
|
"name": "hahayes",
|
||||||
"version": "1.0.0",
|
"version": "2.1.0",
|
||||||
"description": "A simple discord bot made with discord.js and commando",
|
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"auto-reload": "^0.1.0",
|
"auto-reload": "^0.1.0",
|
||||||
"canvas": "^2.2.0",
|
"canvas": "^2.2.0",
|
||||||
"eslint": "^5.11.1",
|
"discord-akairo": "github:1Computer1/discord-akairo#master",
|
||||||
"eslint-config-standard": "^12.0.0",
|
"discord.js": "github:discordjs/discord.js#master",
|
||||||
"discord.js": "^11.4.2",
|
|
||||||
"eslint-plugin-import": "^2.14.0",
|
|
||||||
"discord-akairo": "^7.5.5",
|
|
||||||
"eslint-plugin-node": "^8.0.0",
|
|
||||||
"eslint-plugin-promise": "^4.0.1",
|
|
||||||
"eslint-plugin-standard": "^4.0.0",
|
|
||||||
"node-fetch": "^2.3.0",
|
"node-fetch": "^2.3.0",
|
||||||
"reload-json": "^0.3.1",
|
"reload-json": "^0.3.1",
|
||||||
"superagent": "^4.1.0",
|
"superagent": "^4.1.0",
|
||||||
"youtube-dl": "^1.12.2"
|
"youtube-dl": "^1.12.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {},
|
"devDependencies": {
|
||||||
"scripts": {
|
"eslint": "^5.11.1",
|
||||||
"test": "echo \"Error: no test specified\" && exit 1"
|
"eslint-config-standard": "^12.0.0",
|
||||||
|
"eslint-plugin-import": "^2.14.0",
|
||||||
|
"eslint-plugin-node": "^8.0.0",
|
||||||
|
"eslint-plugin-promise": "^4.0.1",
|
||||||
|
"eslint-plugin-standard": "^4.0.0"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "git+https://gitlab.com/LoicBersier/DiscordBot.git"
|
"url": "git+https://gitlab.com/LoicBersier/DiscordBot.git"
|
||||||
},
|
},
|
||||||
"keywords": [],
|
|
||||||
"author": "",
|
|
||||||
"license": "ISC",
|
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://gitlab.com/LoicBersier/DiscordBot/issues"
|
"url": "https://gitlab.com/LoicBersier/DiscordBot/issues"
|
||||||
},
|
},
|
||||||
"homepage": "https://gitlab.com/LoicBersier/DiscordBot#readme"
|
"homepage": "https://gitlab.com/LoicBersier/DiscordBot#readme",
|
||||||
|
"description": ""
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue