|
|
|
@@ -2,29 +2,50 @@
|
|
|
|
|
// Load up the libraries
|
|
|
|
|
const Discord = require("discord.js");
|
|
|
|
|
const prettyMilliseconds = require('pretty-ms');
|
|
|
|
|
const fs = require('fs');
|
|
|
|
|
const homedir = require('os').homedir;
|
|
|
|
|
const info = require("../package.json")
|
|
|
|
|
//importing files
|
|
|
|
|
const config = require("./config.json");
|
|
|
|
|
// This is the client
|
|
|
|
|
// This is making clients
|
|
|
|
|
const client = new Discord.Client();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function activity() {
|
|
|
|
|
client.user.setActivity(`${client.users.cache.size} of you horrible people`,{ type: 'LISTENING' });
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
client.on("ready", () => {
|
|
|
|
|
// This event will run if the bot starts, and logs in, successfully.
|
|
|
|
|
console.log(`Bot has started, with ${client.users.cache.size} users, in ${client.channels.cache.size} channels of ${client.guilds.cache.size} guilds.`);
|
|
|
|
|
// Example of changing the bot's playing game to something useful. `client.user` is what the
|
|
|
|
|
// docs refer to as the "ClientUser".
|
|
|
|
|
client.user.setActivity(`${client.users.cache.size} of you horrible people`,{ type: 'LISTENING' });
|
|
|
|
|
activity();
|
|
|
|
|
});
|
|
|
|
|
//Updates people count
|
|
|
|
|
client.on('guildMemberAdd', member => {
|
|
|
|
|
console.log(`New member joined: ${member.name} (id: ${member.id}).`);
|
|
|
|
|
client.user.setActivity(`${client.users.cache.size} of you horrible people`,{ type: 'LISTENING' });
|
|
|
|
|
activity();
|
|
|
|
|
});
|
|
|
|
|
client.on('guildMemberRemove', member => {
|
|
|
|
|
console.log(` member left: ${member.name} (id: ${member.id}).`);
|
|
|
|
|
client.user.setActivity(`${client.users.cache.size} of you horrible people`,{ type: 'LISTENING' });
|
|
|
|
|
activity();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
setInterval(activity, 300000);
|
|
|
|
|
|
|
|
|
|
////// ACTUAL MESSAGE PROCESSING
|
|
|
|
|
client.on("message", async message => {
|
|
|
|
|
//stops bots from activating the Osselbot
|
|
|
|
|
//Message processing
|
|
|
|
|
|
|
|
|
|
if(message.content.toLowerCase().includes('nigg',"niglet","negro","fag","f4g","n1gg","gg3r")) {
|
|
|
|
|
message.delete();
|
|
|
|
|
return message.reply(`Listen here cum-sock we dont appeciate that here ${message.member}. If you gonna be like that you may just well end up in the JAR and we all know how that ends...`)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(message.author.bot) return;
|
|
|
|
|
if(message.content.indexOf(config.prefix) !== 0) return;
|
|
|
|
|
// Here we separate our "command" name, and our "arguments" for the command.
|
|
|
|
@@ -54,13 +75,14 @@ client.on("message", async message => {
|
|
|
|
|
if (command === "stats") {
|
|
|
|
|
let embed = new Discord.MessageEmbed()
|
|
|
|
|
.setTitle('Stats')
|
|
|
|
|
.setAuthor("Osselbot", "https://cdn.discordapp.com/attachments/597814181084921866/711843993914310656/animated-beach-balls-29.gif")
|
|
|
|
|
.setColor(0x195080)
|
|
|
|
|
.setDescription(`\
|
|
|
|
|
**Stats for 0SSELB0T** \n \
|
|
|
|
|
**Uptime:** ${prettyMilliseconds(client.uptime)} \n \
|
|
|
|
|
**Started at:** ${client.readyAt} \n \
|
|
|
|
|
**People:** ${client.users.cache.size}\
|
|
|
|
|
`);
|
|
|
|
|
**People:** ${client.users.cache.size}`)
|
|
|
|
|
.setFooter(`osselbot v${info.version} run version for full info`);
|
|
|
|
|
return message.channel.send(embed);
|
|
|
|
|
};
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
|
|
@@ -118,31 +140,55 @@ client.on("message", async message => {
|
|
|
|
|
// makes the bot say something and delete the message. As an example, it's open to anyone to use.
|
|
|
|
|
// To get the "message" itself we join the `args` back into a string with spaces:
|
|
|
|
|
const sayMessage = args.join(" ");
|
|
|
|
|
if (message.member.roles.cache.some(r=>["Admin","Mods","Member of the Order","Botmeister","Ally of the Order","say"].includes(r.name)) ){
|
|
|
|
|
if(sayMessage.includes('@')) {
|
|
|
|
|
return message.reply("\nStop pinging yourself \nStop pinging yourself");
|
|
|
|
|
};
|
|
|
|
|
if (message.member.roles.cache.some(r=>["Admin","Mods","Member of the Order","Botmeister","Ally of the Order","say"].includes(r.name)) ){}
|
|
|
|
|
// Then we delete the command message (sneaky, right?). The catch just ignores the error with a cute smiley thing.
|
|
|
|
|
message.delete().catch(O_o=>{});
|
|
|
|
|
// And we get the bot to say the thing:
|
|
|
|
|
return message.channel.send(sayMessage);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
if(command === "quote") {
|
|
|
|
|
|
|
|
|
|
let quotes = require(`${homedir}/quotes.json`);
|
|
|
|
|
var quoteadd = "";
|
|
|
|
|
var selector;
|
|
|
|
|
try{
|
|
|
|
|
selector = args[0].toLowerCase();
|
|
|
|
|
} catch (err) {
|
|
|
|
|
var number = quotes.quotes.length + 1;
|
|
|
|
|
let quotesend = Math.floor(Math.random() * (number - 0) + 0);
|
|
|
|
|
return message.channel.send(`${quotes.quotes[quotesend]}`);
|
|
|
|
|
};
|
|
|
|
|
if(selector === "add") {
|
|
|
|
|
if (!(message.member.roles.cache.some(r => ["Admin","Mods","Member of the Order","Botmeister","Ally of the Order","say"].includes(r.name)))) return message.reply("Ask someone with the quote role to add that.")
|
|
|
|
|
args.shift();
|
|
|
|
|
//This does logic to make it from an array to a nice string.
|
|
|
|
|
quoteadd = args.join(' ');
|
|
|
|
|
quotes.quotes.push(quoteadd)
|
|
|
|
|
fs.writeFile(`${homedir}/quotes.json`, JSON.stringify(quotes, null, 2), (err) => {
|
|
|
|
|
if (err) return message.reply("Something went wrong");``
|
|
|
|
|
client.channels.cache.get('712084662033580064').send(`${message.member} has submitted \`${quoteadd}\` to the quote repository`);
|
|
|
|
|
return message.reply("Quote added to repository");
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
return message.channel.send("Im sorry but we cant have nice things...")
|
|
|
|
|
return message.reply("you can add quotes by running `?quote add <person> Quote goes here`");
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
if (command === "version") {
|
|
|
|
|
return message.channel.send("``` ________________________________________\n \
|
|
|
|
|
< @technicolor-creamsicle/osselbot@2.0.4 >\n \
|
|
|
|
|
return message.channel.send(`\`\`\`\
|
|
|
|
|
________________________________________\n \
|
|
|
|
|
< @technicolor-creamsicle/osselbot@v${info.version}>\n \
|
|
|
|
|
----------------------------------------\n \
|
|
|
|
|
\\ ^__^\n \
|
|
|
|
|
\\ (oo)\\_______\n \
|
|
|
|
|
(__)\\ )\\/\\\n \
|
|
|
|
|
||----w |\n \
|
|
|
|
|
|| ||\n \
|
|
|
|
|
```")
|
|
|
|
|
}
|
|
|
|
|
\`\`\``)
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|