discord.js

Discord.js, cannot read property “user” of null

送分小仙女□ 提交于 2021-02-17 04:50:05
问题 I have a trouble, that I can't understand at all. The function working on my server, and not working on another one. Here's my code: const user = message.author; let servericon = message.guild.iconURL; let serverembed = new Discord.MessageEmbed() .setAuthor(message.author.username, auser.displayAvatarURL({ format: 'png' })) .setTitle("Информация о сервере") .setColor("RANDOM") .setThumbnail(servericon) .addField("Название сервера :", message.guild.name) .addField("Владелец :", `${message

It works but still getting this error: UnhandledPromiseRejectionWarning: DiscordAPIError: Missing Permissions

那年仲夏 提交于 2021-02-11 17:58:38
问题 This error is a weird one because the code works: it creates an admin role with the Administrator flag. And most importantly: the bot is above the ADMIN role and is Administrator. The error appears when it's creating the role. The error says it's missing permissions but the ADMIN role is created successfully so it didn't fail. And there's another thing: when I leave out the position parameter it works just fine, no errors at all. But unfortunately I need the position parameter because I want

TypeError: message.guild.channels.find(…).then is not a function

六月ゝ 毕业季﹏ 提交于 2021-02-11 17:23:30
问题 This is the error I am getting from my code below: TypeError: message.guild.channels.find(...).then is not a function message.guild.channels.find('name', `${message.author.username}-oda`).then(c => { channel.overwritePermissions(message.member, { CONNECT: true, VIEW_CHANNEL: true }); message.channel.send('All Ok.') }) 回答1: Since you commented on this answer saying you're using discord.js v11 and not v12 I am editing my answer according to tipakA's comment below. find does not return a Promise

TypeError: message.guild.channels.find(…).then is not a function

橙三吉。 提交于 2021-02-11 17:23:14
问题 This is the error I am getting from my code below: TypeError: message.guild.channels.find(...).then is not a function message.guild.channels.find('name', `${message.author.username}-oda`).then(c => { channel.overwritePermissions(message.member, { CONNECT: true, VIEW_CHANNEL: true }); message.channel.send('All Ok.') }) 回答1: Since you commented on this answer saying you're using discord.js v11 and not v12 I am editing my answer according to tipakA's comment below. find does not return a Promise

TypeError: message.guild.channels.find(…).then is not a function

元气小坏坏 提交于 2021-02-11 17:23:12
问题 This is the error I am getting from my code below: TypeError: message.guild.channels.find(...).then is not a function message.guild.channels.find('name', `${message.author.username}-oda`).then(c => { channel.overwritePermissions(message.member, { CONNECT: true, VIEW_CHANNEL: true }); message.channel.send('All Ok.') }) 回答1: Since you commented on this answer saying you're using discord.js v11 and not v12 I am editing my answer according to tipakA's comment below. find does not return a Promise

Minecraft Server Client via Discord Bot

南楼画角 提交于 2021-02-11 16:44:41
问题 Currently I am trying to set up a discord bot that would log me into a server, and convey the messages sent by players into a discord channel. I am not an admin nor have any staff related things on the server, so i'm unable to ftp in and use rcon , I want it to log my user in, and just convey messages back and forth. Is this possible? So, I have so far tried via npm packages , but none of them seem to do what i want. I am trying to host a node.js discord.js bot on my home computer that is

Minecraft Server Client via Discord Bot

試著忘記壹切 提交于 2021-02-11 16:43:53
问题 Currently I am trying to set up a discord bot that would log me into a server, and convey the messages sent by players into a discord channel. I am not an admin nor have any staff related things on the server, so i'm unable to ftp in and use rcon , I want it to log my user in, and just convey messages back and forth. Is this possible? So, I have so far tried via npm packages , but none of them seem to do what i want. I am trying to host a node.js discord.js bot on my home computer that is

Getting Rock, Paper, Scissors to work in discord.js with reactions

穿精又带淫゛_ 提交于 2021-02-11 15:48:53
问题 I am trying to create a Rock, Paper, Scissors for my discord bot in discord.js. I attempted to create on but it currently is not working. I'd like the emojis to disappear once the reaction has been made and am unsure how to do that. module.exports = { name: "rps", description: "A game of Rock, Paper, Scissors!", execute(message) { var rps = ["🗿", "📜", "✂️"] const m = message.channel.send("Let's play a game of Rock, Paper, Scissors! Please react what you would like to choose with the emojis

Getting Rock, Paper, Scissors to work in discord.js with reactions

♀尐吖头ヾ 提交于 2021-02-11 15:46:39
问题 I am trying to create a Rock, Paper, Scissors for my discord bot in discord.js. I attempted to create on but it currently is not working. I'd like the emojis to disappear once the reaction has been made and am unsure how to do that. module.exports = { name: "rps", description: "A game of Rock, Paper, Scissors!", execute(message) { var rps = ["🗿", "📜", "✂️"] const m = message.channel.send("Let's play a game of Rock, Paper, Scissors! Please react what you would like to choose with the emojis

How to attach an image to an embed

自作多情 提交于 2021-02-11 15:08:34
问题 I've been trying to figure this out for a while. I can't figure out how to make a bot attach an image to an embed. I'm trying to upload a picture from my PC. const commando = require('discord.js-commando'); const discord = require('discord.js') class HoundCommand extends commando.Command { constructor(client) { super(client, { name: 'hound', group: 'simple', memberName: 'hound', description: 'Tells info about hound' }); } async run(message, args) { var myInfo = new discord.RichEmbed()