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 { token, prefix, ownerID, statsChannel } = require('./config.json');
|
||||
|
||||
const client = new AkairoClient({
|
||||
ownerID: ownerID,
|
||||
prefix: prefix,
|
||||
allowMention: true,
|
||||
handleEdits: true,
|
||||
emitters: {
|
||||
process
|
||||
},
|
||||
commandUtil: true,
|
||||
commandUtilLifetime: 600000,
|
||||
commandDirectory: './commands/',
|
||||
inhibitorDirectory: './inhibitors/',
|
||||
listenerDirectory: './listeners/'
|
||||
}, {
|
||||
disableEveryone: true
|
||||
});
|
||||
|
||||
// Ready messages dosent work on the listeners event for some reasons
|
||||
client.on('ready', async () => {
|
||||
// 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`); }
|
||||
});
|
||||
const { AkairoClient, CommandHandler, InhibitorHandler, ListenerHandler } = require('discord-akairo');
|
||||
const { token, prefix, ownerID } = require('./config.json');
|
||||
|
||||
|
||||
class hahaYesClient extends AkairoClient {
|
||||
constructor() {
|
||||
super({
|
||||
ownerID: ownerID,
|
||||
}, {
|
||||
disableEveryone: true
|
||||
});
|
||||
|
||||
this.commandHandler = new CommandHandler(this, {
|
||||
directory: './commands/',
|
||||
prefix: prefix,
|
||||
commandUtil: true,
|
||||
commandUtilLifetime: 60000,
|
||||
allowMention: true,
|
||||
handleEdits: true,
|
||||
});
|
||||
|
||||
this.inhibitorHandler = new InhibitorHandler(this, {
|
||||
directory: './inhibitors/',
|
||||
emitters: {
|
||||
process
|
||||
},
|
||||
});
|
||||
|
||||
this.listenerHandler = new ListenerHandler(this, {
|
||||
directory: './listeners/'
|
||||
});
|
||||
|
||||
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);
|
@ -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 Discord = require('discord.js');
|
||||
const { MessageEmbed } = require('discord.js');
|
||||
const reload = require('auto-reload');
|
||||
let messageID = require('../json/starboard.json');
|
||||
|
||||
class MessageReactionAddListener extends Listener {
|
||||
constructor() {
|
||||
super('messagereactionadd', {
|
||||
emitter: 'client',
|
||||
eventName: 'messageReactionAdd'
|
||||
event: 'messageReactionAdd'
|
||||
});
|
||||
}
|
||||
|
||||
async exec(reaction, message, client) {
|
||||
async exec(reaction) {
|
||||
let messageContent = reaction.message.content;
|
||||
let messageAttachments = reaction.message.attachments.map(u=> `${u.url}`);
|
||||
|
||||
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`);
|
||||
const channel = this.client.channels.get(starboardChannel['starboard']);
|
||||
|
||||
const starEmbed = new Discord.RichEmbed()
|
||||
.setColor()
|
||||
.setDescription(messageContent)
|
||||
.setAuthor(reaction.message.author.username, reaction.message.author.displayAvatarURL)
|
||||
.setTimestamp()
|
||||
const starEmbed = new MessageEmbed()
|
||||
.setColor()
|
||||
.setDescription(messageContent)
|
||||
.setAuthor(reaction.message.author.username, reaction.message.author.displayAvatarURL)
|
||||
.setTimestamp();
|
||||
|
||||
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) {
|
||||
let shameboardChannel = reload(`../starboard/${message.guild.id}.json`);
|
||||
const channel = client.channels.get(shameboardChannel['shameboard']);
|
||||
|
||||
const starEmbed = new Discord.RichEmbed()
|
||||
.setColor()
|
||||
.setDescription(messageContent)
|
||||
.setAuthor(reaction.message.author.username, reaction.message.author.displayAvatarURL)
|
||||
.setTimestamp()
|
||||
|
||||
try {
|
||||
channel.send({ embed: starEmbed});
|
||||
await channel.send(messageAttachments);
|
||||
} catch(err) {
|
||||
console.error('There is no shameboard');
|
||||
}
|
||||
}
|
||||
if (messageID.includes(reaction.message.id))
|
||||
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 shameEmbed = new MessageEmbed()
|
||||
.setColor()
|
||||
.setDescription(messageContent)
|
||||
.setAuthor(reaction.message.author.username, reaction.message.author.displayAvatarURL)
|
||||
.setTimestamp();
|
||||
|
||||
channel.send({ embed: shameEmbed});
|
||||
return channel.send(`From: ${reaction.message.channel} ID: ${reaction.message.id} \n${messageAttachments}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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",
|
||||
"version": "1.0.0",
|
||||
"description": "A simple discord bot made with discord.js and commando",
|
||||
"name": "hahayes",
|
||||
"version": "2.1.0",
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
"auto-reload": "^0.1.0",
|
||||
"canvas": "^2.2.0",
|
||||
"eslint": "^5.11.1",
|
||||
"eslint-config-standard": "^12.0.0",
|
||||
"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",
|
||||
"discord-akairo": "github:1Computer1/discord-akairo#master",
|
||||
"discord.js": "github:discordjs/discord.js#master",
|
||||
"node-fetch": "^2.3.0",
|
||||
"reload-json": "^0.3.1",
|
||||
"superagent": "^4.1.0",
|
||||
"youtube-dl": "^1.12.2"
|
||||
},
|
||||
"devDependencies": {},
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
"devDependencies": {
|
||||
"eslint": "^5.11.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": {
|
||||
"type": "git",
|
||||
"url": "git+https://gitlab.com/LoicBersier/DiscordBot.git"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"bugs": {
|
||||
"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