Skip to content

Commit

Permalink
v1.03 Released. A few new commands.
Browse files Browse the repository at this point in the history
  • Loading branch information
mo-balsara committed Jan 4, 2021
1 parent 0e26134 commit 72ed5fa
Show file tree
Hide file tree
Showing 12 changed files with 1,484 additions and 51 deletions.
169 changes: 169 additions & 0 deletions ch_index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
require('./server');

const { token } = process.env;

const fetch = require('node-fetch');
const Discord = require('discord.js');

const client = new Discord.Client();

const Prefix = ';';

const moment = require('moment-timezone');

const got = require("got");

const mongo = require("mongodb");
const {
Sequelize,
DataTypes
} = require('sequelize');


const fs = require("fs");

const version = "1.0.0";

client.commands = new Discord.Collection();

function command(command) {
return `${Prefix}${command}`
}

client.on("ready", () => {
console.log(`Logged in as ${client.user.tag}!`);
client.user.setActivity(';cmds | v1.0.1', { type: 'LISTENING' })
});

client.on('message', message => {
if (!message.content.startsWith(prefix) || message.author.bot) return;

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


switch (message.content) {
case command('cmds'):
let dateTime2 = message.createdAt
let d2 = moment(dateTime2);
let time2 = d2.tz("America/Chicago").format("LT");
let embed2 = new Discord.MessageEmbed()
.setTitle("Here are a list of commands!")
.setDescription(">>> ```;avatar```\n```;invite```\n```;meme```\n```;owner```\n```;devs```\n```;support```")
.setColor("ORANGE")
.setFooter(`Moby • Today at ${time2}`, client.user.displayAvatarURL({ dynamic: true, format: 'png', size: 32 }))
message.channel.send(embed2)
break;

case command('support'):
let dateTimeSup = message.createdAt
let dSup = moment(dateTimeSup);
let timeSup = dSup.tz("America/Chicago").format("LT");
let embedSup = new Discord.MessageEmbed()
.setTitle("Moby's Support Server!")
.setDescription("Click on the link to join Moby's support server today! [Link](https://discord.gg/7zUD9vkDzN)")
.setColor("ORANGE")
.setFooter(`Moby • Today at ${timeSup}`, client.user.displayAvatarURL({ dynamic: true, format: 'png', size: 32 }))
message.channel.send(embedSup)
break;

case command('femboy me daddy UwU'):
let dateTime3 = message.createdAt
let d3 = moment(dateTime3);
let time3 = d3.tz("America/Chicago").format("LT");
let embed3 = new Discord.MessageEmbed()
.setTitle("no you demented burnt lentil")
.setDescription("hehe luv ya :D\nthis is the secret command :)")
.setColor("ORANGE")
.setFooter(`Moby • Today at ${time3}`, client.user.displayAvatarURL({ dynamic: true, format: 'png', size: 32 }))
message.channel.send(embed3)
break;

case command('owner'):
let dateTime6 = message.createdAt
let d6 = moment(dateTime6);
let time6 = d6.tz("America/Chicago").format("LT");
let embed6 = new Discord.MessageEmbed()
.setTitle("Who owns me?")
.setDescription("head;#8429")
.setColor("ORANGE")
.setFooter(`Moby • Today at ${time6}`, client.user.displayAvatarURL({ dynamic: true, format: 'png', size: 32 }))
message.channel.send(embed6)
break;

case command('devs'):
let dateTime7 = message.createdAt
let d7 = moment(dateTime7);
let time7 = d7.tz("America/Chicago").format("LT");
let embed7 = new Discord.MessageEmbed()
.setTitle("Heres a list of the devs!")
.setDescription("-_-#9799")
.setColor("ORANGE")
.setFooter(`Moby • Today at ${time7}`, client.user.displayAvatarURL({ dynamic: true, format: 'png', size: 32 }))
message.channel.send(embed7)
break;

case command('avatar'):
let dateTime4 = message.createdAt
let d4 = moment(dateTime4);
let time4 = d4.tz("America/Chicago").format("LT");
let embed4 = new Discord.MessageEmbed()
.setTitle("Heres your avatar!")
.setImage(message.author.displayAvatarURL({ dyanmic: true, format: 'png', size: 512 }))
.setColor("ORANGE")
.setFooter(`Moby • Today at ${time4}`, client.user.displayAvatarURL({ dynamic: true, format: 'png', size: 32 }))
message.channel.send(embed4)
break;

case command('invite'):
let dateTime5 = message.createdAt
let d5 = moment(dateTime5);
let time5 = d5.tz("America/Chicago").format("LT");
let embed5 = new Discord.MessageEmbed()
.setTitle("Invite Moby to your Server!")
.setDescription('Use this link to invite Moby to your servers! [Link](https://discord.com/oauth2/authorize?client_id=784210441622650920&scope=bot)')
.addField(`Version: 1.0.1`)
.setColor("ORANGE")
.setFooter(`Moby • Today at ${time5}`, client.user.displayAvatarURL({ dynamic: true, format: 'png', size: 32 }))
message.channel.send(embed5)
break;

case command('kick'):
const kickMember = message.mentions.members.first()
kickMember.kick();
break;

case command('meme'):
let memeembed = new Discord.MessageEmbed()
got("https://www.reddit.com/r/dankmemes/random/.json").then(response => {

let dateTime = message.createdAt
let d = moment(`${dateTime}`)
let time = d.tz("America/Chicago").format("LT");
let content = JSON.parse(response.body);
let permalink = content[0].data.children[0].data.permalink;
let memeUrl = `https://reddit.com${permalink};`
let memeImage = content[0].data.children[0].data.url;
let memeTitle = content[0].data.children[0].data.title;
let memeUpvotes = content[0].data.children[0].data.ups;
let memeDownvotes = content[0].data.children[0].data.downs;
let memeNumComments = content[0].data.children[0].data.num_comments;
let memeSubreddit = content[0].data.children[0].data.subreddit;
memeembed.setTitle(`${memeTitle}`);
memeembed.setDescription(`r/${memeSubreddit}`)
memeembed.setURL(`${memeUrl}`);
memeembed.setImage(memeImage);
memeembed.setColor("ORANGE");
memeembed.setFooter(`Moby • Today at ${time}`, client.user.displayAvatarURL({ dynamic: true, format: 'png', size: 32 }));
message.channel.send(memeembed);
});
}
});

