commit 37ec1fdfab35a40f841966325cf5b15ff39b775a
parent 5bd7fcf0d7d8a56ea11039737c2b808c79e2c7db
Author: underd0g1 <hide4@comcast.net>
Date: Thu, 10 Sep 2020 01:35:13 -0400
added processing command
Diffstat:
7 files changed, 216 insertions(+), 64 deletions(-)
diff --git a/buddy1.js b/buddy1.js
@@ -10,54 +10,44 @@
const discord = require('discord.js');
const client = new discord.Client();
const fetch = require('node-fetch');
-var config = require('./config/config.js');
-var apiroute = require('./lib/3party.js')
-client.on('ready', () => {
- console.log('connected as ' + client.user.tag)
+const config = require('./config/config.js');
+const apiroute = require('./lib/3party.js');
+const init = require('./events/ready.js');
+const message = require('./events/message.js');
+const processing = require('./lib/processing.js');
- client.user.setActivity('Node.js vids', { type: 'Watching' });
+init.startup(client);
- client.guilds.cache.forEach((guild)=>{
- console.log(guild.name)
- guild.channels.cache.forEach((channel)=>{
- console.log(` ~ ${channel.name} ${channel.type} ${channel.id}`)
- })
- })
- let genchannel = client.channels.cache.get(config.discordkey.genchan)
+message.internalResponse(client, processing);
- //const attachment = new discord.Attachment("")
- genchannel.send(`▒█▀▀█ █░░█ █▀▀▄
-▒█▀▀▄ █░░█ █░░█
-▒█▄▄█ ░▀▀▀ ▀▀▀░ v1.0
- `)
-})
+// client.on('message', (receivedMessage) => {
+// 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("!")){
+// processCommand(receivedMessage)
+// }
+// //receivedMessage.react("🤚")
+// })
-client.on('message', (receivedMessage) => {
- 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("!")){
- processCommand(receivedMessage)
- }
- //receivedMessage.react("🤚")
-})
client.on('guildMemberAdd', member => {
// Send the message to a designated channel on a server:
const channel = member.guild.channels.find(ch => ch.name === 'member-log');
@@ -69,32 +59,32 @@ client.on('guildMemberAdd', member => {
-// add to handlers folder (events.js)
-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)
- }
- }
+// // add to handlers folder (events.js)
+// 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)
+// }
+// }
function multiplyCommand(arguements, receivedMessage){
diff --git a/events/member.js b/events/member.js
@@ -0,0 +1 @@
+
diff --git a/events/message.js b/events/message.js
@@ -0,0 +1,39 @@
+
+const discord = require('discord.js');
+const client = new discord.Client();
+const fetch = require('node-fetch');
+var config = require('../config/config.js');
+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);
+}
+
+})
+
+}
+
+module.exports = {
+ internalResponse
+}
diff --git a/events/processing.js b/events/processing.js
@@ -0,0 +1,30 @@
+// 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
@@ -0,0 +1,28 @@
+const config = require("../config/config.js");
+
+
+const startup = (client) => {
+
+ client.on('ready', ()=>{
+ console.log(client.user)
+ console.log('connected as ' + client.user.tag)
+ client.user.setActivity('Node.js vids', { type: 'Watching' });
+ client.guilds.cache.forEach((guild)=>{
+ console.log(guild.name)
+ guild.channels.cache.forEach((channel)=>{
+ console.log(` ~ ${channel.name} ${channel.type} ${channel.id}`)
+ })
+ })
+ let genchannel = client.channels.cache.get(config.discordkey.genchan)
+ //const attachment = new discord.Attachment("")
+ genchannel.send(`▒█▀▀█ █░░█ █▀▀▄
+ ▒█▀▀▄ █░░█ █░░█
+ ▒█▄▄█ ░▀▀▀ ▀▀▀░ v1.0
+
+ `)
+
+ })
+
+}
+
+module.exports = {startup}
diff --git a/lib/handler.js b/lib/handler.js
@@ -0,0 +1,32 @@
+// 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
@@ -0,0 +1,32 @@
+
+const apiroute = require('./3party.js')
+
+
+ const processingCommand = 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 = {processingCommand}