Converting to google JS specs

This commit is contained in:
Alex 2020-07-14 13:35:59 -05:00
parent ffb9e943a5
commit 5a83b5097d
10 changed files with 464 additions and 5128 deletions

View File

@ -0,0 +1,31 @@
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<JSCodeStyleSettings version="0">
<option name="FORCE_SEMICOLON_STYLE" value="true" />
<option name="SPACE_BEFORE_FUNCTION_LEFT_PARENTH" value="false" />
<option name="USE_DOUBLE_QUOTES" value="false" />
<option name="FORCE_QUOTE_STYlE" value="true" />
<option name="ENFORCE_TRAILING_COMMA" value="WhenMultiline" />
<option name="CHAINED_CALL_DOT_ON_NEW_LINE" value="false" />
</JSCodeStyleSettings>
<codeStyleSettings language="JavaScript">
<option name="RIGHT_MARGIN" value="80" />
<option name="KEEP_BLANK_LINES_IN_CODE" value="1" />
<option name="CALL_PARAMETERS_WRAP" value="1" />
<option name="METHOD_PARAMETERS_WRAP" value="1" />
<option name="METHOD_PARAMETERS_LPAREN_ON_NEXT_LINE" value="true" />
<option name="METHOD_CALL_CHAIN_WRAP" value="5" />
<option name="BINARY_OPERATION_WRAP" value="1" />
<option name="TERNARY_OPERATION_WRAP" value="5" />
<option name="ARRAY_INITIALIZER_WRAP" value="5" />
<option name="ARRAY_INITIALIZER_LBRACE_ON_NEXT_LINE" value="true" />
<option name="WRAP_ON_TYPING" value="1" />
<indentOptions>
<option name="INDENT_SIZE" value="2" />
<option name="TAB_SIZE" value="2" />
<option name="SMART_TABS" value="true" />
<option name="KEEP_INDENTS_ON_EMPTY_LINES" value="true" />
</indentOptions>
</codeStyleSettings>
</code_scheme>
</component>

View File

@ -1,5 +1,5 @@
<component name="ProjectCodeStyleConfiguration"> <component name="ProjectCodeStyleConfiguration">
<state> <state>
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" /> <option name="USE_PER_PROJECT_SETTINGS" value="true" />
</state> </state>
</component> </component>

View File

@ -0,0 +1,23 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="ComposeUnknownKeys" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="ComposeUnknownValues" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="CucumberExamplesColon" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="CucumberMissedExamples" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="CucumberTableInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="CucumberUndefinedStep" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="GherkinBrokenTableInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="GherkinMisplacedBackground" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="GherkinScenarioToScenarioOutline" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="HamlNestedTagContent" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="HbEmptyBlock" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="InconsistentLineSeparators" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="LongLine" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="ProblematicWhitespace" enabled="true" level="WARNING" enabled_by_default="true">
<scope name="Project Files" level="WARNING" enabled="true" />
</inspection_tool>
<inspection_tool class="SSBasedInspection" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="TodoComment" enabled="true" level="Note" enabled_by_default="true" />
</profile>
</component>

View File

@ -0,0 +1,24 @@
<component name="InspectionProjectProfileManager">
<settings>
<info color="afaf">
<option name="BACKGROUND" value="afaf" />
<option name="ERROR_STRIPE_COLOR" value="afaf" />
<option name="myName" value="Note" />
<option name="myVal" value="50" />
<option name="myExternalName" value="Note" />
<option name="myDefaultAttributes">
<option name="ERROR_STRIPE_COLOR" value="afaf" />
</option>
</info>
<list size="8">
<item index="0" class="java.lang.String" itemvalue="INFORMATION" />
<item index="1" class="java.lang.String" itemvalue="Note" />
<item index="2" class="java.lang.String" itemvalue="TYPO" />
<item index="3" class="java.lang.String" itemvalue="SERVER PROBLEM" />
<item index="4" class="java.lang.String" itemvalue="WEAK WARNING" />
<item index="5" class="java.lang.String" itemvalue="INFO" />
<item index="6" class="java.lang.String" itemvalue="WARNING" />
<item index="7" class="java.lang.String" itemvalue="ERROR" />
</list>
</settings>
</component>

