Skip to content
Open
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
104 changes: 104 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.test

# parcel-bundler cache (https://parceljs.org/)
.cache

# Next.js build output
.next

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and *not* Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port
112 changes: 35 additions & 77 deletions apply.js
Original file line number Diff line number Diff line change
@@ -1,95 +1,53 @@
const Discord = require('discord.js')

const client = new Discord.Client()

const { Client, Discord, MessageEmbed } = require("discord.js");
const config = require('./config.json')
const client = new Client({
disableEveryone: true
});
require('./server.js');

client.on('ready', () => {
console.log(`${client.user.tag} is online!`)

})

let count = 0
let answer = []

process.on('unhandledRejection', error => console.log(error));
process.on('uncaughtException', error => console.log(error));

client.on('message', async message => {

let args = message.content.slice(config.prefix.length).trim().split(/ +/)
let command = args.shift().toLowerCase()


let questions = {
firstQuestion: "Are you familiar with Github ? ``Yes/No``",
secondQuestion: "How long are you online a day ?",
thirdQuestion: "When you get stuck on a problem, what do you do ?",
fourthQuestion: "How old are you ?",
fifthQuestion: "Are you ready to work in a team and move it forward in a meaningful way ? ``Yes/No``",
}
let questions = [
{ question: "Are you familiar with Github ? ``Yes/No``" },
{ question: "How long are you online a day ?" },
{ question: "When you get stuck on a problem, what do you do ?" },
{ question: "How old are you ?" },
{ question: "Are you ready to work in a team and move it forward in a meaningful way ? ``Yes/No``" },
]


if (!message.content.startsWith(config.prefix) || message.author.bot) return
if (command === "apply") {
message.channel.send("I have started this process in your DM's. Type `cancel` to cancel")
message.author.send(questions.firstQuestion).then(msg => {
for (let i = 0; i < questions.length; i++) {
const send = await message.author.send(questions[i].question)
const filter1 = m => m.author.id === message.author.id
msg.channel.awaitMessages(filter1, {
time: 5 * 60000,
max: 1
}).then(messages => {
let msg1 = messages.first().content
if(msg1.toLowerCase() === "cancel") return message.author.send("Ok, I have cancelled this process")
message.author.send(questions.secondQuestion).then(msg => {
const filter1 = m => m.author.id === message.author.id
msg.channel.awaitMessages(filter1, {
time: 5 * 60000,
max: 1
}).then(messages => {
let msg2 = messages.first().content
if(msg2.toLowerCase() === "cancel") return message.author.send("Ok, I have cancelled this process")
message.author.send(questions.thirdQuestion).then(msg => {
const filter1 = m => m.author.id === message.author.id
msg.channel.awaitMessages(filter1, {
time: 5 * 60000,
max: 1
}).then(messages => {
let msg3 = messages.first().content
if(msg3.toLowerCase() === "cancel") return message.author.send("Ok, I have cancelled this process")
message.author.send(questions.fourthQuestion).then(msg => {
const filter1 = m => m.author.id === message.author.id
msg.channel.awaitMessages(filter1, {
time: 5 * 60000,
max: 1
}).then(messages => {
let msg4 = messages.first().content
if(msg4.toLowerCase() === "cancel") return message.author.send("Ok, I have cancelled this process")
message.author.send(questions.fifthQuestion).then(msg => {
const filter1 = m => m.author.id === message.author.id
msg.channel.awaitMessages(filter1, {
time: 5 * 60000,
max: 1
}).then(messages => {
let msg5 = messages.first().content
if(msg5.toLowerCase() === "cancel") return message.author.send("Ok, I have cancelled this process")
message.author.send("Subbmitted application! ``made by captain motchy``").then(msg => {
message.client.channels.cache.get(config.applicationChannel).send(
new Discord.MessageEmbed()
.setTitle('Application Submitted')
.setDescription(`This application was submitted by ${message.author.tag} (${message.author.id}).\nCreated: ${message.author.createdAt}`)
.addField(questions.firstQuestion, "Answer: " + msg1)
.addField(questions.secondQuestion, "Answer: " + msg2)
.addField(questions.thirdQuestion, "Answer: " + msg3)
.addField(questions.fourthQuestion, "Answer: " + msg4)
.addField(questions.fifthQuestion, "Answer: " + msg5)
)
})
})
})
})
})
})
})
})
})
})
})
}
const res = await send.channel.awaitMessages(filter1, { time: 5 * 60000, max: 1 })
const msg = await res.first().content
if (msg !== undefined || null) count++
answer.push(msg)
if (count == questions.length) {
message.author.send("Subbmitted application! ``made by captain motchy``")
const embed = new MessageEmbed()
.setTitle('Application Submitted')
.setDescription(`This application was submitted by ${message.author.tag} (${message.author.id}).\nCreated: ${message.author.createdAt}`)
for (let i = 0; i < questions.length; i++) embed.addField(questions[i].question, `Answer: \`${answer[i]}\``)
message.client.channels.cache.get(config.applicationChannel).send(embed)
}
}
}

if(command === "decline"){
if(!message.member.hasPermission("ADMINISTRATOR")) return message.channel.send("you dont' have permission to use this command")
Expand All @@ -106,4 +64,4 @@ client.on('message', async message => {
}
})

client.login(config.token)
client.login(config.token || process.env.TOKEN)
117 changes: 33 additions & 84 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,105 +1,54 @@

const { Client } = require("discord.js");
const keepAlive = require('./server.js');

const { Client, Discord, MessageEmbed } = require("discord.js");
const config = require('./config.json')
const client = new Client({
disableEveryone: true
});

keepAlive();
client.login(process.env.TOKEN);



const config = require('./config.json')
const Discord = require('discord.js')
require('./server.js');

client.on('ready', () => {
console.log(`${client.user.tag} is online!`)

})

let count = 0
let answer = []

process.on('unhandledRejection', error => console.log(error));
process.on('uncaughtException', error => console.log(error));

client.on('message', async message => {

let args = message.content.slice(config.prefix.length).trim().split(/ +/)
let command = args.shift().toLowerCase()


let questions = {
firstQuestion: "Are you familiar with Github ? ``Yes/No``",
secondQuestion: "How long are you online a day ?",
thirdQuestion: "When you get stuck on a problem, what do you do ?",
fourthQuestion: "How old are you ?",
fifthQuestion: "Are you ready to work in a team and move it forward in a meaningful way ? ``Yes/No``",
}
let questions = [
{ question: "Are you familiar with Github ? ``Yes/No``" },
{ question: "How long are you online a day ?" },
{ question: "When you get stuck on a problem, what do you do ?" },
{ question: "How old are you ?" },
{ question: "Are you ready to work in a team and move it forward in a meaningful way ? ``Yes/No``" },
]


if (!message.content.startsWith(config.prefix) || message.author.bot) return
if (command === "apply") {
message.channel.send("I have started this process in your DM's. Type `cancel` to cancel")
message.author.send(questions.firstQuestion).then(msg => {
for (let i = 0; i < questions.length; i++) {
const send = await message.author.send(questions[i].question)
const filter1 = m => m.author.id === message.author.id
msg.channel.awaitMessages(filter1, {
time: 5 * 60000,
max: 1
}).then(messages => {
let msg1 = messages.first().content
if(msg1.toLowerCase() === "cancel") return message.author.send("Ok, I have cancelled this process")
message.author.send(questions.secondQuestion).then(msg => {
const filter1 = m => m.author.id === message.author.id
msg.channel.awaitMessages(filter1, {
time: 5 * 60000,
max: 1
}).then(messages => {
let msg2 = messages.first().content
if(msg2.toLowerCase() === "cancel") return message.author.send("Ok, I have cancelled this process")
message.author.send(questions.thirdQuestion).then(msg => {
const filter1 = m => m.author.id === message.author.id
msg.channel.awaitMessages(filter1, {
time: 5 * 60000,
max: 1
}).then(messages => {
let msg3 = messages.first().content
if(msg3.toLowerCase() === "cancel") return message.author.send("Ok, I have cancelled this process")
message.author.send(questions.fourthQuestion).then(msg => {
const filter1 = m => m.author.id === message.author.id
msg.channel.awaitMessages(filter1, {
time: 5 * 60000,
max: 1
}).then(messages => {
let msg4 = messages.first().content
if(msg4.toLowerCase() === "cancel") return message.author.send("Ok, I have cancelled this process")
message.author.send(questions.fifthQuestion).then(msg => {
const filter1 = m => m.author.id === message.author.id
msg.channel.awaitMessages(filter1, {
time: 5 * 60000,
max: 1
}).then(messages => {
let msg5 = messages.first().content
if(msg5.toLowerCase() === "cancel") return message.author.send("Ok, I have cancelled this process")
message.author.send("Subbmitted application! ``made by captain motchy``").then(msg => {
message.client.channels.cache.get(config.applicationChannel).send(
new Discord.MessageEmbed()
.setTitle('Application Submitted')
.setDescription(`This application was submitted by ${message.author.tag} (${message.author.id}).\nCreated: ${message.author.createdAt}`)
.addField(questions.firstQuestion, "Answer: " + msg1)
.addField(questions.secondQuestion, "Answer: " + msg2)
.addField(questions.thirdQuestion, "Answer: " + msg3)
.addField(questions.fourthQuestion, "Answer: " + msg4)
.addField(questions.fifthQuestion, "Answer: " + msg5)
)
})
})
})
})
})
})
})
})
})
})
})
}
const res = await send.channel.awaitMessages(filter1, { time: 5 * 60000, max: 1 })
const msg = await res.first().content
if (msg !== undefined || null) count++
answer.push(msg)
if (count == questions.length) {
message.author.send("Subbmitted application! ``Made by RainyXeon``")
const embed = new MessageEmbed()
.setTitle('Application Submitted')
.setDescription(`This application was submitted by ${message.author.tag} (${message.author.id}).\nCreated: ${message.author.createdAt}`)
for (let i = 0; i < questions.length; i++) embed.addField(questions[i].question, `Answer: \`${answer[i]}\``)
message.client.channels.cache.get(config.applicationChannel).send(embed)
}
}
}

if(command === "decline"){
if(!message.member.hasPermission("ADMINISTRATOR")) return message.channel.send("you dont' have permission to use this command")
Expand All @@ -116,4 +65,4 @@ client.on('message', async message => {
}
})

client.login(config.token)
client.login(config.token || process.env.TOKEN)
Loading