이세린

Edited Command Hanlder, Using Run instead of Execute, Cute Command now complete

const Discord = require('discord.js');
module.exports = {
name: 'breathe',
description: 'Embeds a gif',
......
const Discord = require('discord.js');
module.exports = {
name: 'calm',
description: 'Actual help section',
execute(message, args, Discord){
const calmEmbed = new Discord.MessageEmbed()
async run(client, message, args){
const calm = new Discord.MessageEmbed()
.setColor('#91B2C7')
.setDescription("It's okay, I'm here to help! What would you like to do?")
.addFields(
......@@ -11,7 +13,7 @@ module.exports = {
{name: ';checklist', value: "I'll guide you through an anxiety checklist"},
{name: ';chat', value: "If you just want a chat with me, I'm all ears!"}
);
message.channel.send(calmEmbed);
message.channel.send(calm);
}
}
......
const Discord = require('discord.js');
......
const Discord = require('discord.js');
......
const { MessageEmbed } = require('discord.js');
const Discord = require('discord.js');
const randomPuppy = require('random-puppy');
module.exports = {
name: 'cute',
description: 'pulls cute animal pics and embed post',
execute(message, args, Discord){
let reddit = [
description: 'Embeds pictures pulled from listed subreddits',
async run(client, message, args){
const subreddits = [
"aww",
"puppies",
"toebeans"
]
const random = subreddits[Math.floor(Math.random()*subreddits.length -1)];
const img = await randomPuppy(random);
let subreddit = reddit[Math.floor(Math.random()*reddit.length -1)];
const cute = new Discord.MessageEmbed()
.setDescription("Some cute animals to blow away your anxieties!")
.setColor('#91B2C7')
.setURL(`https://reddit.com/r/${random}`)
.setImage(img);
const cuteEmbed = new MessageEmbed()
.setDescription("Some cute animals to blow away your anxieties!");
randomPuppy(subreddit).then(reponse => {
console.log(url);
const cuteurl = url;
cuteEmbed.setColor('#91B2C7');
cuteEmbed.setImage('${cuteurl}');
});
message.channel.send(cuteEmbed);
message.channel.send(cute);
}
}
\ No newline at end of file
......
const Discord = require('discord.js');
module.exports = {
name: 'help',
description: 'Directs to ;calm',
execute(message, args){
async run(client, message, args){
message.channel.send('To see available commands, call me with ;calm');
}
}
\ No newline at end of file
......
{
"token": "OTgwOTAxNzg3MzY2MjE1Njgw.GVFGdS.z9ily3n-7rcJnqf2FrHg3KJn5h_u68llQzJOGU"
}
\ No newline at end of file
......@@ -5,23 +5,33 @@ const client = new Discord.Client();
const prefix = ';';
const { token } = require('./config.json'); // hid token in config file
const fs = require('fs');
const { join } = require('path');
// Command Handler
client.commands = new Discord.Collection();
const commandFiles = fs.readdirSync('./commands').filter(file => file.endsWith('.js'));
for(const file of commandFiles){
const commandName = file.split(".")[0];
const command = require(`./commands/${file}`);
client.commands.set(command.name, command);
console.log(`Attempting to load command ${commandName}`);
client.commands.set(commandName, command);
}
//Ready check
client.once('ready', () => {
console.log('anxietymanager is online')
console.log([...client.commands])
console.log(`anxietymanager is online.`)
});
//Command Calls
client.on('message', message => {
client.on('message', async message => {
if(!message.content.startsWith(prefix)) return;
const args = message.content.slice(prefix.length).split(/ +/);
......@@ -29,17 +39,17 @@ client.on('message', message => {
if(command == 'ping'){
message.channel.send('pong!');
} else if(command == 'help'){
client.commands.get('help').execute(message, args);
} else if(command == 'calm'){
client.commands.get('calm').execute(message, args, Discord);
} else if(command == 'breathe'){
client.commands.get('breathe').execute(message, args);
} else if(command == 'cute'){
client.commands.get('cute').execute(message, args, Discord);
}
});
if(!client.commands.has(command)){
return;
}
try{
client.commands.get(command).run(client, message, args);
} catch(error){
console.error(error);
}
});
client.login('OTgwOTAxNzg3MzY2MjE1Njgw.GVFGdS.z9ily3n-7rcJnqf2FrHg3KJn5h_u68llQzJOGU');
\ No newline at end of file
client.login(token);
\ No newline at end of file
......