View File

@ -17,3 +17,10 @@ Example config.js to be placed in /src
] ]
} }
``` ```
---
# Contributing
If your a member of civilians all partying then talk to @Technicolor Creamsicle#0773
This code follows the Google JS specs for code formatting.
If you use the WebStorm IDE this will automatically be applied.

View File

@ -1,188 +0,0 @@
// For a detailed explanation regarding each configuration property, visit:
// https://jestjs.io/docs/en/configuration.html
module.exports = {
// All imported modules in your tests should be mocked automatically
// automock: false,
// Stop running tests after `n` failures
// bail: 0,
// The directory where Jest should store its cached dependency information
// cacheDirectory: "/private/var/folders/pw/0tfbblb52h175lvdtj01x_s40000gp/T/jest_dy",
// Automatically clear mock calls and instances between every test
// clearMocks: false,
// Indicates whether the coverage information should be collected while executing the test
// collectCoverage: false,
// An array of glob patterns indicating a set of files for which coverage information should be collected
// collectCoverageFrom: undefined,
// The directory where Jest should output its coverage files
coverageDirectory: "coverage",
// An array of regexp pattern strings used to skip coverage collection
// coveragePathIgnorePatterns: [
// "/node_modules/"
// ],
// Indicates which provider should be used to instrument code for coverage
coverageProvider: "v8",
// A list of reporter names that Jest uses when writing coverage reports
// coverageReporters: [
// "json",
// "text",
// "lcov",
// "clover"
// ],
// An object that configures minimum threshold enforcement for coverage results
// coverageThreshold: undefined,
// A path to a custom dependency extractor
// dependencyExtractor: undefined,
// Make calling deprecated APIs throw helpful error messages
// errorOnDeprecated: false,
// Force coverage collection from ignored files using an array of glob patterns
// forceCoverageMatch: [],
// A path to a module which exports an async function that is triggered once before all test suites
// globalSetup: undefined,
// A path to a module which exports an async function that is triggered once after all test suites
// globalTeardown: undefined,
// A set of global variables that need to be available in all test environments
// globals: {},
// The maximum amount of workers used to run your tests. Can be specified as % or a number. E.g. maxWorkers: 10% will use 10% of your CPU amount + 1 as the maximum worker number. maxWorkers: 2 will use a maximum of 2 workers.
// maxWorkers: "50%",
// An array of directory names to be searched recursively up from the requiring module's location
// moduleDirectories: [
// "node_modules"
// ],
// An array of file extensions your modules use
// moduleFileExtensions: [
// "js",
// "json",
// "jsx",
// "ts",
// "tsx",
// "node"
// ],
// A map from regular expressions to module names or to arrays of module names that allow to stub out resources with a single module
// moduleNameMapper: {},
// An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader
// modulePathIgnorePatterns: [],
// Activates notifications for test results
// notify: false,
// An enum that specifies notification mode. Requires { notify: true }
// notifyMode: "failure-change",
// A preset that is used as a base for Jest's configuration
// preset: undefined,
// Run tests from one or more projects
// projects: undefined,
// Use this configuration option to add custom reporters to Jest
// reporters: undefined,
// Automatically reset mock state between every test
// resetMocks: false,
// Reset the module registry before running each individual test
// resetModules: false,
// A path to a custom resolver
// resolver: undefined,
// Automatically restore mock state between every test
// restoreMocks: false,
// The root directory that Jest should scan for tests and modules within
// rootDir: undefined,
// A list of paths to directories that Jest should use to search for files in
// roots: [
// "<rootDir>"
// ],
// Allows you to use a custom runner instead of Jest's default test runner
// runner: "jest-runner",
// The paths to modules that run some code to configure or set up the testing environment before each test
// setupFiles: [],
// A list of paths to modules that run some code to configure or set up the testing framework before each test
// setupFilesAfterEnv: [],
// A list of paths to snapshot serializer modules Jest should use for snapshot testing
// snapshotSerializers: [],
// The test environment that will be used for testing
testEnvironment: "node",
// Options that will be passed to the testEnvironment
// testEnvironmentOptions: {},
// Adds a location field to test results
// testLocationInResults: false,
// The glob patterns Jest uses to detect test files
// testMatch: [
// "**/__tests__/**/*.[jt]s?(x)",
// "**/?(*.)+(spec|test).[tj]s?(x)"
// ],
// An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
// testPathIgnorePatterns: [
// "/node_modules/"
// ],
// The regexp pattern or array of patterns that Jest uses to detect test files
// testRegex: [],
// This option allows the use of a custom results processor
// testResultsProcessor: undefined,
// This option allows use of a custom test runner
// testRunner: "jasmine2",
// This option sets the URL for the jsdom environment. It is reflected in properties such as location.href
// testURL: "http://localhost",
// Setting this value to "fake" allows the use of fake timers for functions such as "setTimeout"
// timers: "real",
// A map from regular expressions to paths to transformers
// transform: undefined,
// An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation
// transformIgnorePatterns: [
// "/node_modules/"
// ],
// An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them
// unmockedModulePathPatterns: undefined,
// Indicates whether each individual test should be reported during the run
// verbose: undefined,
// An array of regexp patterns that are matched against all source file paths before re-running tests in watch mode
// watchPathIgnorePatterns: [],
// Whether to use watchman for file crawling
// watchman: true,
};

