[英]TypeError: Cannot read property 'get' of undefined Discord.js Error
[英]i m trying to run a command Discord.js but error appear “TypeError: Cannot read property 'get' of undefined”
下面有一個代碼希望有人幫助我:) 我試圖在谷歌上搜索但沒有找到任何解決方案
const { MessageEmbed } = require("discord.js");
module.exports.run = async (bot, message, args) => {
const snipes = bot.snipes.get(message.channel.id) || [];
const msg = snipes[args[0] - 1 || 0];
if (!msg) return message.channel.send(`That is not a valid snipe...`);
const Embed = new MessageEmbed()
.setAuthor(
msg.author.tag,
msg.author.displayAvatarURL({ dynamic: true, size: 256 })
)
.setDescription(msg.content)
.setFooter(`Date: ${msg.date} | ${args[0] || 1}/${snipes.length}`);
if (msg.attachment) Embed.setImage(msg.attachment);
message.channel.send(Embed);
},
module.exports.help = {
name: "snipe",
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.