discord.js

Joining a voice channel on ready (discord.js)

回眸只為那壹抹淺笑 提交于 2020-05-28 05:26:34
问题 I tried this: client.on('ready', () => { let channel = client.channels.get('432462518380789771'); channel.join() }); It doesnt work. I made sure that the ID is right and everything and its still not working. 回答1: Considering we have no context on the error you're receiving, I'll provide a code example to see if this fixes your issue. client.on("ready", () => { const channel = client.channels.get("mychannelid"); if (!channel) return console.error("The channel does not exist!"); channel.join()

Line separator/break in discord embded

冷暖自知 提交于 2020-05-12 11:12:13
问题 I have the following discord embed: message.reply({ content: '', embed: { color: 11416728, author: { name: 'xx know-it-all', icon_url: 'https://xx.png' }, description: '', footer: { icon_url: client.user.avatarURL, text: '© xx Network' }, fields: [ { name: '1st Line', value: '2nd Line', }, { name: 'MAKE THIS JUST A SPACER', value: 'MAKE THIS JUST A SPACER', }, { name: '5th Line', value: '6th Line', } ] } }) I am trying to figure out how to create a spacer of sorts. I have tried using a html

Line separator/break in discord embded

寵の児 提交于 2020-05-12 11:11:55
问题 I have the following discord embed: message.reply({ content: '', embed: { color: 11416728, author: { name: 'xx know-it-all', icon_url: 'https://xx.png' }, description: '', footer: { icon_url: client.user.avatarURL, text: '© xx Network' }, fields: [ { name: '1st Line', value: '2nd Line', }, { name: 'MAKE THIS JUST A SPACER', value: 'MAKE THIS JUST A SPACER', }, { name: '5th Line', value: '6th Line', } ] } }) I am trying to figure out how to create a spacer of sorts. I have tried using a html

Line separator/break in discord embded

社会主义新天地 提交于 2020-05-12 11:11:08
问题 I have the following discord embed: message.reply({ content: '', embed: { color: 11416728, author: { name: 'xx know-it-all', icon_url: 'https://xx.png' }, description: '', footer: { icon_url: client.user.avatarURL, text: '© xx Network' }, fields: [ { name: '1st Line', value: '2nd Line', }, { name: 'MAKE THIS JUST A SPACER', value: 'MAKE THIS JUST A SPACER', }, { name: '5th Line', value: '6th Line', } ] } }) I am trying to figure out how to create a spacer of sorts. I have tried using a html

add user to role with newest discord.js

为君一笑 提交于 2020-05-09 07:43:06
问题 i'm using newest discord.js in node.js and i'm trying to add user to role, but it seems bot.addUserToRole() was removed. How can I do it when I know only rank name, not it's ID? 回答1: You can do this with: var role = message.guild.roles.find(role => role.name === "MyRole"); message.member.addRole(role); 回答2: Here's what worked for me, hope this helps! var role= member.guild.roles.cache.find(role => role.name === "role name"); member.roles.add(role); Here is the official documentation on it. 来源

add user to role with newest discord.js

时光总嘲笑我的痴心妄想 提交于 2020-05-09 07:42:39
问题 i'm using newest discord.js in node.js and i'm trying to add user to role, but it seems bot.addUserToRole() was removed. How can I do it when I know only rank name, not it's ID? 回答1: You can do this with: var role = message.guild.roles.find(role => role.name === "MyRole"); message.member.addRole(role); 回答2: Here's what worked for me, hope this helps! var role= member.guild.roles.cache.find(role => role.name === "role name"); member.roles.add(role); Here is the official documentation on it. 来源

identifying admins from mentions discordjs

感情迁移 提交于 2020-04-30 14:13:49
问题 I want to find out if there are mentions in a message which I am doing using if(message.mentions.users.first()) but now among all the mentions I also want to filter out mentions of the admin team and not those of the community members. How to achieve that? I tried filtering users based on roles like this let r = []; message.mentions.users.forEach( user => { console.log('user' + user) user.roles.forEach(role => { console.log('role' + role) r.push(role); }) console.log('roles' + r); var member

identifying admins from mentions discordjs

不问归期 提交于 2020-04-30 14:08:49
问题 I want to find out if there are mentions in a message which I am doing using if(message.mentions.users.first()) but now among all the mentions I also want to filter out mentions of the admin team and not those of the community members. How to achieve that? I tried filtering users based on roles like this let r = []; message.mentions.users.forEach( user => { console.log('user' + user) user.roles.forEach(role => { console.log('role' + role) r.push(role); }) console.log('roles' + r); var member

identifying admins from mentions discordjs

北慕城南 提交于 2020-04-30 14:08:19
问题 I want to find out if there are mentions in a message which I am doing using if(message.mentions.users.first()) but now among all the mentions I also want to filter out mentions of the admin team and not those of the community members. How to achieve that? I tried filtering users based on roles like this let r = []; message.mentions.users.forEach( user => { console.log('user' + user) user.roles.forEach(role => { console.log('role' + role) r.push(role); }) console.log('roles' + r); var member

send is not defined

烈酒焚心 提交于 2020-04-30 06:28:17
问题 I don't get how to fix the TypeError Cannot read property 'send' of undefined This is caused by the line where I get the channel 702825446248808519 module.exports = { name: 'suggest', aliases: ['sug', 'suggestion'], description: 'Suggest something for the Bot', execute(client, message) { const filter = m => m.author.id === message.author.id; message.channel.send(`Please provide a suggestion for the Bot or cancel this command with "cancel"!`) message.channel.awaitMessages(filter, { max: 1, })