4862
npm-shrinkwrap.json generated

File diff suppressed because it is too large Load Diff

View File

@ -18,11 +18,9 @@
"files": [ "files": [
"/src/" "/src/"
], ],
"devDependencies": { "devDependencies": {},
"jest": "^26.1.0"
},
"scripts": { "scripts": {
"test": "jest --passWithNoTests", "test": "node --trace-warnings ./src/index.js --TEST",
"start": "node ./src/index.js" "start": "node ./src/index.js"
}, },
"repository": { "repository": {

View File

@ -1,243 +1,300 @@
#!/usr/bin/env node #!/usr/bin/env node
//TODO Write tests
//TODO Test all commands
//Those are so I remember stuff //Those are so I remember stuff
// Load up the libraries // Load up the libraries
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 homedir = require('os').homedir;
const info = require("../package.json"); const info = require('../package.json');
//importing files
const config = require("./config.json"); //Imports config file from the src dir.
// This is making clients const config = require('./config.json');
// This is making a client for discord
const client = new Discord.Client(); const client = new Discord.Client();
function activity() { function activity() {
client.user.setActivity(`${client.users.cache.size} of you horrible people`, {type: 'LISTENING'}).then(() => { //This function sets a status for the bot currently it is set to Do Not
}); // Disturb and "LISTENING to USERS of you, why do I do this to myself?"
client.user.setPresence({
activity: {
name: `${client.users.cache.size} of you, why do I do this to myself?`,
type: 'LISTENING',
},
status: 'dnd',
}).then(() => {
});
} }
client.on("ready", () => { client.on('ready', () => {
// This event will run if the bot starts, and logs in, successfully. // 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.`); // noinspection LongLine
// Example of changing the bot's playing game to something useful. `client.user` is what the console.log(
// docs refer to as the "ClientUser". `Bot has started, with ${client.users.cache.size} users, in \
activity(); ${client.channels.cache.size} channels of ${client.guilds.cache.size} guilds.`);
activity();
}); });
//Updates people count //Updates people count
client.on('guildMemberAdd', member => { client.on('guildMemberAdd', member => {
console.log(`New member joined: ${member.nickname} (id: ${member.id}).`); console.log(`New member joined: ${member.nickname} (id: ${member.id}).`);
activity(); activity();
}); });
client.on('guildMemberRemove', member => { client.on('guildMemberRemove', member => {
console.log(` member left: ${member.nickname} (id: ${member.id}).`); console.log(` member left: ${member.nickname} (id: ${member.id}).`);
activity(); activity();
}); });
setInterval(activity, 300000); setInterval(activity, 300000);
////// ACTUAL MESSAGE PROCESSING ////// ACTUAL MESSAGE PROCESSING
client.on("message", async message => { client.on('message', async message => {
//stops bots from activating the Osselbot //stops bots from activating the Osselbot
//Message processing //Message processing
// noinspection SpellCheckingInspection // noinspection SpellCheckingInspection
if (message.content.toLowerCase().includes('nigg' || 'negro' || 'niglet' || 'fag' || 'f4g' || 'n1gg' || 'gg3r')) { if (message.content.toLowerCase().
await message.delete(); includes('nigg' || 'negro' || 'niglet' || 'fag' || 'f4g' || 'n1gg' ||
return message.reply(`Listen here cum-sock we dont appreciate 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...`) 'gg3r')) {
} await message.delete();
return message.reply(
`Listen here cum-sock we dont appreciate 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.
// 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 (message.author.bot) return; if (command === 'stats') {
if (message.content.indexOf(config.prefix) !== 0) return; let embed = new Discord.MessageEmbed().setTitle('Stats').
// Here we separate our "command" name, and our "arguments" for the command. setAuthor('Osselbot',
// e.g. if we have the message "+say Is this the real life?" , we'll get the following: 'https://cdn.discordapp.com/attachments/597814181084921866' +
// command = say '/711843993914310656/animated-beach-balls-29.gif').
// args = ["Is", "this", "the", "real", "life?"] setColor(0x195080).
const args = message.content.slice(config.prefix.length).trim().split(/ +/g); setDescription(`\
const command = args.shift().toLowerCase();
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////COMMAND TIME////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
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 \ **Stats for 0SSELB0T** \n \
**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 v${info.version} 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);
} }
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
if (command === "ping") { if (command === 'ping') {
// Calculates ping between sending a message and editing it, giving a nice round-trip latency. // Calculates ping between sending a message and editing it, giving a
const m = await message.channel.send("Ping?"); // nice round-trip latency.
await m.edit(`Pong! Latency is ${client.ws.ping}ms`); const m = await message.channel.send('Ping?');
} await m.edit(`Pong! Latency is ${client.ws.ping}ms`);
}
//HOW QUOTEABLE //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") 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") return message.channel.send(
} 'Dont Ask, Just ask!\n https://iki.fi/sol/dontask.html');
}
if (command === "simp") { 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))) if (!message.member.roles.cache.some(r => [
return message.reply("Sorry, you don't have permissions to use this!"); 'Admin',
let embed = new Discord.MessageEmbed() 'Moderator',
.setTitle("SIMP Alert") 'Member of the Order of the b l u e',
.setURL("https://www.youtube.com/watch?v=c3m4Q07TkMk") 'Botmeister'].includes(r.name)))
.setColor(0x195080) return message.reply('Sorry, you don\'t have permissions to use this!');
.setDescription("__**ALERT**__ SIMP detected!") let embed = new Discord.MessageEmbed().setTitle('SIMP Alert').
.setImage("https://vignette.wikia.nocookie.net/disney/images/6/64/Kronk_.jpg/revision/latest?cb=20160720194635") setURL('https://www.youtube.com/watch?v=c3m4Q07TkMk').
.setTimestamp() setColor(0x195080).
await message.channel.send({embed}) setDescription('__**ALERT**__ SIMP detected!').
} setImage(
'https://vignette.wikia.nocookie.net/disney/images/6/64/' +
'Kronk_.jpg/revision/latest?cb=20160720194635').
setTimestamp();
await message.channel.send({embed});
}
if (command === "squad") { if (command === 'squad') {
let min = Math.ceil(0); let min = Math.ceil(0);
let max = Math.floor(11); let max = Math.floor(11);
let rate = Math.floor(Math.random() * (max - min) + min); //The maximum is exclusive and the minimum is inclusive //The maximum is exclusive and the minimum is inclusive
return message.reply(`The squad rates this ${rate} out of 10`); let rate = Math.floor(Math.random() * (max - min) + min);
} 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'"); 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/'); return message.reply('https://technicolor.2a03.party/bot/');
} }
if (command === "fix") { if (command === 'fix') {
if (message.member.roles.cache.some(r => ["Ally of the Order"].includes(r.name))) { if (message.member.roles.cache.some(
return message.channel.send("I guess it's my fault will fix."); r => ['Ally of the Order'].includes(r.name))) {
} return message.channel.send('I guess it\'s my fault will fix.');
return; }
} return;
}
if (command === "va") { if (command === 'va') {
let num = Math.floor(Math.random() * (config.verbalabuse.length + 1)); //The maximum is exclusive and the minimum is inclusive //The maximum is exclusive and the minimum is inclusive
return message.reply(`${config.verbalabuse[num]}`) let num = Math.floor(Math.random() * (config.verbalabuse.length + 1));
} return message.reply(`${config.verbalabuse[num]}`);
}
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
if (command === "say") { if (command === 'say') {
// makes the bot say something and delete the message. As an example, it's open to anyone to use. // makes the bot say something and delete the message. As an example,
// To get the "message" itself we join the `args` back into a string with spaces: // it's open to anyone to use.To get the "message" itself we join the `args`
const sayMessage = args.join(" "); // back into a string with spaces:
if (message.member.roles.cache.some(r => ["Admin", "Mods", "Member of the Order", "Botmeister", "Ally of the Order", "say"].includes(r.name))) { const sayMessage = args.join(' ');
if (message.content.includes("@")) { if (message.member.roles.cache.some(r => [
return message.reply("haha no") 'Admin',
} 'Mods',
// Then we delete the command message (sneaky, right?). The catch just ignores the error with a cute smiley thing. 'Member of the Order',
'Botmeister',
'Ally of the Order',
'say'].includes(r.name))) {
if (message.content.includes('@')) {
return message.reply('haha no');
}
// Then we delete the command message (sneaky, right?). The catch just
// ignores the error with a cute smiley thing.
message.delete().catch(() => { message.delete().catch(() => {
}); });
// And we get the bot to say the thing: // And we get the bot to say the thing:
return message.channel.send(sayMessage); return message.channel.send(sayMessage);
} }
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
if (command === "quote") { if (command === 'quote') {
let quotes = require(`${homedir}/quotes.json`); let quotes = require(`${homedir}/quotes.json`);
let quoteadd = ""; let quoteadd = '';
let selector; let selector;
try { try {
selector = args[0].toLowerCase(); selector = args[0].toLowerCase();
} catch (err) { } catch (err) {
let number = quotes.quotes.length; let number = quotes.quotes.length;
let quotesend = Math.floor(Math.random() * (number + 1)); let quotesend = Math.floor(Math.random() * (number + 1));
return message.channel.send(`${quotes.quotes[quotesend]}`); return message.channel.send(`${quotes.quotes[quotesend]}`);
} }
if (selector === "add") { if (selector === 'add') {
args.shift(); args.shift();
//This does logic to make it from an array to a nice string. //This does logic to make it from an array to a nice string.
quoteadd = args.join(' '); quoteadd = args.join(' ');
quotes.quotes.push(quoteadd) quotes.quotes.push(quoteadd);
fs.writeFile(`${homedir}/quotes.json`, JSON.stringify(quotes, null, 2), (err) => { fs.writeFile(`${homedir}/quotes.json`, JSON.stringify(quotes, null, 2),
if (err) return message.reply("Something went wrong"); (err) => {
client.channels.cache.get('712084662033580064').send(`${message.member} has submitted \`${quoteadd}\` to the quote repository`); if (err) return message.reply('Something went wrong');
return message.reply("Quote added to repository"); client.channels.cache.get('712084662033580064').
}); send(
} else { `${message.member} has submitted \`${quoteadd}\` to the
return message.reply("you can add quotes by running `?quote add <person> Quote goes here`"); 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`')
}
}
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
if (command === "version") { if (command === 'version') {
return message.channel.send(`\`\`\`\ return message.channel.send(`\`\`\`\
________________________________________\n \ ________________________________________\n \
< @technicolor-creamsicle/osselbot@v${info.version}>\n \ < @technicolor-creamsicle/osselbot@v${info.version}>\n \
----------------------------------------\n \ ----------------------------------------\n \
\\ ^__^\n \ \\ ^__^\n \
\\ (oo)\\_______\n \ \\ (oo)\\_______\n \
(__)\\ )\\/\\\n \ (__)\\ )\\/\\\n \
||----w |\n \ ||----w |\n \
|| ||\n \ || ||\n \
\`\`\``) \`\`\``);
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////DEFCON////////////////////////////////////// ////////////////////////////////////DEFCON//////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
if (command === "defcon") { if (command === 'defcon') {
//5 levels till ban //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))) if (!message.member.roles.cache.some(r => [
return message.reply("Sorry, you don't have permissions to use this!"); 'Admin',
else { 'Member of the Order of the b l u e',
let member = message.mentions.members.first(); 'Botmeister'].includes(r.name)))
let role; return message.reply('Sorry, you don\'t have permissions to use this!');
switch (parseInt(args[1], 10)) { else {
case 5: let member = message.mentions.members.first();
role = message.guild.roles.cache.find(role => role.name === `DEFCON 5`); let role;
await member.roles.add(role); switch (parseInt(args[1], 10)) {
break; case 5:
case 4: role = message.guild.roles.cache.find(
role = message.guild.roles.cache.find(role => role.name === `DEFCON 4`); role => role.name === `DEFCON 5`);
await member.roles.add(role); await member.roles.add(role);
break; break;
case 3: case 4:
role = message.guild.roles.cache.find(role => role.name === `DEFCON 3`); role = message.guild.roles.cache.find(
await member.roles.add(role); role => role.name === `DEFCON 4`);
break; await member.roles.add(role);
case 2: break;
role = message.guild.roles.cache.find(role => role.name === `DEFCON 2`); case 3:
await member.roles.add(role); role = message.guild.roles.cache.find(
break; role => role.name === `DEFCON 3`);
case 1: await member.roles.add(role);
role = message.guild.roles.cache.find(role => role.name === `DEFCON 1`); break;
await member.roles.add(role); case 2:
break; role = message.guild.roles.cache.find(
default: role => role.name === `DEFCON 2`);
return message.reply(`DEFCON not set is ${args[1]} a number between 1-5?`); await member.roles.add(role);
} break;
return message.reply(`\n**DEFCON** level set to DEFCON ${args[1]}\nGod Bless their souls`); case 1:
} role = message.guild.roles.cache.find(
} role => role.name === `DEFCON 1`);
await 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`);
}
}
}); });
if (process.argv.slice(2).includes("--TEST")) { if (process.argv.slice(2).includes('--TEST')) {
console.log("Test Pass!"); console.log('Test Pass!');
process.exit(0); process.exit(0);
} }
//Logging in the bot //Logging in the bot
client.login(config.token).then(() => { client.login(config.token).then(() => {
console.log("Logged in") console.log('Logged in');
}); });