TypeError:无法读取未定义的属性“”get“”,如何读取?

您所在的位置:网站首页 网页提示无法读取未定义属性 TypeError:无法读取未定义的属性“”get“”,如何读取?

TypeError:无法读取未定义的属性“”get“”,如何读取?

2024-02-17 01:28| 来源: 网络整理| 查看: 265

run: async (client, message, args) => { const { channel } = message.member.voice; const permissions = channel.permissionsFor(message.client.user); if (!permissions.has("CONNECT")) return message.reply("Je n'est pas les permissions de rejoindre votre channel."); if (!permissions.has("SPEAK")) return message.reply("Je ne peux pas parler dans ce channel vocal."); const search = args.join(" "); const videoPattern = /^(https?:\/\/)?(www\.)?(youtube\.com|youtu\.?be)\/.+$/gi; const playlistPattern = /^.*(list=)([^#\&\?]*).*/gi; const url = args[0]; const urlValid = videoPattern.test(args[0]); const serverQueue = message.client.queue.get(message.guild.id); ^^^^^ÊRROR HERE^^^^^^ const queueConstruct = { textChannel: message.channel, channel, connection: null, songs: [], loop: false, volume: 50, playing: true }; let songInfo = null; let song = null; if (urlValid) { try { songInfo = await ytdl.getInfo(url); song = { title: songInfo.title, url: songInfo.video_url, duration: songInfo.length_seconds, }; } catch (error) { if (error.message.includes("copyright")) { return message .reply("⛔ Cette vidéo est copyright, elle ne peut donc être jouée. ⛔") .catch(console.error); } else { console.error(error); } } } else { try { const results = await youtube.searchVideos(search, 1); songInfo = await ytdl.getInfo(results[0].url); song = { title: songInfo.title, url: songInfo.video_url, duration: songInfo.length_seconds, }; } catch (error) { console.error(error); } } if (serverQueue) { serverQueue.songs.push(song); return serverQueue.textChannel .send(`✅ **${song.title}** a été ajoutée a la queue par ${message.author}`) .catch(console.error); } else { queueConstruct.songs.push(song); } if (!serverQueue) message.client.queue.set(message.guild.id, queueConstruct);

当代码正常启动时,它应该播放一些音乐,但当我运行代码时,它没有按预期运行,它告诉我get没有定义……你能帮我个忙吗?

我不明白它为什么要这么做,在它工作之前……如果你帮助我,那将是非常有用的!没有所有的代码,因为否则网站会问我更多的细节,对不起…



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3