Take a look if you wish

This commit is contained in:
Alex 2020-05-25 16:23:31 -05:00
parent b75e153a1a
commit 007e46b135
1 changed files with 10 additions and 11 deletions

View File

@ -3,6 +3,8 @@
const Discord = require("discord.js"); const Discord = require("discord.js");
const prettyMilliseconds = require('pretty-ms'); const prettyMilliseconds = require('pretty-ms');
const fs = require('fs'); const fs = require('fs');
const homedir = require('os').homedir;
const info = require("../package.json")
//importing files //importing files
const config = require("./config.json"); const config = require("./config.json");
// This is making clients // This is making clients
@ -73,7 +75,7 @@ client.on("message", async message => {
**Uptime:** ${prettyMilliseconds(client.uptime)} \n \ **Uptime:** ${prettyMilliseconds(client.uptime)} \n \
**Started at:** ${client.readyAt} \n \ **Started at:** ${client.readyAt} \n \
**People:** ${client.users.cache.size}`) **People:** ${client.users.cache.size}`)
.setFooter("osselbot v2.1.0 run version for full info"); .setFooter(`osselbot v${info.version} run version for full info`);
return message.channel.send(embed); return message.channel.send(embed);
}; };
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
@ -132,9 +134,6 @@ client.on("message", async message => {
// To get the "message" itself we join the `args` back into a string with spaces: // To get the "message" itself we join the `args` back into a string with spaces:
const sayMessage = args.join(" "); 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 (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");
};
// Then we delete the command message (sneaky, right?). The catch just ignores the error with a cute smiley thing. // Then we delete the command message (sneaky, right?). The catch just ignores the error with a cute smiley thing.
message.delete().catch(O_o=>{}); message.delete().catch(O_o=>{});
// And we get the bot to say the thing: // And we get the bot to say the thing:
@ -146,14 +145,14 @@ client.on("message", async message => {
}; };
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
if(command === "quote") { if(command === "quote") {
const quotes = require(`${HOME}/quotes.json`); const quotes = require(`${homedir}/quotes.json`);
const quoteadd = ""; const quoteadd = "";
if(toLowerCase(args[0]) === "add") { if(args[0].toLowerCase() === "add") {
quoteadd = args.shift(); quoteadd = args.shift();
quotes.quotes.push(quoteadd); quotes.quotes.push(quoteadd);
JSON.stringify(quotes); JSON.stringify(quotes);
fs.createWriteStream(`${HOME}/quotes.json`, quotes, {emitClose: "true"}); fs.createWriteStream(`${homedir}/quotes.json`, quotes, {emitClose: "true"});
client.channels.get('712084662033580064').send(`${message.member} has submitted ${quote} to the quote repository`); client.channels.get('712084662033580064').send(`${message.member} has submitted ${quoteadd} to the quote repository`);
return message.reply("Quote added to repository"); return message.reply("Quote added to repository");
}; };
const number = quotes.quotes.length() + 1; const number = quotes.quotes.length() + 1;
@ -162,16 +161,16 @@ client.on("message", async message => {
}; };
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
if (command === "version") { if (command === "version") {
return message.channel.send("```\ return message.channel.send(`\`\`\`\
________________________________________\n \ ________________________________________\n \
< @technicolor-creamsicle/osselbot@2.1.0 >\n \ < @technicolor-creamsicle/osselbot@v${info.version}>\n \
----------------------------------------\n \ ----------------------------------------\n \
\\ ^__^\n \ \\ ^__^\n \
\\ (oo)\\_______\n \ \\ (oo)\\_______\n \
(__)\\ )\\/\\\n \ (__)\\ )\\/\\\n \
||----w |\n \ ||----w |\n \
|| ||\n \ || ||\n \
```") \`\`\``)
} }