commit 76cce6e950167b4181a67f105cbc513856739ef4
parent 430320067b5aecd29d7fa48f683ec4052fdd8ea7
Author: underd0g1 <hide4@comcast.net>
Date: Thu, 10 Sep 2020 18:26:03 -0400
added tools.js
Diffstat:
8 files changed, 125 insertions(+), 143 deletions(-)
diff --git a/buddy1.js b/buddy1.js
@@ -40,46 +40,46 @@ member.newmember(client)
- function multiplyCommand(arguements, receivedMessage){
- if (arguements.length < 2){
- receivedMessage.channel.send('not enough arguements, you need 2')
- }else{
- let product = 1
- arguements.forEach((value)=>{
- product = product * parseFloat(value)
- })
- receivedMessage.channel.send('the product of ' + arguements + 'is '+ product.toString())
- }
- }
-
-
-function helpCommand(arguements, receivedMessage){
- if (arguements.length == 0 ){
- receivedMessage.channel.send(`
- Here are some commands you can throw at me (![command]):
- - multiply[x y]
- - iss
- - code
- - beer
- - joke
- `)
- }
- else{
- receivedMessage.channel.send('looks like you need help with ' + arguements)
- }
-}
-
-
-function time(arguements, receivedMessage){
- var date = new date()
- var hours = date.getHours()
- if (hours == 3){
- receivedMessage.channel.send('Good morning Everyone!')
- }else if (hours == 12){
- receivedMessage.channel.send("its Noon O'Clock")
- } else if(hours == 17){
- receivedMessage.channel.send('Good Evening everyone!')
- }
-}
+// function multiplyCommand(arguements, receivedMessage){
+// if (arguements.length < 2){
+// receivedMessage.channel.send('not enough arguements, you need 2')
+// }else{
+// let product = 1
+// arguements.forEach((value)=>{
+// product = product * parseFloat(value)
+// })
+// receivedMessage.channel.send('the product of ' + arguements + 'is '+ product.toString())
+// }
+// }
+//
+//
+// function helpCommand(arguements, receivedMessage){
+// if (arguements.length == 0 ){
+// receivedMessage.channel.send(`
+// Here are some commands you can throw at me (![command]):
+// - multiply[x y]
+// - iss
+// - code
+// - beer
+// - joke
+// `)
+// }
+// else{
+// receivedMessage.channel.send('looks like you need help with ' + arguements)
+// }
+// }
+//
+//
+// function time(arguements, receivedMessage){
+// var date = new date()
+// var hours = date.getHours()
+// if (hours == 3){
+// receivedMessage.channel.send('Good morning Everyone!')
+// }else if (hours == 12){
+// receivedMessage.channel.send("its Noon O'Clock")
+// } else if(hours == 17){
+// receivedMessage.channel.send('Good Evening everyone!')
+// }
+// }
client.login(config.discordkey.login)
diff --git a/events/member.js b/events/member.js
@@ -8,6 +8,6 @@ const newmember = async(client)=>{
// Send the message, mentioning the member
channel.send(`Welcome to the server, ${member}`);
});
- })
+ }
module.exports={newmember}
diff --git a/events/message.js b/events/message.js
@@ -7,30 +7,31 @@ var apiroute = require('../lib/3party.js')
const internalResponse = async(client) => {
-await client.on('message', (receivedMessage) => {
- const process = require("../lib/processing.js");
- console.log("received message was : " + receivedMessage.content)
-if (receivedMessage.author == client.user){
- return
-}
-//receivedMessage.channel.send("message received, " + receivedMessage.author.toString() + ": " + receivedMessage.content)
-if (receivedMessage.content == 'hi buddy'){
- receivedMessage.react("🤚")
- receivedMessage.channel.send('whats good ' + receivedMessage.author)
-}else if(receivedMessage.content.includes('buddy')){
- receivedMessage.channel.send('hi');
-}else if(receivedMessage.content.includes('buddy' && 'fuck')){
- receivedMessage.channel.send('aahhhh my virgin ears!')
-}else if (receivedMessage.content.includes('hi')){
- receivedMessage.channel.send('hi' + " " + receivedMessage.author)
-}
-if(receivedMessage.content.startsWith("!")){
- console.log('hit the starts with ! if statement');
- process.processingCommand(receivedMessage);
-}
+ await client.on('message', (message) => {
+ const process = require("../lib/processing.js");
+ console.log("received message was : " + message.content)
+ if (message.author == client.user){
+ return
+ }
+ //message.channel.send("message received, " + message.author.toString() + ": " + message.content)
+ if (message.content == 'hi buddy'){
+ message.react("🤚")
+ message.channel.send('whats good ' + message.author)
+ }else if(message.content.includes('buddy')){
+ channel.send('hi');
+ }else if(message.content.includes('buddy' && 'fuck')){
+ channel.send('aahhhh my virgin ears!')
+ }else if (message.content.includes('hi')){
+ channel.send('hi' + " " + message.author)
+ }
+
+ if(message.content.startsWith("!")){
+ console.log('hit the starts with ! if statement');
+ process.processingCommand(message);
+ }
-})
+ })
}
diff --git a/events/processing.js b/events/processing.js
@@ -1,30 +0,0 @@
-// add to handlers folder (events.js)
-const processingCommand = async(){
-async function processCommand(receivedMessage){
-
- let fullCommand = receivedMessage.content.substr(1)
- let splitCommand = fullCommand.split(" ")
- let primaryCommand = splitCommand[0]
- let arguements = splitCommand.slice(1)
-
- if (primaryCommand == "help"){
- helpCommand(arguements, receivedMessage)
- }else if (primaryCommand == "multiply"){
- multiplyCommand(arguements, receivedMessage)
- }else if(primaryCommand == "iss"){
- receivedMessage.channel.send(await apiroute.iss());
- }else if(primaryCommand == "joke"){
- receivedMessage.channel.send(await apiroute.joke());
- }else if(primaryCommand == "code"){
- receivedMessage.channel.send(await apiroute.code());
- }else if(primaryCommand == "beer"){
- receivedMessage.channel.send(await apiroute.beer());
- }else if(primaryCommand == "foas"){
- receivedMessage.channel.send(await apiroute.foas1());
- }else{
- helpCommand(arguements,receivedMessage)
- }
- }
-}
-
-module.exports = {processingCommand}
diff --git a/events/ready.js b/events/ready.js
@@ -15,9 +15,9 @@ const startup = (client) => {
})
let genchannel = client.channels.cache.get(config.discordkey.genchan)
//const attachment = new discord.Attachment("")
- genchannel.send(`▒█▀▀█ █░░█ █▀▀▄
- ▒█▀▀▄ █░░█ █░░█
- ▒█▄▄█ ░▀▀▀ ▀▀▀░ v1.0
+ genchannel.send(` ▒█▀▀█ █░░█ █▀▀▄
+ ▒█▀▀▄ █░░█ █░░█
+ ▒█▄▄█ ░▀▀▀ ▀▀▀░ v1.0
`)
diff --git a/lib/handler.js b/lib/handler.js
@@ -1,32 +0,0 @@
-// add to handlers folder (events.js)
-var config = require('../config/config.js')
-
-
-
-const processCommand = async(receivedMessage) =>{
-
- let fullCommand = receivedMessage.content.substr(1)
- let splitCommand = fullCommand.split(" ")
- let primaryCommand = splitCommand[0]
- let arguements = splitCommand.slice(1)
-
- if (primaryCommand == "help"){
- helpCommand(arguements, receivedMessage)
- }else if (primaryCommand == "multiply"){
- multiplyCommand(arguements, receivedMessage)
- }else if(primaryCommand == "iss"){
- receivedMessage.channel.send(await apiroute.iss());
- }else if(primaryCommand == "joke"){
- receivedMessage.channel.send(await apiroute.joke());
- }else if(primaryCommand == "code"){
- receivedMessage.channel.send(await apiroute.code());
- }else if(primaryCommand == "beer"){
- receivedMessage.channel.send(await apiroute.beer());
- }else if(primaryCommand == "foas"){
- receivedMessage.channel.send(await apiroute.foas1());
- }else{
- helpCommand(arguements,receivedMessage)
- }
- }
-
- module.exports = processCommand;
diff --git a/lib/processing.js b/lib/processing.js
@@ -1,30 +1,30 @@
const apiroute = require('./3party.js')
+const tool = require("./tools.js");
+ const processingCommand = async(message) => {
- const processingCommand = async(receivedMessage) => {
-
- let fullCommand = receivedMessage.content.substr(1)
+ let fullCommand = message.content.substr(1)
let splitCommand = fullCommand.split(" ")
let primaryCommand = splitCommand[0]
let arguements = splitCommand.slice(1)
if (primaryCommand == "help"){
- helpCommand(arguements, receivedMessage)
+ tool.help(arguements, message)
}else if (primaryCommand == "multiply"){
- multiplyCommand(arguements, receivedMessage)
+ tool.multiply(arguements, message)
}else if(primaryCommand == "iss"){
- receivedMessage.channel.send(await apiroute.iss());
- }else if(primaryCommand == "joke"){
- receivedMessage.channel.send(await apiroute.joke());
- }else if(primaryCommand == "code"){
- receivedMessage.channel.send(await apiroute.code());
- }else if(primaryCommand == "beer"){
- receivedMessage.channel.send(await apiroute.beer());
+ message.channel.send(await apiroute.iss());
+ }else if(primaryCommand == "joke"){
+ message.channel.send(await apiroute.joke());
+ }else if(primaryCommand == "code"){
+ message.channel.send(await apiroute.code());
+ }else if(primaryCommand == "beer"){
+ message.channel.send(await apiroute.beer());
}else if(primaryCommand == "foas"){
- receivedMessage.channel.send(await apiroute.foas1());
+ message.channel.send(await apiroute.foas1());
}else{
- helpCommand(arguements,receivedMessage)
+ tool.help(arguements,message)
}
}
diff --git a/lib/tools.js b/lib/tools.js
@@ -0,0 +1,43 @@
+const multiply = async(arguements, message) =>{
+ if (arguements.length < 2){
+ message.channel.send('not enough arguements, you need 2')
+ }else{
+ let product = 1
+ arguements.forEach((value)=>{
+ product = product * parseFloat(value)
+ })
+ message.channel.send('the product of ' + arguements + 'is '+ product.toString())
+ }
+}
+
+
+const help = async(arguements, message) =>{
+ if (arguements.length == 0 ){
+ message.channel.send(`
+ Here are some commands you can throw at me !<command>:
+ - !multiply[x y]
+ - !iss
+ - !code
+ - !beer
+ - !joke
+ `)
+ }
+ else{
+ message.channel.send('looks like you need help with ' + arguements)
+ }
+}
+
+// this needs work lol
+const time = function(){
+ var date = new date()
+ var hours = date.getHours()
+ if (hours == 3){
+ message.channel.send('Good morning Everyone!')
+ }else if (hours == 12){
+ message.channel.send("its Noon O'Clock")
+ } else if(hours == 17){
+ message.channel.send('Good Evening everyone!')
+ }
+}
+
+module.exports = {time, multiply, help}