Compare commits

..

No commits in common. "master" and "v2.0.2" have entirely different histories.

19 changed files with 549 additions and 378 deletions

17
.github/workflows/dockerimage.yml vendored Normal file
View File

@ -0,0 +1,17 @@
name: Docker Image CI
on:
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Build the Docker image
run: docker build . --file Dockerfile --tag osselbot:$(date +%s)

20
.github/workflows/dockerpub.yml vendored Normal file
View File

@ -0,0 +1,20 @@
name: Publish Docker image
on:
release:
types: [published]
jobs:
push_to_registry:
name: Push Docker image to GitHub Packages
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v2
- name: Push to GitHub Packages
uses: docker/build-push-action@v1
with:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
registry: docker.pkg.github.com
repository: techniclor-creamsicle/osselbot/osselbot
tag_with_ref: true

20
.github/workflows/dockerpub3.yml vendored Normal file
View File

@ -0,0 +1,20 @@
name: Publish Docker image
on:
release:
types: [published]
jobs:
push_to_registry:
name: Push Docker image to GitHub Packages
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v2
- name: Push to GitHub Packages
uses: docker/build-push-action@v1
with:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
registry: docker.pkg.github.com
repository: techniclor-creamsicle/osselbot/osselbot
tag_with_ref: true

View File

@ -1,29 +0,0 @@
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: Node.js CI
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: npm run build --if-present
- run: npm test

2
.gitignore vendored
View File

@ -1,3 +1 @@
node_modules/ node_modules/
.DS_Store
/src/config.json

17
Dockerfile Normal file
View File

@ -0,0 +1,17 @@
# Use the official image as a parent image.
FROM node:current-slim
# Set the working directory.
WORKDIR ./DOCKER
# Copy the file from your host to your current location.
COPY ./package.json .
COPY ./package-lock.json .
# Run the command inside your image filesystem.
RUN npm install
# Run the specified command within the container.
CMD [ "npm", "start" ]
# Copy the rest of your app's source code from your host to your image filesystem.
COPY ./src/ .

View File

