discord.js

Bot won't messsage on join (djs)

爷,独闯天下 提交于 2021-02-05 08:42:17
问题 My bot doesn't send the message on join. client.on('guildMemberAdd', member => { const linkId = pool.createLink(client.id); const embed = new Discord.MessageEmbed() .setTitle('reCAPTCHA Verification') .setDescription(`To gain access to this server you must solve a captcha. The link will expire in 15 minutes.\nhttp://${domain == '' ? 'localhost:8050' : domain}/verify/${linkId}`) .setColor('BLUE') member.send(embed) }) 回答1: Given that you aren't getting any errors in your code, I'm assuming the

Discord.js unable to login after using Client#destroy()

纵饮孤独 提交于 2021-02-05 08:00:47
问题 switch (command[0]) { case 'restart': if(msg.author.id == config["owner"]){ msg.channel.send(preEmbed('clientRestart')); client.destroy(); client.login(config["token"]); } break; } this causes the error DiscordjsError: Request to use token, but token was unavailable to the client. anyone know the cause / fix? 回答1: According to discord.js' github repo, you get that message when you don't provide a token, so make sure you are providing the token correctly. 来源: https://stackoverflow.com

Using discord.js to detect image and respond

落爺英雄遲暮 提交于 2021-02-05 07:42:23
问题 I'm trying to make a prank Discord bot for my friend's Discord server, but the bot won't respond to anything; not even the elseif function passes. If anyone know why my code isn't working can you please specify it. NOTE: Client variable is Discord.Client if you needed a reference. client.on("message", message => { if (message.channel.id != 425328056777834506) return; if (Math.floor(Math.random() * Math.floor(4))== 3 && message.embeds.length > 0) { message.channel.send("https://cdn.discordapp

Discord bot editing messages too slow

江枫思渺然 提交于 2021-02-04 20:50:51
问题 I want my discordbot to send send a message with an attached file in it and a text. Then the bot has to edit this text a couple of times but the problem is that when bot eddits message 5 times then it waits some time and then edits again 5 times etc etc. How can i make it edit messages without stopping? if(msg.content.includes("letter")){ msg.channel.send("alphabet", { files: ["/Users/48602/Videos/discordbot/aaa.png"]})} if(msg.content === 'alphabet'){ msg.edit("**a**") msg.edit("**b**") msg

Discord bot editing messages too slow

痞子三分冷 提交于 2021-02-04 20:50:26
问题 I want my discordbot to send send a message with an attached file in it and a text. Then the bot has to edit this text a couple of times but the problem is that when bot eddits message 5 times then it waits some time and then edits again 5 times etc etc. How can i make it edit messages without stopping? if(msg.content.includes("letter")){ msg.channel.send("alphabet", { files: ["/Users/48602/Videos/discordbot/aaa.png"]})} if(msg.content === 'alphabet'){ msg.edit("**a**") msg.edit("**b**") msg

Discord bot editing messages too slow

霸气de小男生 提交于 2021-02-04 20:49:56
问题 I want my discordbot to send send a message with an attached file in it and a text. Then the bot has to edit this text a couple of times but the problem is that when bot eddits message 5 times then it waits some time and then edits again 5 times etc etc. How can i make it edit messages without stopping? if(msg.content.includes("letter")){ msg.channel.send("alphabet", { files: ["/Users/48602/Videos/discordbot/aaa.png"]})} if(msg.content === 'alphabet'){ msg.edit("**a**") msg.edit("**b**") msg

Get all arguments after args[0] discord.js

笑着哭i 提交于 2021-02-02 09:55:54
问题 I was trying to make a mute command, and I was adding a system where you can mute them for a reason. The bot would reply "(Username of user) was muted. Reason: (The reason)". For me args[0] is just mentioning the user that you want to mute, but I can't figure out how to get all after args[0]. I've tried doing something like this message.channel.send('I have muted' + (mutedUser) + 'Reason: ' + args[1++] . But that obviously didn't work - I was kind of guessing - I turned to listing 4 arguments

Get all arguments after args[0] discord.js

会有一股神秘感。 提交于 2021-02-02 09:54:46
问题 I was trying to make a mute command, and I was adding a system where you can mute them for a reason. The bot would reply "(Username of user) was muted. Reason: (The reason)". For me args[0] is just mentioning the user that you want to mute, but I can't figure out how to get all after args[0]. I've tried doing something like this message.channel.send('I have muted' + (mutedUser) + 'Reason: ' + args[1++] . But that obviously didn't work - I was kind of guessing - I turned to listing 4 arguments

Discord.js bot responds when mentioned

南楼画角 提交于 2021-02-01 05:14:57
问题 I'm trying to make my discord.js bot send a message when it is pinged. I was unsure how to do this so I referred to this code: client.on('message', message => { if (message.content === '<@745648345216712825>') { message.channel.send('Message Here'); } }); However, this doesn't work. Also, is it possible that my bot responds when a person mentions a specific user for example if I am mentioned by the user anywhere in a message the bot responds? If yes, can you show me how to do it? 回答1: Message

Discord.js bot responds when mentioned

ぐ巨炮叔叔 提交于 2021-02-01 05:14:35
问题 I'm trying to make my discord.js bot send a message when it is pinged. I was unsure how to do this so I referred to this code: client.on('message', message => { if (message.content === '<@745648345216712825>') { message.channel.send('Message Here'); } }); However, this doesn't work. Also, is it possible that my bot responds when a person mentions a specific user for example if I am mentioned by the user anywhere in a message the bot responds? If yes, can you show me how to do it? 回答1: Message