client.on('guildMemberAdd', member => {
const channel = member.guild.channels.cache.find(ch => ch.name === 'member-log');
if (!channel) return;
channel.send(`Howdy ${member}! Welcome to the server.`);
});

client.login(token);
24 changes: 24 additions & 0 deletions commands/avatar.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
const Discord = require('discord.js');

module.exports = {
name: 'avatar',
description: 'Returns a users avatar',
execute(message, args) {
const embed = new Discord.MessageEmbed()
if (!message.mentions.users.first()) {
embed.setTitle("Your Avatar:")
embed.setThumbnail(message.author.displayAvatarURL())
// embed.setDescription("This is your avatar.")
embed.setColor("RANDOM")
return message.channel.send(embed)
} else {
const user = message.mentions.users.first()
embed.setTitle(`${user.tag}'s Avatar:`)
embed.setThumbnail(user.displayAvatarURL())
// embed.setDescription(`This is ${user.tag}'s avatar.`)
embed.setColor('RANDOM')
// embed.setFooter("This is a test.")
return message.channel.send(embed)
}
}
}
9 changes: 9 additions & 0 deletions commands/devs.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const Discord = require('discord.js');

module.exports = {
name: 'ping',
description: 'Ping!',
execute(message, args) {
message.channel.send('Pong.');
},
};
7 changes: 7 additions & 0 deletions commands/help.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
name: 'help',
description: 'Help menu',
execute(message, args) {
//will work on this later as it is a "feature" of the command handling
},
};
7 changes: 7 additions & 0 deletions commands/invite.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
name: 'ping',
description: 'Ping!',
execute(message, args) {
message.channel.send('Pong.');
},
};
31 changes: 31 additions & 0 deletions commands/meme.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
const Discord = require('discord.js');
const got = require("got");

module.exports = {
name: 'meme',
description: 'Get a meme from r/memes!',
execute(message, args) {
const embed = new Discord.MessageEmbed();
got('https://www.reddit.com/r/memes/random/.json')
.then(response => {
const [list] = JSON.parse(response.body);
const [post] = list.data.children;

const permalink = post.data.permalink;
const memeUrl = `https://reddit.com${permalink}`;
const memeImage = post.data.url;
const memeTitle = post.data.title;
const memeUpvotes = post.data.ups;
const memeNumComments = post.data.num_comments;

embed.setTitle(`${memeTitle}`);
embed.setURL(`${memeUrl}`);
embed.setColor('RANDOM');
embed.setImage(memeImage);
embed.setFooter(`👍 ${memeUpvotes} 💬 ${memeNumComments}`);

message.channel.send(embed);
})
.catch(console.error);
},
};
9 changes: 9 additions & 0 deletions commands/owner.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const Discord = require('discord.js');

module.exports = {
name: 'ping',
description: 'Ping!',
execute(message, args) {
message.channel.send('Pong.');
},
};
9 changes: 9 additions & 0 deletions commands/secretcommand.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const Discord = require('discord.js');

module.exports = {
name: 'ping',
description: 'Ping!',
execute(message, args) {
message.channel.send('Pong.');
},
};
14 changes: 14 additions & 0 deletions commands/support.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
const Discord = require('discord.js')

module.exports = {
name: 'support',
description: 'Get the support server invite link!',
execute(message, args) {
let embedSup = new Discord.MessageEmbed()
.setTitle("Moby's Support Server!")
.setDescription("Click on the link to join Moby's support server today! [Link](https://discord.gg/7zUD9vkDzN)")
.setColor("ORANGE")
.setFooter(`Moby • Today at ${timeSup}`, client.user.displayAvatarURL({ dynamic: true, format: 'png', size: 32 }))
message.channel.send(embedSup)
},
};
Loading

0 comments on commit 72ed5fa

Please sign in to comment.