Skip to content

Heroku builder #191

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 19 commits into from
Oct 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
build:
docker:
# specify the version you desire here
- image: circleci/node:8.8.1
- image: circleci/node:10.16.3

# Specify service dependencies here if necessary
# CircleCI maintains a library of pre-built images
Expand Down
22 changes: 0 additions & 22 deletions .eslintrc.json

This file was deleted.

2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:8.8.1
FROM node:10.16.3

MAINTAINER Chapman@Apextion.com

Expand Down
6 changes: 3 additions & 3 deletions bot/botUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,16 @@ exports.generateCode = (n) => {
exports.isAdmin = (member) => {
const adminRoles = [
'Admin', 'Armada Officers', 'Armada Officer', 'Fleet Officer',
'Moderator', 'Tester', 'Team Captain', 'Full Sail Staff',
'Team Liaison', 'Armada Athlete',
'Moderator', 'Tester', 'Team Captain', 'Full Sail Staff', 'Privateers',
'Team Liaison', 'Armada Athlete', '@everyone', 'Crew',
'Overwatch_V', 'Overwatch_JV',
'CS:GO_V', 'CS:GO_JV',
'Smite_V', 'Smite_JV',
'Fortnite_V', 'Fortnite_JV',
'Madden_V', 'Madden_JV',
'LoL_V', 'LoL_JV',
'SuperSmashBros_V', 'SuperSmashBros_JV',
'HerosOfTheStorm_V', 'HerosOfTheStorm_JV',
'HeroesOfTheStorm_V', 'HeroesOfTheStorm_JV',
'RocketLeague_V', 'RocketLeague_JV',
'DragonBall_V', 'DragonBall_JV',
'Hearthstone_V', 'Hearthstone_JV',
Expand Down
4 changes: 2 additions & 2 deletions bot/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ client.on('message', (message) => {
util.log('Command message received', message.content, 0);

// Build basic help string
let helpString = 'v1.5.0 Discovered Commands:\n\n\t**<> - Required Item\t\t[] - Optional Item**';
let helpString = 'v1.6.0 Discovered Commands:\n\n\t**<> - Required Item\t\t[] - Optional Item**';

// Process message against every controller
Object.keys(controllers).forEach((key) => {
Expand Down Expand Up @@ -69,4 +69,4 @@ client.on('message', (message) => {
}
});

client.login(process.env.TOKEN);
client.login(process.env.DISCORD_BOT_TOKEN);
29 changes: 20 additions & 9 deletions bot/controllers/roles.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,20 @@ class RoleController extends BaseController {

// User roles commands cannot change
this.disallowedRoles = [
'admin', 'armada officers', 'armada officer',
'moderator', 'privateers', 'privateer',
'tester', 'crew', 'fleet officer', '@everyone',
'Admin', 'Armada Officers', 'Armada Officer', 'Fleet Officer',
'Moderator', 'Tester', 'Team Captain', 'Full Sail Staff', 'Privateers',
'Team Liaison', 'Armada Athlete', '@everyone', 'Crew',
'Overwatch_V', 'Overwatch_JV',
'CS:GO_V', 'CS:GO_JV',
'Smite_V', 'Smite_JV',
'Fortnite_V', 'Fortnite_JV',
'Madden_V', 'Madden_JV',
'LoL_V', 'LoL_JV',
'SuperSmashBros_V', 'SuperSmashBros_JV',
'HeroesOfTheStorm_V', 'HeroesOfTheStorm_JV',
'RocketLeague_V', 'RocketLeague_JV',
'DragonBall_V', 'DragonBall_JV',
'Hearthstone_V', 'Hearthstone_JV',
];
}

Expand All @@ -70,7 +81,7 @@ class RoleController extends BaseController {
const { message, disallowedRoles } = this;
const roles = [];
message.guild.roles.map((role) => {
if (!disallowedRoles.includes(role.name.toLowerCase())) {
if (!disallowedRoles.includes(role.name)) {
return roles.push(role.name);
}
return role.name;
Expand All @@ -85,7 +96,7 @@ class RoleController extends BaseController {
if (targetRole === null) {
util.log('No role matched', message.parsed[1], 2);
return '"' + message.parsed[1] + '" is not a known role. Try `!roles` to get a list of all Roles (They are case-sensitive)';
} else if (disallowedRoles.includes(targetRole.name.toLowerCase())) {
} else if (disallowedRoles.includes(targetRole.name)) {
util.log('User Tried to add a restricted/dissalowed role', targetRole.name, 2);
return 'You are not worthy of the role ' + message.parsed[1] + '.';
} else {
Expand All @@ -102,7 +113,7 @@ class RoleController extends BaseController {
util.log('Multiple Roles Parsing', roles, 4);

roles.map((role) => {
if (!disallowedRoles.includes(role.toLowerCase())) {
if (!disallowedRoles.includes(role)) {
const targetRole = message.guild.roles.find('name', role);
util.log('Asking API for Role', targetRole, 4);

Expand All @@ -125,7 +136,7 @@ class RoleController extends BaseController {
util.log('No role matched', message.parsed[1], 2);
return '"' + message.parsed[1] + '" is not a known role. Try `!roles` to get a list of all Roles (They are case-sensitive)';
}
if (disallowedRoles.includes(targetRole.name.toLowerCase())) {
if (disallowedRoles.includes(targetRole.name)) {
util.log('User Tried to add a restricted/dissalowed role', targetRole.name, 2);
return 'You have not the power or the will to control this power.';
}
Expand All @@ -139,7 +150,7 @@ class RoleController extends BaseController {
addAllRolesAction() {
const { message, disallowedRoles } = this;
message.guild.roles.map((role) => {
if (!disallowedRoles.includes(role.name.toLowerCase())) {
if (!disallowedRoles.includes(role.name)) {
return message.member.addRole(role).catch(util.log);
}
return role.name;
Expand All @@ -152,7 +163,7 @@ class RoleController extends BaseController {
removeAllRolesAction() {
const { message, disallowedRoles } = this;
message.guild.roles.map((role) => {
if (!disallowedRoles.includes(role.name.toLowerCase())) {
if (!disallowedRoles.includes(role.name)) {
return message.member.removeRole(role).catch(util.log);
}
return role.name;
Expand Down
17 changes: 12 additions & 5 deletions bot/controllers/verify.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class VerifyController extends BaseController {
verifyAction() {
const { message } = this;
const targetVerifiedRoleName = 'Crew';
const validDomains = ['student.fullsail.edu', 'fullsail.edu', 'fullsail.com'];
const validDomains = ['student.fullsail.edu', 'fullsail.edu', 'fullsail.com', 'alumni.fullsail.edu', 'staff.fullsail.com', 'staff.fullsail.edu'];
const timeoutInMiliseconds = 600000;
const email = message.parsed[1].toLowerCase();
const emailDomain = email.split('@').pop();
Expand Down Expand Up @@ -71,7 +71,7 @@ class VerifyController extends BaseController {
util.log('Collected', m.content, 3);
});
collector.on('end', (collected) => {
const verificationTimeout = `!verify timeout. Clap ${collected.author.username} in irons! Let's see how well they dance on the plank!`;
const verificationTimeout = `You failed to enter the !verify code in time... Prepare to be clapped in irons! Let's see how well you dance on the plank!`;
util.log('Items', collected.size, 3);
if (collected.size === 0) {
// TODO: ping admin team on verification fail
Expand All @@ -81,6 +81,13 @@ class VerifyController extends BaseController {
// Set up Nodemailer to send emails through gmail
const sendVerifyCode = nodemailer.createTransport({
service: 'gmail',
host: 'smtp.gmail.com',
port: 465,
secure: true,
tls: {
// do not fail on invalid certs
rejectUnauthorized: false
},
auth: {
user: process.env.EMAIL_USERNAME,
pass: process.env.EMAIL_PASS,
Expand All @@ -97,17 +104,17 @@ class VerifyController extends BaseController {
// Call sendMail on sendVerifyCode
// Pass mailOptions & callback function
sendVerifyCode.sendMail(mailOptions, (err, info) => {
const errorMsg = 'Oops, looks like the email can not be sent. It\'s not you, it\'s me. Please reach out to a moderator to help you verify.';
const errorMsg = 'Oops, looks like the email can not be sent. It\'s not you, it\'s me. Please reach out to a moderator to help you verify or email `FSArmada@fullsail.com` directly from your student account.';
if (err) {
message.reply(errorMsg);
util.log('Email not sent', err, 3);
util.log('Email not sent', err, 0);
} else {
util.log('Email details', info, 3);
}
});

util.log('Code', code, 3);
return `...What's the passcode? \n\n *eyes you suspicously*\n\n I just sent it to your email, just respond back to this channel within ${(timeoutInMiliseconds / 1000) / 60} minutes, with the code, and I won't treat you like a scurvy cur!`;
return `...What's the passcode? \n\n *eyes you suspiciously*\n\n I just sent it to your email, just respond back to this channel within ${(timeoutInMiliseconds / 1000) / 60} minutes, with the code, and I won't treat you like a scurvy cur!`;
} else {
return 'Sorry, I can only verify Full Sail University email addresses.';
}
Expand Down
14 changes: 14 additions & 0 deletions db/config/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
module.exports = {
development: {
database: process.env.MYSQL_DATABASE,
username: process.env.MYSQL_USER,
password: process.env.MYSQL_PASS,
host: process.env.MYSQL_HOST,
port: process.env.MYSQL_PORT,
dialect: 'mysql',
logging: false,
define: {
underscored: true
},
}
}
4 changes: 2 additions & 2 deletions db/migrations/20170920201305-create-member.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ module.exports = {
verified: {
type: Sequelize.BOOLEAN
},
createdAt: {
created_at: {
allowNull: false,
type: Sequelize.DATE,
defaultValue: Sequelize.fn('now'),
},
updatedAt: {
updated_at: {
allowNull: false,
type: Sequelize.DATE,
defaultValue: Sequelize.fn('now'),
Expand Down
2 changes: 1 addition & 1 deletion db/models/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const Sequelize = require('sequelize');

const basename = path.basename(module.filename);
const env = process.env.NODE_ENV || 'development';
const config = require(path.join(__dirname, '/../config/config.json'))[env];
const config = require(path.join(__dirname, '/../config/config.js'))[env];

const db = {};

Expand Down
29 changes: 9 additions & 20 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,35 +1,24 @@
{
"name": "max",
"version": "1.5.0",
"version": "1.6.0",
"description": "",
"main": "bot/client.js",
"engines": {
"node": "v8.8.1",
"npm": "5.5.1"
"node": "v10.16.3",
"npm": "6.9.0"
},
"scripts": {
"start": "pm2 start max.config.js --no-daemon",
"start": "node bot/client.js",
"test": "mocha"
},
"keywords": [],
"author": "Chapman - Chapman@Apextion.com",
"dependencies": {
"apex-util": "^2.0.3",
"chai": "^4.1.1",
"discord.js": "11.4.0",
"dotenv": "^4.0.0",
"eslint": "^4.3.1",
"eslint-config-airbnb": "^15.1.0",
"eslint-config-airbnb-standard": "^1.4.1",
"eslint-plugin-import": "^2.7.0",
"eslint-plugin-jsx-a11y": "^5.1.1",
"eslint-plugin-react": "^7.1.0",
"gulp": "^3.9.1",
"mocha": "^3.5.0",
"mocha-eslint": "^4.1.0",
"mysql2": "^1.4.2",
"nodemailer": "^4.4.0",
"sequelize": "^4.22.5",
"uuid": "^3.1.0"
"discord.js": "^11.5.1",
"mysql2": "^1.6.5",
"nodemailer": "^6.3.1",
"sequelize": "^5.15.2",
"uuid": "^3.3.3"
}
}
38 changes: 0 additions & 38 deletions test/__eslint.js

This file was deleted.

7 changes: 0 additions & 7 deletions test/__roles.js

This file was deleted.