discord.js

Using a custom emoji based on the user presence status in a MessageEmbed

空扰寡人 提交于 2019-12-13 03:36:00
问题 Making a userinfo command for my bot, but I seem to be running into some trouble with using custom emojis that will display differently depending on the user's presence. (Online, Away, DND, Offline). I'm curious as to how this could be accompolished. Anyone have any tips? 回答1: I: checking for the presence You can do this by simply checking User.presence.status, that can be either "online" , "idle" , "dnd" or "offline" II: using custom emojis To use a custom emoji you need to know its name or

Cannot read property 'send' of undefined in discord.js

只愿长相守 提交于 2019-12-13 03:24:47
问题 So im trying to code a discord bot that sends the name and id of every message in every channel to the Admin channel, but it says it cant read the property of send? Any Ideas?(Im more or less new to javascript,but i understand the basics of discord.js) bot.on('message',(message) =>{ bot.channels.get(459435599850504212).send(message.author.tag + ' ' + message.author.id)}) I know it would answer itself in a loop,but i just want to fix the send. 回答1: The channel id should be in quotes. bot

Discord app error R10 when deploying with Heroku

烈酒焚心 提交于 2019-12-12 14:02:14
问题 I tried to deploy my discord bot made with Node.js to Heroku, the build is successful but the app crashes and throws an error: Error R10 (Boot timeout) Web process failed to bind to $PORT within 60 seconds of launch My Procfile : web: node app.js package.json : { "name": "bot", "version": "5.0", "description": "Discord Bot", "main": "app.js", "scripts": { "start": "node app.js" }, "author": "me", "license": "MIT", "dependencies": { "discord.js": "^11.3.2", "ffmpeg-binaries": "^3.2.2-3", } }

how to fix events not working after restarting the bot

送分小仙女□ 提交于 2019-12-12 00:55:53
问题 i have a problem with the message reaction, i made the bot to delete any message sent on channel names appeal and send it to another channel names the appeals and react to the message with :white_check_mark: and if someone reacted to the message with the :white_check_mark:, the bot will automaticly delete the bot, thats working but there is a problem, if i restarting the bot and reacting to the message sent before the restarting , the bot don't deleting the message why? client.on('message',

Deleting single channel/all channels does not work

痴心易碎 提交于 2019-12-11 22:27:35
问题 I'm creating a bot that manages a server to get used to JavaScript and the Discord.js library. I tried deleting a channel using this code, but it didn't work. guild.channel.delete('Making room for new channels') .then(deleted => console.log(`Deleted ${deleted.name} to make room for new channels`)) .catch(console.error); I've already tried to replace the first line with channel.delete and channel.guild.delete , but I kind of gave up since I have no clue on how to make it delete every channel

Discord.js Arguments With Spaces

橙三吉。 提交于 2019-12-11 19:32:56
问题 So I'm trying to create my bot and I want there to be a command which adds information to a sqlite database https://gyazo.com/6961a05dc2d6aeca6683b59f888c2e82 if (command === "addplayer") { message.delete() let [name, crew, rank, weapon, df, talent, profession, other] = args; if(!name) return message.author.send("Name argument is required!"); let id = name.toLowerCase(); if(!crew) {let crew = "Blank";} if(!rank) {let rank = "Blank";} if(!weapon) {let weapon = "Blank";} if(!df) {let df =

Getting count of a specific reaction on a message

℡╲_俬逩灬. 提交于 2019-12-11 19:06:34
问题 I'm trying to make a bot that will delete messages with a certain amount of thumbsdown reactions. I'm having trouble identifying the count of a specific reaction on a message. Basically, I've created a command that waits for messages and adds them to my msgarray . After each message, I want to go through the array and delete any messages with the specified amount of reactions. This is what I have so far: var msgarray = []; const msgs = await message.channel.awaitMessages(msg => { msgarray

Private messaging a user

风格不统一 提交于 2019-12-11 18:01:44
问题 I am currently using the discord.js library and node.js to make a discord bot with one function - private messaging people. I would like it so that when a user says something like "/talkto @bob#2301" in a channel, the bot PMs @bob#2301 with a message. So what I would like to know is... how do I make the bot message a specific user (all I know currently is how to message the author of '/talkto'), and how do I make it so that the bot can find the user it needs to message within the command. (So

Use different file for bot commands

你。 提交于 2019-12-11 17:54:03
问题 I want to keep my code clean looking and easier to understand, by putting all the longer stuff in another file. I have my main file (index.js): const discord = require('discord.js'); require('dotenv').config() const token = process.env.botToken; const prefix = "s!"; const cmds = require("./commands.js"); var client = new discord.Client(); client.on('ready', function(message) {}); client.on('message', function(message) { if(message.author.equals(client.user) || !message.content.startsWith

Discord.js Music Bot in a command handler

梦想与她 提交于 2019-12-11 17:16:22
问题 I want to make a music bot in my command handler, but I ran into some problems. This is the command handler I use: delete require.cache[require.resolve(`./commands/${command}.js`)]; let commandFile = require(`./commands/${command}.js`); commandFile.run(client, message, args); And in my play.js file I have a queue: var servers = {}; I don't know how to make it so that I can skip a song (using the skip command - skip.js) in the queue. Code for skipping: if (server.dispatcher) server.dispatcher