discord.js

I want a coin system for seating in a voice channel per 1 minute

守給你的承諾、 提交于 2020-06-17 09:44:07
问题 I did that the bot fixes when the user enters and leaves the voice channel, i want for each minute of sitting there a participant dripping 200 coins, i already did so with the chat. For my idea, I need "ms" and "fs" to capture a minute (60000 milliseconds) I also have a file where all the coins are chased, I want the amount per minute to go there const Discord = require('discord.js'); const fs = require("fs"); const ms = require("ms"); const token = "my token here"; const prefix = "!"; const

How to send a message to all members who have a role (discord.js)

99封情书 提交于 2020-06-17 09:42:11
问题 I'm coding a bot using discord.js. I would like to send a <message> to all members who have <role> when I write : /a <role> <message> in a channel. How can I do this ? Thank you for your help ! ;) 回答1: Here is a possibility how it could work: const args = message.content.split(" "); const roleArgs = args.slice(0, 1); const messageArgs = args.slice(1) const role = message.guild.roles.find(role => role.name.toLowerCase() === roleArgs.join(" ").toLowerCase()) if (!role) return message.reply(

How to get specific member username with discord.js

穿精又带淫゛_ 提交于 2020-06-17 02:36:19
问题 I would like to add one specific member information (username + avatar) into an embed message. Does someone know how to do that? const feedback = new discord.RichEmbed() .setColor([0, 0, 255]) .setFooter("Bot created by : " + message.author.username, message.author.avatarURL) .setDescription("The text I want to be sent") On the code above, I would like to change "message.author.username" and "message.author.avatarUrl" by a specific discord member identification id such as : 436577130583949315

Get Message By ID: Discord.js

我只是一个虾纸丫 提交于 2020-06-08 17:01:12
问题 I am doing a report system for a discord bot and I want the player to report a specific message by the id so that the moderators can decide if it is offensive or not. I am struggling to find a way to get the message's text from the given id. Is there a possible way of doing this? 回答1: You can retrieve a message by id through msg.channel.fetchMessage(); The documentation is here. If you want to be able to retrieve a message from any channel by id, you can loop through all channels and catch

Get Message By ID: Discord.js

守給你的承諾、 提交于 2020-06-08 17:00:47
问题 I am doing a report system for a discord bot and I want the player to report a specific message by the id so that the moderators can decide if it is offensive or not. I am struggling to find a way to get the message's text from the given id. Is there a possible way of doing this? 回答1: You can retrieve a message by id through msg.channel.fetchMessage(); The documentation is here. If you want to be able to retrieve a message from any channel by id, you can loop through all channels and catch

Discord.js not writing data to .json file

早过忘川 提交于 2020-06-01 06:22:11
问题 This is my ban command, im trying to export the code to work within a command handler. Iv had numerous issues with this command but eventually i have almost everything working. The code runs perfectly until the point where it should write to .json file (I changed the .json directory to make sure it was being found, and it threw an error so the previous line of code is definitely running, and its finding the .json). Any help would be greatly appreciated, thank you I have also tried replacing

Discord.js Toggle Commands On Multible Servers

随声附和 提交于 2020-06-01 05:59:05
问题 So i want a discord bot were you can toggle commands on the server the command was writen in. Just for an example: if(cmd === "me"){ message.channel.send(`You <@${message.author.id}>!`); } To toggle the command on/of on any server you would need to write " me on " or " me off ". " me on " Will allow to execute the command on that server and " me off " will not allow the command to be executed on that server. I would like this to work on many servers so no allow on guild etc. 回答1: Keep track

Discord.js — How to read all users in a voice channel and send a private message to each of them containing a random role

和自甴很熟 提交于 2020-06-01 04:38:41
问题 I want to make a Wolves/Mafia-esque game on my server. When I write the command !role 1wolf 2villagers , I would like to randomly distribute the specified roles by private message (so 1 person receives the wolf role and 2 people receive the villager role) to all the people in a specified voice channel. The roles are not literal guild roles but simply a message. 回答1: You can do it easily: client.on('message', (message) => { if(message.content.startsWith('!role')){ let channelID = 'your voice

Discord.js — How to read all users in a voice channel and send a private message to each of them containing a random role

你说的曾经没有我的故事 提交于 2020-06-01 04:38:25
问题 I want to make a Wolves/Mafia-esque game on my server. When I write the command !role 1wolf 2villagers , I would like to randomly distribute the specified roles by private message (so 1 person receives the wolf role and 2 people receive the villager role) to all the people in a specified voice channel. The roles are not literal guild roles but simply a message. 回答1: You can do it easily: client.on('message', (message) => { if(message.content.startsWith('!role')){ let channelID = 'your voice

Discord JS - How to react multiple times to the same embed?

大城市里の小女人 提交于 2020-05-31 06:04:20
问题 I've only gotten the first "moneybag" emoji to react to the newest message in the channel, which is the embed that the bot sends, however, I want the bot to react to the new embed with both the "money bag" and "ticket" emojis and so far it will react with the "money bag" emoji but, errors out when it tries to react with the "ticket" emoji. How do I get the bot to react to the new embed with both emojis? if (message.content === '-new') { const filter = (reaction, user) => { return ['💰', '🎟']