discord.js

Discord.js - .createdAt() is not a valid function

寵の児 提交于 2020-08-10 23:18:59
问题 I'm trying to do is whenever someone joins the server, the bot sends a rich embed with their ID, their user creation date and the new total members, but whenever i run it and test it, it says that .createdAt() is not a valid function, so i'm completely lost as to what to do. client.on("guildMemberAdd", member => { let mlogchannel = member.guild.channels.find((channel => channel.name === "member-logging")); if (mlogchannel) { console.log(client.users.find(user => user.id === member.id)

Discord.js - .createdAt() is not a valid function

一世执手 提交于 2020-08-10 23:18:59
问题 I'm trying to do is whenever someone joins the server, the bot sends a rich embed with their ID, their user creation date and the new total members, but whenever i run it and test it, it says that .createdAt() is not a valid function, so i'm completely lost as to what to do. client.on("guildMemberAdd", member => { let mlogchannel = member.guild.channels.find((channel => channel.name === "member-logging")); if (mlogchannel) { console.log(client.users.find(user => user.id === member.id)

Discord JS // Trying to add role by reacting to the message

陌路散爱 提交于 2020-08-09 07:28:48
问题 bot.on('messageReactionAdd', async (reaction, user) => { // Define the emoji user add let role = message.guild.roles.find(role => role.name === 'Alerts'); if (message.channel.name !== 'alerts') return message.reply(':x: You must go to the channel #alerts'); message.member.addRole(role); }); Thats the part of my bot.js. I want the user to react in a certain channel and receive role Alerts 回答1: You haven't really stated what the problem is, what works and what doesn't work but I'll take a wild

Discord Music bot - the song i play stopped 10-20 seconds before the end so i added highWaterMark and now the song barely plays at all

放肆的年华 提交于 2020-08-06 02:18:49
问题 So basically i had this issue and i got given a "solution" but it didn't work, so i found a fix and that was adding highWaterMark to my code so the stream stays open longer or whatever idk, so this is what my code looks like currently const dispatcher = serverQueue.connection.play(ytdl(song.url, { filter:"audioonly", highWaterMark: 1<<25 }) .on("finish", () => { const shiffed = serverQueue.songs.shift(); if (serverQueue.loop === true) { serverQueue.songs.push(shiffed); }; play(guild,

Discord Music bot - the song i play stopped 10-20 seconds before the end so i added highWaterMark and now the song barely plays at all

☆樱花仙子☆ 提交于 2020-08-06 02:16:28
问题 So basically i had this issue and i got given a "solution" but it didn't work, so i found a fix and that was adding highWaterMark to my code so the stream stays open longer or whatever idk, so this is what my code looks like currently const dispatcher = serverQueue.connection.play(ytdl(song.url, { filter:"audioonly", highWaterMark: 1<<25 }) .on("finish", () => { const shiffed = serverQueue.songs.shift(); if (serverQueue.loop === true) { serverQueue.songs.push(shiffed); }; play(guild,

Discord Music bot - the song i play stopped 10-20 seconds before the end so i added highWaterMark and now the song barely plays at all

别等时光非礼了梦想. 提交于 2020-08-06 02:16:19
问题 So basically i had this issue and i got given a "solution" but it didn't work, so i found a fix and that was adding highWaterMark to my code so the stream stays open longer or whatever idk, so this is what my code looks like currently const dispatcher = serverQueue.connection.play(ytdl(song.url, { filter:"audioonly", highWaterMark: 1<<25 }) .on("finish", () => { const shiffed = serverQueue.songs.shift(); if (serverQueue.loop === true) { serverQueue.songs.push(shiffed); }; play(guild,

Set embed title to a clickable link

左心房为你撑大大i 提交于 2020-08-05 18:17:05
问题 I have a RichEmbed and I want to make it so I can have a field title that when I click on it, it will lead me to a link. 回答1: If you want the title of the embed to be a link, you can add a .url property to it, either by using RichEmbed.setURL(), manually setting it or adding it to the object you pass in the constructor. If you want the title of a field to be a link that can't be done since that, unfortunately, doesn't support markdown :\ If you want you can add the link in the value text of

Discord.JS Unknown Command not working correctly

时间秒杀一切 提交于 2020-07-31 05:50:30
问题 I am making a Discord bot, and I need an unknown command feature. I am trying to make one, and it works, but it also sends when you do normal commands. Below is my code. client.on('message', message=>{ const prefix = '&' if (!message.content.startsWith(prefix)) return let [command, ...args] = message.content.slice(prefix).split(/\s+/g) switch(command) { case "help": if(msg.startsWith(`${prefix}help`)) { let embedhelp = new Discord.MessageEmbed() .setAuthor('Test', 'https://cdn.discordapp.com

Wav to Opus convertion with Discord.js/opus fails silently

安稳与你 提交于 2020-07-08 10:23:07
问题 The bounty expires in 3 days . Answers to this question are eligible for a +50 reputation bounty. Rikard wants to draw more attention to this question. I am trying to convert a WAV file to Opus, using Node's fs.readFile and passing that buffer to @Discord/opus converter. I get neither the result or a error thrown with a explanation of what is wrong. This is basically the example you have in the docs... right? Bug? By design? or me missing something? I would expect the try/catch to be called

Sending 2 different messages if message exceeds 2000 characters

烈酒焚心 提交于 2020-07-08 03:51:32
问题 Basically I'm making this lyrics command, and many times, the amount of characters in a lyric for most songs exceed 2000 characters, which is passed Discord's limit. I wonder how I would go about making it send 2 different messages at once. I'm wondering how I could make it send the first 2000 characters in one message, then send the remaining characters in a second message right after. Here is my code right here: if (message.content.startsWith(config.prefix + `lyrics`)) { var artistTitle =