New to coding and recently started making a discord bot using JS. It's a bot where a certain mp4 plays with a specific snippet.
I'm having trouble with the fact that the mp4 doesn't send when I input the command, just the embed message. Basically if I do -snip kratos the bot sends the embed message but not the mp4.
Here's what I have so far:
const fs = require('fs'); const { Client, MessageAttachment } = require('discord.js'); const config = require('./config.json'); const { prefix, token } = require('./config.json'); const client = new Client(); client.commands = new Discord.Collection();``` And here are the command events: ``` client.on('message', message => { if (message.content === `${prefix}snip kratos`) { if (message.author.bot) return const kratos = new Discord.MessageEmbed() .setColor('#ffb638') .setTitle('Kratos') .setDescription('Sending 1 snippet(s)...') .setTimestamp() .setFooter('SkiBot'); message.channel.send(kratos); client.on('message', message => { if (message.content === `${prefix}snip kratos`) { if (message.author.bot) return const attachment = new MessageAttachment('./snippets/kratos/Kratos.mp4'); message.channel.send(attachment); } }); } }); client.on('message', message => { if (message.content === `${prefix}snip johnny bravo`) { if (message.author.bot) return const kratos = new Discord.MessageEmbed() .setColor('#ffb638') .setTitle('Johnny Bravo') .setDescription('Sending 1 snippet(s)...') .setTimestamp() .setFooter('SkiBot'); message.channel.send(kratos); client.on('message', message => { if (message.content === `${prefix}snip johnny bravo`) { if (message.author.bot) return const attachment = new MessageAttachment('./snippets/Johnny_Bravo/Johnny_Bravo.mp4'); message.channel.send(attachment); } }); } });``` https://stackoverflow.com/questions/66837436/bot-sends-embed-message-but-doesnt-send-mp4-attachment March 28, 2021 at 08:34AM
没有评论:
发表评论