discord.js

Remove a users reaction from fetchMessage? - Discord JS

旧巷老猫 提交于 2020-04-18 05:54:05
问题 I have a question with Discord JS How do I remove a specific users reaction from a fetched message? I tried this message.channel.fetchMessage(messageID).then(m => { m.reactions.remove(UserID) }) But it doesn't remove the actual reaction. Help would be appreciated thanks. 回答1: message.reactions is a collection of messageReactions . I think you need to loop through the collection and then remove the messageReaction required. message.channel.fetchMessage(messageID).map(r => r).then(message => {

Discord.js - Check list bot

久未见 提交于 2020-04-17 21:31:31
问题 I'm currently developing a discord bot using discord.js for a private usage. Here's a little context: in my server we organize events with 30 - 40 members in a voice channel (all of them have roles corresponding to events), and we need to check who's missing. So basically the bot need to compare 2 list, members with event role who's are connected on the voice channel and another one with those whose have the role but are not connected on the designated voice channel. I've done some research,

Discord.js - Check list bot

早过忘川 提交于 2020-04-17 21:31:00
问题 I'm currently developing a discord bot using discord.js for a private usage. Here's a little context: in my server we organize events with 30 - 40 members in a voice channel (all of them have roles corresponding to events), and we need to check who's missing. So basically the bot need to compare 2 list, members with event role who's are connected on the voice channel and another one with those whose have the role but are not connected on the designated voice channel. I've done some research,

Discord.js error = “message is not defined”

℡╲_俬逩灬. 提交于 2020-04-17 20:34:49
问题 const Discord = require('discord.js'); exports.run = async (bot, message, args) => { let userInfMent = message.guild.member(message.mentions.users.first() || message.guild.members.get(args[0])) message.channel.send(userInfo(userInfMent)); } function userInfo(user) { const Discord = require('discord.js'); let userInfMent = message.guild.member(message.mentions.users.first() || message.guild.members.get(args[0])) var userCreated = userInfMent.createdAt.toString().split(' '); var lastMsg =

Discordbot doesn't play music with ytdl-core

孤街浪徒 提交于 2020-04-16 03:07:33
问题 I typed in the command in Discord to play music and the bot joins but disconnects a few seconds afterwards from the Voice Channel without playing the music. A few days ago it worked just fine but now it doesn't and I can't find the mistake in the code. I have ffmpeg and opusscript installed so that can't be the mistake. I hope someone can help me: const Discord = require('discord.js'); const ytdl = require('ytdl-core'); const bot = new Discord.Client(); const prefix = "$"; const token = "";

Discordbot doesn't play music with ytdl-core

一个人想着一个人 提交于 2020-04-16 03:06:04
问题 I typed in the command in Discord to play music and the bot joins but disconnects a few seconds afterwards from the Voice Channel without playing the music. A few days ago it worked just fine but now it doesn't and I can't find the mistake in the code. I have ffmpeg and opusscript installed so that can't be the mistake. I hope someone can help me: const Discord = require('discord.js'); const ytdl = require('ytdl-core'); const bot = new Discord.Client(); const prefix = "$"; const token = "";

Discord.js Display Server User Count separately from Server Bot Member Count

佐手、 提交于 2020-04-11 08:09:42
问题 I am trying to create a serverinfo command for my Discord.js Bot. I am trying to get the Discord Server User Count separate from the Server's Bot Count. I have been told to use the .filter but I don't understand how to filter the bot count from the user count. 回答1: Well from guild.members you'll get a Collection with all the members (users and bots). With .filter you can "exclude" items of a collection if they don't match something. For example: guild.members.filter(member => !member.user.bot

Discord.js: How to send a message and collect reactions from it

北战南征 提交于 2020-03-26 03:03:41
问题 I want the discord.js bot to send a message when a command is executed, react on it and then catch all reactions from users to do certain stuff, like respond to them. No time limit should be applied to reactions. I should also mention that I'm using a command handler and the message is being sent from another file than index.js (in which the collect even should occur). I tried doing a collector but no matter how I do it, the collector variable is not defined or not working. I know it should

Discord.js Issue with “.addRole”

北城以北 提交于 2020-03-25 18:54:07
问题 So, I have been having issues setting up a bot that roles a user to a role that includes emoticons. Example: const guildMember = message.member; guildMember.addRole('<@&439191493169643521>'); I've also tried: // content.js const guildMember = message.member; guildMember.addRole(config.n); // config.json { "n": "🦊Fox" } and also I've tried it without config.json, and just put the raw rank name, but it always doesn't work. This is the Console: (node:15600) UnhandledPromiseRejectionWarning:

How do I send a message to all guilds in discord.js with v12+ (12.0.0 and up)

回眸只為那壹抹淺笑 提交于 2020-03-21 07:08:10
问题 if (command === "sendguildmessages") { if (message.author.id === "231956829159161856") { var guildList = client.guilds.array(); try { guildList.forEach(guild => guild.defaultChannel.send("messageToSend")); } catch (err) { console.log("Could not send message to a (few) guild(s)!"); } } else { message.reply(`You cant do that!`) } } else I tried using v11.2 but that was a K.O. It says that it is outdated and needs to be updates. What can I replace with this code? 回答1: defaultChannel() is already