Osselbot/.idea/shelf/Uncommitted_changes_before_.../shelved.patch

336 lines
22 KiB
Diff

Index: src/index.js
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.BaseRevisionTextPatchEP
<+>#!/usr/bin/env node\n// Load up the libraries\nconst Discord = require(\"discord.js\");\nconst prettyMilliseconds = require('pretty-ms');\nconst fs = require('fs');\nconst homedir = require('os').homedir;\nconst info = require(\"../package.json\")\n//importing files\nconst config = require(\"./config.json\");\n// This is making clients\nconst client = new Discord.Client();\n//THIS BOT IS FOR DEVELOPMENT USE ONLY!\n//WATCH OUT ON PULL REQUESTS\n//CONTACT ALEX BEFORE MERGES\nclient.user.setStatus('dnd', '0SSELB0T DEVELOPMENT')\n\nclient.on(\"ready\", () => {\n\t// This event will run if the bot starts, and logs in, successfully.\n\tconsole.log(`Bot has started, with ${client.users.cache.size} users, in ${client.channels.cache.size} channels of ${client.guilds.cache.size} guilds.`);\n\t// Example of changing the bot's playing game to something useful. `client.user` is what the\n\t// docs refer to as the \"ClientUser\".\n});\n\n////// ACTUAL MESSAGE PROCESSING\nclient.on(\"message\", async message => {\n\t//stops bots from activating the Osselbot\n\t//Message processing\n\tif(message.author.bot) return;\n\tif(message.content.indexOf(config.prefix) !== 0) return;\n\t// Here we separate our \"command\" name, and our \"arguments\" for the command.\n // e.g. if we have the message \"+say Is this the real life?\" , we'll get the following:\n // command = say\n // args = [\"Is\", \"this\", \"the\", \"real\", \"life?\"]\n const args = message.content.slice(config.prefix.length).trim().split(/ +/g);\n const command = args.shift().toLowerCase();\n\t//////////////////////////////////////////////////////////////////////////////\n\t//COMMAND TIME\n\t//////////////////////////////////////////////////////////////////////////////\n\tif (command === \"reboot\"){\n\t\tfunction shutdown(){\n\t\t\tclient.destroy();\n\t\t\tprocess.exit(69);\n\t\t\t}\n\t\tif (message.author.id === '216042720047661057') {\n\t\t\tmessage.reply(\"**Authenticated**, Restarting now.\");\n\t\t\tclient.user.setActivity(`Itself die`,{ type: 'WATCHING' });\n\t\t\tsetTimeout(shutdown, 5000, 'shutdown');\n\t\t}\n\t\telse {\n\t\t\treturn message.reply(\"No\");\n\t\t};\n\t};\n\t//////////////////////////////////////////////////////////////////////////////\n\tif (command === \"stats\") {\n\t\tlet embed = new Discord.MessageEmbed()\n\t\t.setTitle('Stats')\n\t\t.setAuthor(\"Osselbot\", \"https://cdn.discordapp.com/attachments/597814181084921866/711843993914310656/animated-beach-balls-29.gif\")\n\t\t.setColor(0x195080)\n\t\t.setDescription(`\\\n**Stats for 0SSELB0T** \\n \\\n**Uptime:** ${prettyMilliseconds(client.uptime)} \\n \\\n**Started at:** ${client.readyAt} \\n \\\n**People:** ${client.users.cache.size}`)\n.setFooter(`osselbot v${info.version} run version for full info`);\n\t\treturn message.channel.send(embed);\n\t};\n\t//////////////////////////////////////////////////////////////////////////////\n\tif(command === \"ping\") {\n\t// Calculates ping between sending a message and editing it, giving a nice round-trip latency.\n\t\tconst m = await message.channel.send(\"Ping?\");\n\t\tm.edit(`Pong! Latency is ${m.createdTimestamp - message.createdTimestamp}ms`);\n\t};\n\t//////////////////////////////////////////////////////////////////////////////\n\t//HOW QUOTEABLE\n\tif(command === \"psych\") {\n\t\treturn message.channel.send(\"Rules for finding a psychopath: \\n1. Favorite color is orange \\n2. Likes the left burners, worse if its top left\\n3. Calls pizza sauce/tomato sauce gravy\\n4. Doesnt like salad\\n5. Likes country music\\n6. Makes hot chocolate with water\\n7. Likes black licorice\")\n\t};\n\n\tif(command === \"ask\") {\n\t\treturn message.channel.send(\"Dont Ask, Just ask!\\n https://iki.fi/sol/dontask.html\")\n\t};\n\n\tif(command === \"simp\") {\n\t\tif(!message.member.roles.cache.some(r=>[\"Admin\", \"Moderator\",\"Member of the Order of the b l u e\",\"Botmeister\"].includes(r.name)) )\n\treturn message.reply(\"Sorry, you don't have permissions to use this!\");\n\t\tlet embed = new Discord.MessageEmbed()\n\t\t\t.setTitle(\"SIMP Alert\")\n\t\t\t.setURL(\"https://www.youtube.com/watch?v=c3m4Q07TkMk\")\n\t\t\t.setColor(0x195080)\n\t\t\t.setDescription(\"__**ALERT**__ SIMP detected!\")\n\t\t\t.setImage(\"https://vignette.wikia.nocookie.net/disney/images/6/64/Kronk_.jpg/revision/latest?cb=20160720194635\")\n\t\t\t.setTimestamp()\n\t\tmessage.channel.send({embed})\n\t};\n\n\tif(command === \"squad\") {\n\t\t\tmin = Math.ceil(0);\n \t\tmax = Math.floor(11);\n \t\tlet rate = Math.floor(Math.random() * (max - min) + min); //The maximum is exclusive and the minimum is inclusive\n\t\treturn message.reply(`The squad rates this ${rate} out of 10`);\n\t};\n\n\tif(command === \"magic\") {\n\t\treturn message.channel.send(\"Do you believe in magic in a young girl\\'s heart\\nHow the music can free her, whenever it starts\\nAnd it\\'s magic, if the music is groovy\\nIt makes you feel happy like an old-time movie\\nI\\'ll tell you about the magic, and it\\'ll free your soul\\nBut it\\'s like trying to tell a stranger bout \\'rock and roll\\'\");\n\t};\n\n\tif(command === 'help') {\n\t\treturn message.reply('https://technicolor.2a03.party/bot/');\n\t};\n\n\tif (command === \"fix\") {\n\t\tif(message.member.roles.cache.some(r=>[\"Botmeister\"].includes(r.name))) {\n\t\treturn message.channel.send(\"I guess it\\'s my fault will fix.\");\n\t\t};\n\t\treturn;\n\t};\n////////////////////////////////////////////////////////////////////////////////\n\tif(command === \"say\") {\n\t// makes the bot say something and delete the message. As an example, it's open to anyone to use.\n\t// To get the \"message\" itself we join the `args` back into a string with spaces:\n\tconst sayMessage = args.join(\" \");\n\tif (message.member.roles.cache.some(r=>[\"Admin\",\"Mods\",\"Member of the Order\",\"Botmeister\",\"Ally of the Order\",\"say\"].includes(r.name)) ){\n\t// Then we delete the command message (sneaky, right?). The catch just ignores the error with a cute smiley thing.\n\tmessage.delete().catch(O_o=>{});\n\t// And we get the bot to say the thing:\n\treturn message.channel.send(sayMessage);\n};\n\t};\n////////////////////////////////////////////////////////////////////////////////\n\tif(command === \"quote\") {\n\t\tlet quotes = require(`../quotes.json`);\n\t\tvar quoteadd = \"\";\n\n var selector;\n\t\ttry{\n\t\t\tselector = args[0].toLowerCase();\n } catch (err) {\n var number = quotes.quotes.length + 1;\n\t\t let quotesend = Math.floor(Math.random() * (number - 0) + 0);\n\t\t return message.channel.send(`${quotes.quotes[quotesend]}`);\n };\n\t\t\tif(selector === \"add\") {\n\t\t\t\targs.shift();\n\t\t\t\tquoteadd = args;\n quoteadd = quoteadd.toString();\n quoteadd = quoteadd.replace(/,/g, \" \");\n quoteadd = quoteadd.replace(/ /g, \", \"); quotes.quotes.push(quoteadd.toString());\n\t\t\t\tfs.writeFile(`../quotes.json`, JSON.stringify(quotes), (err) => {\n\t\t\t\tif (err) return message.reply(\"Something went wrong\");``\n\t\t\t\tclient.channels.cache.get('712084662033580064').send(`${message.member} has submitted \\`${quoteadd}\\` to the quote repository`);\n\t\t\t\treturn message.reply(\"Quote added to repository\");\n\t\t\t\t});\n\t\t\t}\n \telse {\n return message.reply(\"you can add quotes by running `?quote add <person> Quote goes here`\");\n \t};\n////////////////////////////////////////////////////////////////////////////////\n\tif (command === \"version\") {\n\t\treturn message.channel.send(`\\`\\`\\`\\\n ________________________________________\\n \\\n< @technicolor-creamsicle/osselbot@v${info.version}>\\n \\\n ----------------------------------------\\n \\\n \\\\ ^__^\\n \\\n \\\\ (oo)\\\\_______\\n \\\n (__)\\\\ )\\\\/\\\\\\n \\\n ||----w |\\n \\\n || ||\\n \\\n\\`\\`\\``)\n\t}\n\n\n\n////////////////////////////////////////////////////////////////////////////////\n////////////////////////////////////DEFCON//////////////////////////////////////\n////////////////////////////////////////////////////////////////////////////////\n\tif(command === \"defcon\") {\n\t\t//5 levels till ban\n\t\tif(!message.member.roles.cache.some(r=>[\"Admin\",\"Member of the Order of the b l u e\",\"Botmeister\"].includes(r.name)) )\n\t\treturn message.reply(\"Sorry, you don't have permissions to use this!\");\n\t\telse {\n\t\t\tlet member = message.mentions.members.first();\n\t\t\tvar role = \"\";\n\t\t\tswitch(parseInt(args[1],10)) {\n\t\t\t\tcase 5:\n\t\t\t\t\tvar role = message.guild.roles.cache.find(role => role.name === `DEFCON 5`);\n\t\t\t\t\tmember.roles.add(role);\n\t\t\t\tbreak;\n\t\t\t\tcase 4:\n\t\t\t\t\tvar role = message.guild.roles.cache.find(role => role.name === `DEFCON 4`);\n\t\t\t\t\tmember.roles.add(role);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 3:\n\t\t\t\t\tvar role = message.guild.roles.cache.find(role => role.name === `DEFCON 3`);\n\t\t\t\t\t\tmember.roles.add(role);\n\t\t\t\tbreak;\n\t\t\t\t\tcase 2:\n\t\t\t\t\tvar role = message.guild.roles.cache.find(role => role.name === `DEFCON 2`);\n\t\t\t\t\tmember.roles.add(role);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 1:\n\t\t\t\t\tvar role = message.guild.roles.cache.find(role => role.name === `DEFCON 1`);\n\t\t\t\t\tmember.roles.add(role);\n\t\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\treturn message.reply(`DEFCON not set is ${args[1]} a number between 1-5?`)\n\t\t\t};\n\t\t\treturn message.reply(`\\n**DEFCON** level set to DEFCON ${args[1]}\\nGod Bless their souls`)\n\t\t};\n\t};\n});\n\nif(process.argv.slice(2).includes(\"--TEST\")) {\n\tconsole.log(\"Test Pass!\");\n\tprocess.exit(0);\n};\n\n//Logging in the bot\nclient.login(config.token);
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- src/index.js (revision 6fea412d6339bdd372f74be9003abe43670cae23)
+++ src/index.js (date 1594665765020)
@@ -25,64 +25,70 @@
client.on("message", async message => {
//stops bots from activating the Osselbot
//Message processing
- if(message.author.bot) return;
- if(message.content.indexOf(config.prefix) !== 0) return;
+ 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.
- // e.g. if we have the message "+say Is this the real life?" , we'll get the following:
- // command = say
- // args = ["Is", "this", "the", "real", "life?"]
- const args = message.content.slice(config.prefix.length).trim().split(/ +/g);
- const command = args.shift().toLowerCase();
+ // e.g. if we have the message "+say Is this the real life?" , we'll get the following:
+ // command = say
+ // args = ["Is", "this", "the", "real", "life?"]
+ const args = message.content.slice(config.prefix.length).trim().split(/ +/g);
+ const command = args.shift().toLowerCase();
//////////////////////////////////////////////////////////////////////////////
//COMMAND TIME
//////////////////////////////////////////////////////////////////////////////
- if (command === "reboot"){
- function shutdown(){
+ if (command === "reboot") {
+ function shutdown() {
client.destroy();
process.exit(69);
- }
+ }
+
if (message.author.id === '216042720047661057') {
message.reply("**Authenticated**, Restarting now.");
- client.user.setActivity(`Itself die`,{ type: 'WATCHING' });
+ client.user.setActivity(`Itself die`, {type: 'WATCHING'});
setTimeout(shutdown, 5000, 'shutdown');
- }
- else {
+ } else {
return message.reply("No");
- };
- };
+ }
+
+ }
+
//////////////////////////////////////////////////////////////////////////////
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(`\
+ .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}`)
-.setFooter(`osselbot v${info.version} run version for full info`);
+ .setFooter(`osselbot v${info.version} run version for full info`);
return message.channel.send(embed);
- };
+ }
+
//////////////////////////////////////////////////////////////////////////////
- if(command === "ping") {
- // Calculates ping between sending a message and editing it, giving a nice round-trip latency.
+ if (command === "ping") {
+ // Calculates ping between sending a message and editing it, giving a nice round-trip latency.
const m = await message.channel.send("Ping?");
m.edit(`Pong! Latency is ${m.createdTimestamp - message.createdTimestamp}ms`);
- };
+ }
+
//////////////////////////////////////////////////////////////////////////////
//HOW QUOTEABLE
- if(command === "psych") {
+ if (command === "psych") {
return message.channel.send("Rules for finding a psychopath: \n1. Favorite color is orange \n2. Likes the left burners, worse if its top left\n3. Calls pizza sauce/tomato sauce gravy\n4. Doesnt like salad\n5. Likes country music\n6. Makes hot chocolate with water\n7. Likes black licorice")
- };
+ }
+
- if(command === "ask") {
+ if (command === "ask") {
return message.channel.send("Dont Ask, Just ask!\n https://iki.fi/sol/dontask.html")
- };
+ }
+
- if(command === "simp") {
- if(!message.member.roles.cache.some(r=>["Admin", "Moderator","Member of the Order of the b l u e","Botmeister"].includes(r.name)) )
- return message.reply("Sorry, you don't have permissions to use this!");
+ if (command === "simp") {
+ if (!message.member.roles.cache.some(r => ["Admin", "Moderator", "Member of the Order of the b l u e", "Botmeister"].includes(r.name)))
+ return message.reply("Sorry, you don't have permissions to use this!");
let embed = new Discord.MessageEmbed()
.setTitle("SIMP Alert")
.setURL("https://www.youtube.com/watch?v=c3m4Q07TkMk")
@@ -91,72 +97,84 @@
.setImage("https://vignette.wikia.nocookie.net/disney/images/6/64/Kronk_.jpg/revision/latest?cb=20160720194635")
.setTimestamp()
message.channel.send({embed})
- };
+ }
+
- if(command === "squad") {
- min = Math.ceil(0);
- max = Math.floor(11);
- let rate = Math.floor(Math.random() * (max - min) + min); //The maximum is exclusive and the minimum is inclusive
+ if (command === "squad") {
+ min = Math.ceil(0);
+ max = Math.floor(11);
+ let rate = Math.floor(Math.random() * (max - min) + min); //The maximum is exclusive and the minimum is inclusive
return message.reply(`The squad rates this ${rate} out of 10`);
- };
+ }
+
- if(command === "magic") {
+ if (command === "magic") {
return message.channel.send("Do you believe in magic in a young girl\'s heart\nHow the music can free her, whenever it starts\nAnd it\'s magic, if the music is groovy\nIt makes you feel happy like an old-time movie\nI\'ll tell you about the magic, and it\'ll free your soul\nBut it\'s like trying to tell a stranger bout \'rock and roll\'");
- };
+ }
+
- if(command === 'help') {
+ if (command === 'help') {
return message.reply('https://technicolor.2a03.party/bot/');
- };
+ }
+
if (command === "fix") {
- if(message.member.roles.cache.some(r=>["Botmeister"].includes(r.name))) {
- return message.channel.send("I guess it\'s my fault will fix.");
- };
+ if (message.member.roles.cache.some(r => ["Botmeister"].includes(r.name))) {
+ return message.channel.send("I guess it\'s my fault will fix.");
+ }
+
return;
- };
+ }
+
////////////////////////////////////////////////////////////////////////////////
- if(command === "say") {
- // 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)) ){
- // 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 === "say") {
+ // 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))) {
+ // 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") {
+ if (command === "quote") {
let quotes = require(`../quotes.json`);
var quoteadd = "";
- var selector;
- try{
+ 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") {
- args.shift();
- quoteadd = args;
- quoteadd = quoteadd.toString();
- quoteadd = quoteadd.replace(/,/g, " ");
- quoteadd = quoteadd.replace(/ /g, ", "); quotes.quotes.push(quoteadd.toString());
- fs.writeFile(`../quotes.json`, JSON.stringify(quotes), (err) => {
- if (err) return message.reply("Something went wrong");``
+ } 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") {
+ args.shift();
+ quoteadd = args;
+ quoteadd = quoteadd.toString();
+ quoteadd = quoteadd.replace(/,/g, " ");
+ quoteadd = quoteadd.replace(/ /g, ", ");
+ quotes.quotes.push(quoteadd.toString());
+ fs.writeFile(`../quotes.json`, JSON.stringify(quotes), (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.reply("you can add quotes by running `?quote add <person> Quote goes here`");
- };
+ });
+ } else {
+ return message.reply("you can add quotes by running `?quote add <person> Quote goes here`");
+ }
+
////////////////////////////////////////////////////////////////////////////////
- if (command === "version") {
- return message.channel.send(`\`\`\`\
+ if (command === "version") {
+ return message.channel.send(`\`\`\`\
________________________________________\n \
< @technicolor-creamsicle/osselbot@v${info.version}>\n \
----------------------------------------\n \
@@ -166,53 +184,57 @@
||----w |\n \
|| ||\n \
\`\`\``)
- }
+ }
-
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////DEFCON//////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
- if(command === "defcon") {
- //5 levels till ban
- if(!message.member.roles.cache.some(r=>["Admin","Member of the Order of the b l u e","Botmeister"].includes(r.name)) )
- return message.reply("Sorry, you don't have permissions to use this!");
- else {
- let member = message.mentions.members.first();
- var role = "";
- switch(parseInt(args[1],10)) {
- case 5:
- var role = message.guild.roles.cache.find(role => role.name === `DEFCON 5`);
- member.roles.add(role);
- break;
- case 4:
- var role = message.guild.roles.cache.find(role => role.name === `DEFCON 4`);
- member.roles.add(role);
+ if (command === "defcon") {
+ //5 levels till ban
+ if (!message.member.roles.cache.some(r => ["Admin", "Member of the Order of the b l u e", "Botmeister"].includes(r.name)))
+ return message.reply("Sorry, you don't have permissions to use this!");
+ else {
+ let member = message.mentions.members.first();
+ var role = "";
+ switch (parseInt(args[1], 10)) {
+ case 5:
+ var role = message.guild.roles.cache.find(role => role.name === `DEFCON 5`);
+ member.roles.add(role);
+ break;
+ case 4:
+ var role = message.guild.roles.cache.find(role => role.name === `DEFCON 4`);
+ member.roles.add(role);
break;
case 3:
- var role = message.guild.roles.cache.find(role => role.name === `DEFCON 3`);
+ var role = message.guild.roles.cache.find(role => role.name === `DEFCON 3`);
member.roles.add(role);
- break;
+ break;
case 2:
- var role = message.guild.roles.cache.find(role => role.name === `DEFCON 2`);
- member.roles.add(role);
+ var role = message.guild.roles.cache.find(role => role.name === `DEFCON 2`);
+ member.roles.add(role);
break;
case 1:
- var role = message.guild.roles.cache.find(role => role.name === `DEFCON 1`);
- member.roles.add(role);
+ var role = message.guild.roles.cache.find(role => role.name === `DEFCON 1`);
+ member.roles.add(role);
break;
- default:
- return message.reply(`DEFCON not set is ${args[1]} a number between 1-5?`)
- };
- return message.reply(`\n**DEFCON** level set to DEFCON ${args[1]}\nGod Bless their souls`)
- };
- };
-});
+ default:
+ return message.reply(`DEFCON not set is ${args[1]} a number between 1-5?`)
+ }
+
+ return message.reply(`\n**DEFCON** level set to DEFCON ${args[1]}\nGod Bless their souls`)
+ }
+
+ }
+
+ }
+);
-if(process.argv.slice(2).includes("--TEST")) {
+if (process.argv.slice(2).includes("--TEST")) {
console.log("Test Pass!");
process.exit(0);
-};
+}
+
//Logging in the bot
client.login(config.token);
\ No newline at end of file