Commit 89c56214 authored by Sigfried Seldeslachts's avatar Sigfried Seldeslachts
Browse files

Merge branch 'develop' into 'master'

Develop

See merge request !2
parents 9d2e0510 f5be8fdc
node_modules
.env
\ No newline at end of file
src/.env
.env
......@@ -24,4 +24,4 @@ items.forEach((item) => {
});
Object.assign(module.exports, commands);
\ No newline at end of file
Object.assign(module.exports, commands);
const fs = require('fs');
const path = require('path');
const prefix = process.env.PREFIX;
/**
* Shows the help message
* @param msg
*/
const command = async (msg) => {
const fieldContent = [];
const commandDirectories = fs.readdirSync(path.join(__dirname, "../")).filter(file => !(file.endsWith('js')));
for (const dir of commandDirectories) {
const type = fs.readdirSync(path.join(__dirname, `../${dir}`));
let content = "";
for (const file of type) {
const command = require(path.join(__dirname, `../${dir}/${file}`));
content += prefix + command.aliases[0] + " - " + command.description + "\n";
}
fieldContent.push({name: dir, value: content});
}
const embed = {
title: "ISW Bot - Commands",
description: "Hier kan je alle commando's vinden van de bot.",
color: "#6FB171",
url: "https://iswleuven.be/",
fields: fieldContent
}
await msg.channel.send({embed});
}
module.exports = {
aliases: ['help', 'h'],
description: "geeft alle commands weer",
author: "mella",
onMessage: command,
};
/**
* @param message
* @param args
*/
const command = async (message, args) => {
if(message.member.roles.cache.find(r => r.name === "Moderator")) {
let amount = args[0]
if (!amount) return message.reply('You haven\'t given an amount of messages which should be deleted!');
if (isNaN(amount)) return message.reply('The amount parameter isn`t a number!');
if (amount > 100) return message.reply('You can`t delete more than 100 messages at once!');
if (amount < 1) return message.reply('You have to delete at least 1 message!');
await message.channel.messages.fetch({ limit: amount }).then(messages => {
message.channel.bulkDelete(messages
).catch(console.error)});
} else {
message.delete();
message.reply('You don\'t have permission to do that!')
.then(msg => {
msg.delete({ timeout: 3000 })
}).catch();
}
}
module.exports = {
aliases: ['purge'],
description: "deletes the given amount of messages",
ownerOnly: true,
onMessage: command
}
const axios = require('axios');
/**
* @param {} msg
* @param msg
*/
const command = async (msg) => {
try {
......@@ -14,13 +15,10 @@ const command = async (msg) => {
}
}
module.exports = {
aliases: ['cat', 'kat'],
info: {
"aliases": "cat, kat",
"name": "Kat",
"description": "Stuurt een foto van een kat.",
"author": "Sigfried"
},
description: "stuurt een foto van een kat",
author: "Sigfried",
onMessage: command,
};
\ No newline at end of file
};
/**
* @param msg
*/
const command = async (msg) => {
const result = (Math.floor(Math.random() * 2) === 0) ? 'Heads (kop)' : 'Tails (munt)';
msg.reply(result);
}
module.exports = {
aliases: ['coinflip'],
description: "de bot gooit kop of munt",
author: "Sigfried",
onMessage: command,
};
const axios = require('axios');
/**
* @param msg
*/
const command = async (msg) => {
try {
const {data} = await axios.get('https://api.thedogapi.com/v1/images/search', {
headers: {'x-api-key': process.env.DOG_API_KEY}
});
msg.channel.send(data[0].url);
} catch (error) {
msg.channel.send("Ik kon geen afbeelding versturen.");
}
}
module.exports = {
aliases: ['dog', 'hond'],
description: "stuurt een foto van een hond",
author: "Sigfried",
onMessage: command,
};
/**
* @param msg
*/
const command = async (msg) => {
// Get the first user which is mentioned
const user = msg.mentions.users.first();
const member = msg.guild.member(user);
if (user && member) {
const userWhoDoubts = msg.member.user;
await msg.channel.send([
`<@${user.id}>, <@${userWhoDoubts.id}> betwijfelt dat!`,
'https://sigfriedsimages.b-cdn.net/doubt.png'
]);
} else {
msg.reply([
'jij betwijfelt dat!',
'https://sigfriedsimages.b-cdn.net/doubt.png'
]);
}
msg.delete();
}
module.exports = {
aliases: ['doubt'],
description: "je betwijfelt dat",
author: "Sigfried",
onMessage: command,
};
const axios = require('axios');
/**
* @param msg
*/
const command = async (msg) => {
try {
const {data} = await axios.get('https://yesno.wtf/api')
msg.reply([
data.answer,
data.image
]);
} catch (e) {
msg.channel.send('Er ging iets mis en ik kon jammer genoeg niet antwoorden op jouw vraag.');
}
}
module.exports = {
aliases: ['eightball'],
description: "stel een ja of nee vraag, en er wordt een antwoord opgegeven",
author: "Sigfried",
onMessage: command,
};
const axios = require('axios');
const cheerio = require('cheerio');
/**
* Shows the excuse
* @param msg
*/
const command = async (msg) => {
try {
const {data} = await axios.get('https://ipv6excuses.com/');
const HTML = await cheerio.load(data);
await msg.channel.send(`"${HTML('h1').text().trim()}"`);
} catch (error) {
msg.channel.send(error);
}
}
module.exports = {
aliases: ['ipv6excuse', 'ipv6e'],
description: "toont een excuus om geen IPv6 te gebruiken",
author: "Sigfried",
onMessage: command,
};
/**
* @param msg
*/
const command = async (msg) => {
msg.channel.send('https://sigfriedsimages.b-cdn.net/wut.jpg');
msg.delete();
}
module.exports = {
aliases: ['wut', 'wat'],
description: "wut...",
author: "Sigfried",
onMessage: command,
};
/**
* @param {} msg
*/
const command = async (msg) => {
const result = (Math.floor(Math.random() * 2) == 0) ? 'Heads (kop)' : 'Tails (munt)';
message.reply(result);
}
module.exports = {
aliases: ['coinflip'],
info: {
"aliases": "coinflip",
"name": "Kop of munt?",
"description": "De bot gooit kop of munt.",
"author": "Sigfried"
},
onMessage: command,
};
\ No newline at end of file
const axios = require('axios');
/**
* @param {} msg
*/
const command = async (msg) => {
try {
const { data } = await axios.get('https://api.thedogapi.com/v1/images/search', {
headers: { 'x-api-key': process.env.DOG_API_KEY } });
msg.channel.send(data[0].url);
} catch (error) {
msg.channel.send("Ik kon geen afbeelding versturen.");
}
}
module.exports = {
aliases: ['dog', 'hond'],
info: {
"aliases": "dog, hond",
"name": "Hond",
"description": "Stuurt een foto van een hond.",
"author": "Sigfried"
},
onMessage: command,
};
\ No newline at end of file
/**
* @param {} msg
*/
const command = async (msg) => {
// Get the first user which is mentioned
const user = msg.mentions.users.first();
const member = msg.guild.member(user);
if (user && member) {
const userWhoDoubts = msg.member.user;
msg.channel.send([
`<@${user.id}>, <@${userWhoDoubts.id}> betwijfelt dat!`,
'https://sigfriedsimages.b-cdn.net/doubt.png'
]);;
} else {
msg.reply([
'jij betwijfelt dat!',
'https://sigfriedsimages.b-cdn.net/doubt.png'
]);
}
msg.delete();
}
module.exports = {
aliases: ['doubt'],
info: {
"aliases": "doubt",
"name": "Betwijfel",
"description": "Je betwijfelt dat!",
"author": "Sigfried"
},
onMessage: command,
};
\ No newline at end of file
const axios = require('axios');
/**
* @param {} msg
*/
const command = async (msg) => {
try {
const { data } = await axios.get('https://yesno.wtf/api')
msg.reply([
data.answer,
data.image
]);
} catch (e) {
msg.channel.send('Er ging iets mis en ik kon jammer genoeg niet antwoorden op jouw vraag.');
}
}
module.exports = {
aliases: ['eightball'],
info: {
"aliases": "eightball",
"name": "Eightball",
"description": "Stel een ja of nee vraag, en er wordt een antwoord opgegeven!",
"author": "Sigfried"
},
onMessage: command,
};
\ No newline at end of file
const Discord = require('discord.js');
const commands = require('../../commandInjector.js');
/**
* Shows the help message
* @param {} msg
*/
const command = async (msg) => {
const embed = {
title: "ISW Bot - Hulp",
description: "Hier kan je alle commando's vinden van de bot.",
fields: [],
}
Object.keys(commands).forEach((key) => {
const info = commands[key]['info'];
embed.fields.push({
name: info.name + " - " + info.aliases,
value: info.description
});
});
msg.channel.send({ embed });
}
module.exports = {
aliases: ['help', 'h'],
info: {
"aliases": "help, h",
"name": "Help",
"description": "Toont dit help scherm.",
"author": "Sigfried"
},
onMessage: command,
};
\ No newline at end of file
const axios = require('axios');
const cheerio = require('cheerio');
/**
* Shows the excuse
* @param {} msg
*/
const command = async (msg) => {
try {
const { data } = await axios.get('https://ipv6excuses.com/');
const HTML = await cheerio.load(data);
await msg.channel.send(`"${HTML('h1').text().trim()}"`);
} catch (error) {
msg.channel.send(error);
}
}
module.exports = {
aliases: ['ipv6e', 'ipv6excuse'],
info: {
"aliases": "ipv6e, ipv6excuse",
"name": "IPv6 excuus",
"description": "Toont een excuus om geen IPv6 te gebruiken",
"author": "Sigfried"
},
onMessage: command,
};
\ No newline at end of file
/**
* @param {} msg
*/
const command = async (msg) => {
msg.channel.send('https://sigfriedsimages.b-cdn.net/wut.jpg');
msg.delete();
}
module.exports = {
aliases: ['wut', 'wat'],
info: {
"aliases": "wuyt, wat",
"name": "WAT!?",
"description": "Wut...",
"author": "Sigfried"
},
onMessage: command,
};
\ No newline at end of file
const client = require('./index.js').client;
const path = require('path');
const fs = require('fs');
/**
* Loading events
*/
const eventTypes = fs.readdirSync(path.join(__dirname, "events")).filter(file => !(file.endsWith('js')));
eventTypes.forEach(async (type) => {
const directory = fs.readdirSync(path.join(__dirname, `events/${type}`));
directory.forEach(file => {
let event = require(path.join(__dirname, `events/${type}/${file}`));
client.on(type, event.bind(client))
});
});
module.exports = async (member) => {
await member.send("**!!! LEES DIT BERICHT EERST VOOR JE VERDER GAAT !!!**\n" +
"―――――――――――――――――――――――――\n" +
"**Welkom op de Discord server van ISW Leuven**\n" +
"\n" +
"**Je zelf toevoegen aan een fase**\n" +
"―――――――――――――――――――――――――\n" +
"Om spam voor iedereen te vermijden, kan je jezelf toevoegen aan een fase (1, 2 of 3).\n" +
"Dit doe je door op het bericht (onderaan) met de reacties te antwoorden in het channel **#info-nieuwe-mensen**.\n" +
"Voor fase 1 reageer je dus op dit bericht: :one: , enzovoort.\n" +
"Je kan jezelf toevoegen aan meerdere fases.\n" +
"Als je een graduaat doet kies je :regional_indicator_g:.\n" +
"\n" +
"**Regels**\n" +
"―――――――――――――――――――――――――\n" +
"- wees respectvol\n" +
"- geen racistisch gedrag\n" +
"- post steeds in het juiste kanaal, als je gewoon wil praten doe je dat in #chit-chat\n" +
"- geen NSFW-content\n" +
"\n" +
"\n" +
"**Bot commando's**\n" +
"―――――――――――――――――――――――――\n" +
"ISW Bot: !help voor meer info.\n" +
"MathBot: =help voor meer info.\n");
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment