discord.js

.drawImage function is throwing a “TypeError: Image or Canvas expected”, for canvas

帅比萌擦擦* 提交于 2020-01-30 07:42:57
问题 I am trying to add a rank card in my discord bot, and in order to do so I am trying to use canvas but when I use canvas everything works fine until I hit the .drawImage method. Where it gives me an error saying "TypeError: Image or Canvas expected". Although I've already require('canvas') globally, and everything else that has to do with canvas works properly as well. I've tried to require('canvas') inside the function but that doesn't fix the problem either. const canvas = Canvas

How to make a interactive command in discord.js

一个人想着一个人 提交于 2020-01-26 04:52:26
问题 I am wondering how in discord.js to make a interactive giveaway command like the giveaway bot I am in V11/12 For example when I do g!giveaway start, it starts a interactive setup what will work like this The bot will say "Time" Then I set the type it will last with variables (m for minutes, d for days, w for weeks) Then it will say "Okay! Now what do you want to giveaway?" Then I just say what I want to giveaway And then it will say "Great! What channel will the giveaway be in?" Then I put

How to make a interactive command in discord.js

我的未来我决定 提交于 2020-01-26 04:52:10
问题 I am wondering how in discord.js to make a interactive giveaway command like the giveaway bot I am in V11/12 For example when I do g!giveaway start, it starts a interactive setup what will work like this The bot will say "Time" Then I set the type it will last with variables (m for minutes, d for days, w for weeks) Then it will say "Okay! Now what do you want to giveaway?" Then I just say what I want to giveaway And then it will say "Great! What channel will the giveaway be in?" Then I put

Cannot find module 'm3u8stream/lib/parse-time'

血红的双手。 提交于 2020-01-24 10:16:32
问题 is there anyway to fix this? I've been trying to resolve this myself but I give up throw err; ^ Error: Cannot find module 'm3u8stream/lib/parse-time' at Function.Module._resolveFilename (internal/modules/cjs/loader.js:582:15) at Function.Module._load (internal/modules/cjs/loader.js:508:25) at Module.require (internal/modules/cjs/loader.js:637:17) at require (internal/modules/cjs/helpers.js:22:18) at Object.<anonymous> (/rbd/pnpm-volume/71b5ddd8-2a78-46fc-aba4-68049f14880d/node_modules/

Discord.js - Getting users last activity?

一世执手 提交于 2020-01-24 06:44:06
问题 I'm trying to find out if its possible to get the time/information of users last activity retrospectively using discord.js Say I have something like client.guilds.find('id', 'SERVER ID').fetchMembers().then(members => { const role = members.roles.find('name', 'Newbies') role.members.forEach(member => { console.log(member.user.lastMessage) // null }) }) Unless the member has posted, since the client is listening, the lastMessage is always null. Is there a way to find the last activity? or a

Discord.js setGame() not working anymore

。_饼干妹妹 提交于 2020-01-21 12:43:16
问题 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"); } 回答1: .setGame() is

Discord.js setGame() not working anymore

不想你离开。 提交于 2020-01-21 12:43:10
问题 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"); } 回答1: .setGame() is

Sending private message to a group of user (Discord.js)

徘徊边缘 提交于 2020-01-17 01:15:15
问题 I'm looking a way to send a private message to à group of users, who have the same role (using discord.js) I found the way to send a message (client.users.get("ID").send("Message"); But not the way to get all member who have the same role and loop on that list to send them a private message. Someone can help me? 回答1: You could do so by first making a list of all the members with the desired role (see Collection.filter()), and then loop through (see Map.forEach()) and send a DM to each member.

How to create a !verify command with Discord.js and mysql

混江龙づ霸主 提交于 2020-01-16 16:07:32
问题 I am trying to create a verification command that checks if a user is registered on my site, and changes the discord nickname to the site nickname. The command will be !verify nickname, and the bot will do the connection and return the results. This is for a Windows server running XAMPP. Does someone knows how to do it or have a tutorial? 来源: https://stackoverflow.com/questions/57545221/how-to-create-a-verify-command-with-discord-js-and-mysql

How to create a !verify command with Discord.js and mysql

孤者浪人 提交于 2020-01-16 16:06:52
问题 I am trying to create a verification command that checks if a user is registered on my site, and changes the discord nickname to the site nickname. The command will be !verify nickname, and the bot will do the connection and return the results. This is for a Windows server running XAMPP. Does someone knows how to do it or have a tutorial? 来源: https://stackoverflow.com/questions/57545221/how-to-create-a-verify-command-with-discord-js-and-mysql