discord.js

How can i set custom status in discord bot according to new update

我是研究僧i 提交于 2019-12-04 05:46:42
问题 according to new update u can set your own custom status without playing or listening this is't added in documentation yet what can i do here there is no option to set custom activity in the discord.js git see the image stable/src/util/Constants.js here too discord status image 回答1: Discord libaries should only be used for bots, using the API for user-account clients violates Discords Terms of Service as this is considered as API Abuse. Moreover the recent announcement does not apply for bots

DiscordAPIError: Unknown Message

为君一笑 提交于 2019-12-04 05:16:15
问题 I have made a freeze command using discord.js and commando, that gives the user a role, and keeps them from talking and chatting. It seems that every time I run it though, it tosses an error: (node:7352) UnhandledPromiseRejectionWarning: DiscordAPIError: Unknown Message I haven't been able to find what it is, but maybe i'm just a nub. Code: async run(message, { user }) { message.delete() const member = message.guild.member(user); if (!message.member.hasPermission("MUTE_MEMBERS")) return

DeprecationWarning: Collection#find: pass a function instead

老子叫甜甜 提交于 2019-12-04 02:49:39
I'm quite a newbie to node.js and I'm currently using discord.js to make a Discord bot. As soon as any bot command gets used the console prints a DeprecationWarning. for example: (node:15656) DeprecationWarning: Collection#find: pass a function instead (node:15656) sometimes is another number, nearly always changing. This is what my code looks like (only one command, I've got multiple, I get this error with all of them though): const botconfig = require("./botconfig.json") const Discord = require("discord.js"); const bot = new Discord.Client(); bot.on("ready", () => { console.log(`Launched $

Sending private messages to user

一笑奈何 提交于 2019-12-03 12:30:12
问题 I'm using the discord.js library and node.js to create a Discord bot that facilitates poker. It is functional except the hands are shown to everyone, and I need to loop through the players and send them a DM with their hand. bot.on("message", message => { message.channel.sendMessage("string"); }); This is the code that sends a message to the channel when any user sends a message. I need the bot to reply in a private channel; I've seen dmChannel , but I do not understand how to use it. I have

Discord.js // Filtering message startsWith and work around DiscordAPIError for bulkDelete

孤街醉人 提交于 2019-12-02 20:40:19
问题 This is my current code. Credit goes to @André Dion for the help. if (message.channel.type == 'text') { message.channel.fetchMessages().then(messages => { const botMessages = messages.filter(msg => msg.author.bot) message.channel.bulkDelete(botMessages); messagesDeleted = botMessages.array().length; // number of messages deleted // Logging the number of messages deleted on both the channel and console message.channel.send("Deletion of messages successful. Total messages deleted: " +

Overlapping commands?

旧时模样 提交于 2019-12-02 11:20:47
I'm trying to make a fun little discord chat bot with JavaScript and node.js and I'd like to put in a specific command without it affecting another one I already have set up. She works wonderfully on all the servers I have her on, and I've got it set up so that when someone in the server says anything with "rei are", she responds with a constant from areResponses. //const!!! const areResponses = ["HELL yeah!", "Yep!", "I'm pretty sure that's true!", "I\'m not gonna put all the responses here because then it'd be too long..."]; //theres some other bot stuff (console log, now playing) under here

Discord.js // Filtering message startsWith and work around DiscordAPIError for bulkDelete

感情迁移 提交于 2019-12-02 10:01:21
This is my current code. Credit goes to @André Dion for the help. if (message.channel.type == 'text') { message.channel.fetchMessages().then(messages => { const botMessages = messages.filter(msg => msg.author.bot) message.channel.bulkDelete(botMessages); messagesDeleted = botMessages.array().length; // number of messages deleted // Logging the number of messages deleted on both the channel and console message.channel.send("Deletion of messages successful. Total messages deleted: " + messagesDeleted); console.log('Deletion of messages successful. Total messages deleted: ' + messagesDeleted) })

DiscordAPIError: Unknown Message

拈花ヽ惹草 提交于 2019-12-02 03:14:07
I have made a freeze command using discord.js and commando, that gives the user a role, and keeps them from talking and chatting. It seems that every time I run it though, it tosses an error: (node:7352) UnhandledPromiseRejectionWarning: DiscordAPIError: Unknown Message I haven't been able to find what it is, but maybe i'm just a nub. Code: async run(message, { user }) { message.delete() const member = message.guild.member(user); if (!message.member.hasPermission("MUTE_MEMBERS")) return message.say("Sorry, but you do not have the Mute Members Permission! If you beleive this is a error, contact

Discord.js setGame() not working anymore

醉酒当歌 提交于 2019-12-01 21:02:55
I have been coding my Discord bot using Discord.JS for about 2 months now and I've just recently noticed that my bot isn't saying that it's playing what I'm telling it. When I first coded the bot up until recently it worked just fine. Now the 3 discord bots I have aren't showing their games. This is the code I'm using: const Discord = require("discord.js"); const bot = new Discord.Client(); bot.on("ready", () => { console.log("Ready"); bot.user.setGame("Type !help"); } .setGame() is deprecated now but you could use .setPresence() or you could use the .setActivity() which is the same thing and

Change user nickname with discord.js

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-30 19:50:49
I wonder if you can help (I search it and nothing...) I am learning how to work with discord.js node and I want to change my user nickname (not the username itself) My code is const Discord = require('discord.js'); const client = new Discord.Client(); client.on('ready', () => { console.log('I am ready!'); }); client.on('message', message => { if (message.content.includes('changeNick')) { client.setNickname({nick: message.content.replace('changeNick ', '')}); } }); client.login('token'); According to the Docs , You can only change a guild members nickname, so you need to get the member object