@ -1,28 +1,5 @@
# Osselbot # Osselbot
A bot that is kinda stupid, but it works surprisingly well A bot that is kinda stupid but it works surprisingly well
![Node.js CI](https://github.com/Technicolor-creamsicle/Osselbot/workflows/Node.js%20CI/badge.svg)
**THIS BOT REQUIRES HEAVY MODIFICATION TO WORK ON OTHER SERVERS!** ![Docker Image CI](https://github.com/Technicolor-creamsicle/Osselbot/workflows/Docker%20Image%20CI/badge.svg)
**NPM PACKAGE IS NO LONGER MAINTAINED**
Example config.js to be placed in /src
```json
{
"token" : "API KEY",
"prefix": "?",
"verbalabuse": [
"Quotes",
"to insult.",
"your members."
]
}
```
---
# 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.

10
build.sh Executable file
View File

@ -0,0 +1,10 @@
#!/usr/bin/env bash
#logs in as Alex
cat ~/.GHTOKEN | docker login https://docker.pkg.github.com -u technicolor-creamsicle --password-stdin
#Builds the package
docker build --tag osselbot .
#pushes to github
docker tag osselbot:latest docker.pkg.github.com/techniclor-creamsicle/osselbot/osselbot:$1
docker push docker.pkg.github.com/techniclor-creamsicle/osselbot/osselbot:$1
echo build may have passed using version: $1

View File

@ -1 +0,0 @@
# Welcome to the osselbot help docs

12
old stuff/bot-start.sh Executable file
View File

@ -0,0 +1,12 @@
#!/usr/bin/env bash
echo "Updating"
#Update Node Based stuff
cd /home/ec2-user/github/Osselbot/
nvm node
npm upgrade
#update code
git pull --force
#Starts the bot
cd ./src
echo "STARTING"
node index.js

286
old stuff/old.js Executable file
View File

@ -0,0 +1,286 @@
// Here we load the config.json file that contains our token and our prefix values.
const config = require("./config.json");
// config.token contains the bot's token
// config.prefix contains the message prefix.
//Activity setting
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' });
});
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' });
});
client.on("guildDelete", guild => {
// this event triggers when the bot is removed from a guild.
console.log(`I have been removed from: ${guild.name} (id: ${guild.id})`);
client.user.setActivity(`${client.users.cache.size} of you horrible people`,{ type: 'LISTENING' });
});
//Actual command stuff
client.on("message", async message => {
// This event will run on every single message received, from any channel or DM.
// It's good practice to ignoe other bots. This also makes your bot ignore itself
// and not get into a spam loop (we call that "botception ").
if(message.author.bot) return;
//people are assholes so this blocks it!
if(message.content.toLowerCase().includes('nigger',"nigga","niglet","nigglet")){
message.member.roles.add('654366653093642241').catch(console.error);
message.member.roles.remove('514254335425773589').catch(console.error);
console.log(`${message.member} has been detained`)
return message.reply('Member has been D E T A I N E D <:yikes:632660765878255636>')
}
// Also good practice to ignore any message that does not start with our prefix,
// which is set in the configuration file.
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();
// Let's go with a few common example commands! Feel free to delete or change those.
if(command === "ping") {
// Calculates ping between sending a message and editing it, giving a nice round-trip latency.
// The second ping is an average latency between the bot and the websocket server (one-way, not round-trip)
const m = await message.channel.send("Ping?");
m.edit(`Pong! Latency is ${m.createdTimestamp - message.createdTimestamp}ms`);
}
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 of the b l u e","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.
message.delete().catch(O_o=>{});
// And we get the bot to say the thing:
return message.channel.send(sayMessage);
}
else {
return message.channel.send("Im sorry but we cant have nice things...")
}
}
if(command === "kick") {
// This command must be limited to mods and admins. In this example we just hardcode the role names.
// Please read on Array.some() to understand this bit:
// https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Array/some?
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's first check if we have a member and if we can kick them!
// message.mentions.members is a collection of people that have been mentioned, as GuildMembers.
// We can also support getting the member by ID, which would be args[0]
let member = message.mentions.members.first() || message.guild.members.get(args[0]);
if(!member)
return message.reply("Please mention a valid member of this server");
if(!member.kickable)
return message.reply("I cannot kick this user! Do they have a higher role? Do I have kick permissions?");
// slice(1) removes the first part, which here should be the user mention or ID
// join(' ') takes all the various parts to make it a single string.
let reason = args.slice(1).join(' ');
if(!reason) reason = "No reason provided";
// Now, time for a swift kick in the nuts!
await member.kick(reason)
.catch(error => message.reply(`Sorry ${message.author} I couldn't kick because of : ${error}`));
message.reply(`${member.user.tag} has been kicked by ${message.author.tag} because: ${reason}`);
}
if(command === "ban") {
// Most of this command is identical to kick, except that here we'll only let admins do it.
// In the real world mods could ban too, but this is just an example, right? ;)
if(!message.member.roles.cache.some(r=>["Administrator","Member of the Order of the b l u e"].includes(r.name)) )
return message.reply("Sorry, you don't have permissions to use this!");
let member = message.mentions.members.first();
if(!member)
return message.reply("Please mention a valid member of this server");
if(!member.bannable)
return message.reply("I cannot ban this user! Do they have a higher role? Do I have ban permissions?");
let reason = args.slice(1).join(' ');
if(!reason) reason = "No reason provided";
await member.ban(reason)
.catch(error => message.reply(`Sorry ${message.author} I couldn't ban because of : ${error}`));
message.reply(`${member.user.tag} has been banned by ${message.author.tag} because: ${reason}`);
}
if(command === "purge") {
//Vibe check
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!");
// This command removes all messages from all users in the channel, up to 100.
else {
// get the delete count, as an actual number.
const deleteCount = parseInt(args[0], 10);
// Ooooh nice, combined conditions. <3
if(!deleteCount || deleteCount < 2 || deleteCount > 100)
return message.reply("Please provide a number between 2 and 100 for the number of messages to delete");
// So we get our messages, and delete them. Simple enough, right?
const fetched = await message.channel.messages.fetch({limit: deleteCount});
message.channel.bulkDelete(fetched)
.catch(error => message.reply(`Couldn't delete messages because of: ${error}`));
}
};
if(command === "detain") {
//For Civilians all partying
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!");
let member = message.mentions.members.first();
if(!member)
return message.reply("Please mention a valid member of this server");
else {
member.roles.add('654366653093642241').catch(console.error);
member.roles.remove('514254335425773589').catch(console.error);
return message.reply("Member has been D E T A I N E D<:yikes:632660765878255636>\n**DEFCON** level increased\nGod Bless their souls")
}
}
if(command === "retain") {
//For Civilians all partying
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!");
let member = message.mentions.members.first();
if(!member)
return message.reply("Please mention a valid member of this server");
else {
member.roles.add('514254335425773589').catch(console.error);
member.roles.remove('654366653093642241').catch(console.error);
return message.reply("Member has been R E T A I N E D <:MilkTurtle:628399622678773760>")
}
}
// HERE COMES SHITTY COMMANDS MADE BY YOURS TRUELY
if(command === 'help') {
return message.reply('https://technicolor.2a03.party/bot/');
};
if(command === "rand") {
//Generates random number between 1-100
min = Math.ceil(0);
max = Math.floor(101);
return message.channel.send(Math.floor(Math.random() * (max - min)) + min); //The maximum is exclusive and the minimum is inclusive
};
if(command === "oath") {
return message.reply("The cadet oath is as follows.\nI pledge that I will serve faithfully in the Civil Air Patrol cadet program. That I will attend meetings regularly, wear my uniform properly, obey my officers, and advance my education and training rapidly to prepare myself to be of service to my community state and nation.");
};
if(command === "ask") {
return message.channel.send("Dont Ask, Just ask!\n https://iki.fi/sol/dontask.html")
};
if(command === "damage") {
return message.channel.send("https://cdn.discordapp.com/attachments/619631814696239142/678467158660874270/ohmydamage.mov")
};
if(command === "osseley") {
return message.channel.send("Ohhh Osseley,\n how I missed you sooo much \nOne of these days...")
};
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 === "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") {
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 === "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")
.setColor(0x195080)
.setDescription("__**ALERT**__ SIMP detected!")
.setImage("https://vignette.wikia.nocookie.net/disney/images/6/64/Kronk_.jpg/revision/latest?cb=20160720194635")
.setTimestamp()
message.channel.send({embed})
}
//DEFCON Roles
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`);
member.roles.add(role);
break;
case 2:
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);
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 (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.");
};
return;
};
if (command === "stats") {
let embed = new Discord.MessageEmbed()
.setTitle('Stats')
.setColor(0x195080)
.setDescription(`\
**Stats for 0SSELB0T** \n \
**Uptime:** ${prettyMilliseconds(client.uptime)} \n \
**Started at:** ${client.readyAt} \n \
**People:** ${client.users.cache.size}\
`);
return message.channel.send(embed);
};
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' });
setTimeout(shutdown, 5000, 'shutdown');
}
else {
return message.reply("No");
};
};
});
client.login(config.token)

View File

@ -0,0 +1,17 @@
[Unit]
Description="Osselbot coded for civilians all partying"
[Service]
Type=simple
ExecStart=/home/ec2-user/Osselbot/src/bot-start.sh
Restart=on-failure
RestartSec=5s
User=ec2-user
# Note Debian/Ubuntu uses 'nogroup', RHEL/Fedora uses 'nobody'
Group=nobody
Environment=PATH=/usr/bin:/usr/local/bin
Environment=NODE_ENV=production
WorkingDirectory=/home/ec2-user/Osselbot/src/
[Install]
WantedBy=multi-user.target

5
old stuff/shard.js Normal file
View File

@ -0,0 +1,5 @@
const { ShardingManager } = require('discord.js');
const manager = new ShardingManager('./bot.js', { token: 'Njc4MDkzNjY4NzcwNTEyOTE3.XkdyyA.6n4wvPmzOw-fwuysEoTPU8Cv2x0' });
manager.spawn();
manager.on('shardCreate', shard => console.log(`Launched shard ${shard.id}`));

View File

@ -1,7 +0,0 @@
{
"folders": [
{
"path": "."
}
]
}

View File

@ -1,6 +1,6 @@
{ {
"name": "@technicolor-creamsicle/osselbot", "name": "osselbot",
"version": "2.1.2", "version": "1.1.0",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {
@ -79,9 +79,9 @@
} }
}, },
"n": { "n": {
"version": "6.6.0", "version": "6.5.1",
"resolved": "https://registry.npmjs.org/n/-/n-6.6.0.tgz", "resolved": "https://registry.npmjs.org/n/-/n-6.5.1.tgz",
"integrity": "sha512-Yk2z0OQKDCmDyBHltJRg2RsxPsdc2DHcM8fFN21j1rzqior+FifdqhvcbZ+k00EgiSvR6p8+s9whWLwvzSeqcw==" "integrity": "sha512-CSDShHuBlYHfS5PR4BxwkZYNrDnc3B7GCRdAhSvnzl681Pd4Y4qOOTWQqjB8Cp6gYOIQI9qJxLK0Q1YI4xO2Kg=="
}, },
"node-fetch": { "node-fetch": {
"version": "2.6.0", "version": "2.6.0",

View File

@ -1,27 +1,17 @@
{ {
"name": "@technicolor-creamsicle/osselbot", "name": "osselbot",
"version": "2.1.2", "version": "1.1.0",
"description": "A discord bot on Discord.js", "description": "Discordbot on Discord.js",
"main": "index.js", "main": "index.js",
"dependencies": { "dependencies": {
"discord.js": "^12.1.1", "discord.js": "^12.1.1",
"n": "^6.6.0", "n": "^6.4.0",
"node-fetch": "^2.6.0",
"pretty-ms": "^6.0.1" "pretty-ms": "^6.0.1"
}, },
"publishConfig": {
"registry": "https://npm.pkg.github.com/"
},
"bin": {
"osselbot": "./src/index.js"
},
"files": [
"/src/"
],
"devDependencies": {}, "devDependencies": {},
"scripts": { "scripts": {
"test": "node --trace-warnings ./src/index.js --TEST", "test": "echo \"Error: no test specified\" && exit 1",
"start": "node ./src/index.js" "start": "node ./index.js"
}, },
"repository": { "repository": {
"type": "git", "type": "git",

View File

@ -1 +0,0 @@
{"quotes":["you can add quotes by running ?quote add <person> Quote goes here","techt parm arm zarm","<@!258325046869622785> I HATE JS."]}

View File

@ -1,9 +1,4 @@
{ {
"COMMENT": "THIS IS A CONFIG FOR TESTING THE BOT", "token" : "Njc4MDkzNjY4NzcwNTEyOTE3.Xr7SNw.XS_D_dEJ7hX6N5Rmnfr_OQpfznU",
"token" : "THIS IS AN API TOKEN", "prefix" : ";"
"prefix": "?",
"verbalabuse": [
"THIS IS MEAN"
]
} }

349
src/index.js Executable file → Normal file
View File

@ -1,311 +1,156 @@
#!/usr/bin/env node #!/usr/bin/env node
// These 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 config = require("./config.json");
const homedir = require('os').homedir; // This is the client
const info = require('../package.json');
// Imports config file from the src dir.
const config = require('./config.json');
// This is making a client for discord
const client = new Discord.Client(); const client = new Discord.Client();
client.on("ready", () => {
// Stores the last quote
let last_quote;
function activity() {
//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', () => {
// This event will run if the bot starts, and logs in, successfully. // This event will run if the bot starts, and logs in, successfully.
// noinspection LongLine console.log(`Bot has started, with ${client.users.cache.size} users, in ${client.channels.cache.size} channels of ${client.guilds.cache.size} guilds.`);
console.log( // Example of changing the bot's playing game to something useful. `client.user` is what the
`Bot has started, with ${client.users.cache.size} users, in \ // docs refer to as the "ClientUser".
${client.channels.cache.size} channels of ${client.guilds.cache.size} guilds.`); client.user.setActivity(`${client.users.cache.size} of you horrible people`,{ type: 'LISTENING' });
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.name} (id: ${member.id}).`);
activity(); client.user.setActivity(`${client.users.cache.size} of you horrible people`,{ type: 'LISTENING' });
}); });
client.on('guildMemberRemove', member => { client.on('guildMemberRemove', member => {
console.log(` member left: ${member.nickname} (id: ${member.id}).`); console.log(` member left: ${member.name} (id: ${member.id}).`);
activity(); client.user.setActivity(`${client.users.cache.size} of you horrible people`,{ type: 'LISTENING' });
}); });
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
if (message.content.toLowerCase().
includes('nigg' || 'negro' || 'niglet' || 'fag' || 'f4g' || 'n1gg' ||
'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...`);
}
// Reacts to messages with UwU
if (message.content.toLowerCase().includes('uwu')) await message.react(
'741755736417108071');
if(message.author.bot) return; if(message.author.bot) return;
if(message.content.indexOf(config.prefix) !== 0) return; if(message.content.indexOf(config.prefix) !== 0) return;
// Here we separate our "command" name, and our "arguments" for the command. // 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 // e.g. if we have the message "+say Is this the real life?" , we'll get the following:
// following:
// command = say // command = say
// args = ["Is", "this", "the", "real", "life?"] // args = ["Is", "this", "the", "real", "life?"]
const args = message.content.slice(config.prefix.length).trim().split(/ +/g); const args = message.content.slice(config.prefix.length).trim().split(/ +/g);
const command = args.shift().toLowerCase(); const command = args.shift().toLowerCase();
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
//////////////////////////////////COMMAND TIME//////////////////////////////// //COMMAND TIME
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
if (command === "reboot"){
if (command === 'stats') { function shutdown(){
let embed = new Discord.MessageEmbed().setTitle('Stats'). client.destroy();
setAuthor('Osselbot', process.exit(69);
'https://cdn.discordapp.com/attachments/597814181084921866' + }
'/711843993914310656/animated-beach-balls-29.gif'). if (message.author.id === '216042720047661057') {
setColor(0x195080). message.reply("**Authenticated**, Restarting now.");
setDescription(`\ client.user.setActivity(`Itself die`,{ type: 'WATCHING' });
setTimeout(shutdown, 5000, 'shutdown');
}
else {
return message.reply("No");
};
};
//////////////////////////////////////////////////////////////////////////////
if (command === "stats") {
let embed = new Discord.MessageEmbed()
.setTitle('Stats')
.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`); `);
return message.channel.send(embed); return message.channel.send(embed);
} };
//////////////////////////////////////////////////////////////////////////////
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`);
};
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
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?');
await m.edit('Pong! Latency is`' + client.ws.ping + '` ms');
}
//HOW QUOTEABLE //HOW QUOTEABLE
if (command === 'psych') { if(command === "psych") {
return message.channel.send( 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")
'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( return message.channel.send("Dont Ask, Just ask!\n https://iki.fi/sol/dontask.html")
'Dont Ask, Just ask!\n https://iki.fi/sol/dontask.html'); };
}
if (command === 'simp') { if(command === "simp") {
if (!message.member.roles.cache.some(r => [ if(!message.member.roles.cache.some(r=>["Admin", "Moderator","Member of the Order of the b l u e","Botmeister"].includes(r.name)) )
'Admin', return message.reply("Sorry, you don't have permissions to use this!");
'Moderator', let embed = new Discord.MessageEmbed()
'Botmeister'].includes(r.name))) .setTitle("SIMP Alert")
return message.reply('Sorry, you don\'t have permissions to use this!'); .setURL("https://www.youtube.com/watch?v=c3m4Q07TkMk")
let embed = new Discord.MessageEmbed().setTitle('SIMP Alert'). .setColor(0x195080)
setURL('https://www.youtube.com/watch?v=c3m4Q07TkMk'). .setDescription("__**ALERT**__ SIMP detected!")
setColor(0x195080). .setImage("https://vignette.wikia.nocookie.net/disney/images/6/64/Kronk_.jpg/revision/latest?cb=20160720194635")
setDescription('__**ALERT**__ SIMP detected!'). .setTimestamp()
setImage( message.channel.send({embed})
'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); min = Math.ceil(0);
let max = Math.floor(11); max = Math.floor(11);
//The maximum is exclusive and the minimum is inclusive let rate = Math.floor(Math.random() * (max - min) + min); //The maximum is exclusive and the minimum is inclusive
let rate = Math.floor(Math.random() * (max - min) + min);
return message.reply(`The squad rates this ${rate} out of 10`); return message.reply(`The squad rates this ${rate} out of 10`);
} };
if (command === 'magic') { if(command === "magic") {
return message.channel.send( 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\'");
'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/osselbot/'); return message.reply('https://technicolor.2a03.party/bot/');
} };
if (command === 'fix') { if (command === "fix") {
if (message.member.roles.cache.some( if(message.member.roles.cache.some(r=>["Botmeister"].includes(r.name))) {
r => ['Ally of the Order'].includes(r.name))) { return message.channel.send("I guess it\'s my fault will fix.");
return message.channel.send('I guess it\'s my fault will fix.'); };
}
return; return;
} };
if (command === 'va') {
//The maximum is exclusive and the minimum is inclusive
let num = Math.floor(Math.random() * (config.verbalabuse.length + 1));
return message.reply(`${config.verbalabuse[num]}`);
}
////////////////////////////////////////////////////////////////////////////////
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))) {
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(() => {
});
// And we get the bot to say the thing:
return message.channel.send(sayMessage);
}
}
////////////////////////////////////////////////////////////////////////////////
if (command === 'quote') {
let quotes = require(`${homedir}/quotes.json`);
let quoteadd = '';
let selector;
try {
selector = args[0].toLowerCase();
} catch (err) {
let length = quotes.quotes.length;
let quotesend = 0;
function choose() {
quotesend = Math.floor(Math.random() * (length));
console.log(quotesend);
if (last_quote === quotesend) choose();
}
choose();
last_quote = quotesend;
return message.channel.send(`${quotes.quotes[quotesend]}`);
}
if (selector === 'add') {
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.reply(
'you can add quotes by running `?quote add <person> Quote goes here`')
}
}
////////////////////////////////////////////////////////////////////////////////
if (command === 'version') {
return message.channel.send(`\`\`\`\
________________________________________\n \
< @technicolor-creamsicle/osselbot@v${info.version}>\n \
----------------------------------------\n \
\\ ^__^\n \
\\ (oo)\\_______\n \
(__)\\ )\\/\\\n \
||----w |\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 => [ if(!message.member.roles.cache.some(r=>["Admin","Member of the Order of the b l u e","Botmeister"].includes(r.name)) )
'Admin'].includes(r.name))) return message.reply("Sorry, you don't have permissions to use this!");
return message.reply('Sorry, you don\'t have permissions to use this!');
else { else {
let member = message.mentions.members.first(); let member = message.mentions.members.first();
let role; var role = "";
switch(parseInt(args[1],10)) { switch(parseInt(args[1],10)) {
case 5: case 5:
role = message.guild.roles.cache.find( var role = message.guild.roles.cache.find(role => role.name === `DEFCON 5`);
role => role.name === `DEFCON 5`); member.roles.add(role);
await member.roles.add(role);
break; break;
case 4: case 4:
role = message.guild.roles.cache.find( var role = message.guild.roles.cache.find(role => role.name === `DEFCON 4`);
role => role.name === `DEFCON 4`); member.roles.add(role);
await member.roles.add(role);
break; break;
case 3: case 3:
role = message.guild.roles.cache.find( var role = message.guild.roles.cache.find(role => role.name === `DEFCON 3`);
role => role.name === `DEFCON 3`); member.roles.add(role);
await member.roles.add(role);
break; break;
case 2: case 2:
role = message.guild.roles.cache.find( var role = message.guild.roles.cache.find(role => role.name === `DEFCON 2`);
role => role.name === `DEFCON 2`); member.roles.add(role);
await member.roles.add(role);
break; break;
case 1: case 1:
role = message.guild.roles.cache.find( var role = message.guild.roles.cache.find(role => role.name === `DEFCON 1`);
role => role.name === `DEFCON 1`); member.roles.add(role);
await member.roles.add(role);
break; break;
default: default:
return message.reply( return message.reply(`DEFCON not set is ${args[1]} a number between 1-5?`)
`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`)
return message.reply( };
`\n**DEFCON** level set to DEFCON ${args[1]}\nGod Bless their souls`); };
}
}
}); });
if (process.argv.slice(2).includes('--TEST')) {
console.log('Test Pass!');
process.exit(0);
}
//Logging in the bot //Logging in the bot
client.login(config.token).then(() => { client.login(config.token)
console.log('Logged in');
});