discordjs / Commando

Official command framework for discord.js
Apache License 2.0
496 stars 242 forks source link

There is no current way to take an image/attachment as an arg #279

Closed comicallybad closed 3 years ago

comicallybad commented 5 years ago

If there is a way I am not sure of please I would love to hear it, but with the current package, I can find no way of accepting an image as an argument. I am making a bot which takes a user image input, to then put within a rich embed to send to another channel. I would like to stick with the packages way of multiple arguments, where in the channel it is one after the other, one at a time. But then this issue makes me take things outside of the package.

GamesProSeif commented 5 years ago

If the image is attached to the message, you can access its details inside Message#attachments (stable | master), so that's a way to get an image as an argument.

I would recommend not using Github issues for general help on the library usage but using the Discord.js Official Discord server instead. You'll have way more support there. Good luck!

Edit: I thought this was discordjs/discord.js repo and not Commando. I apologize for the conflict.

comicallybad commented 5 years ago

All good. Like I definitely know of ways I can get ahold of the image. But for convenience sake, having a type "attachment" for arguments would force me to basically recode what is already coded to just allow for an image. Because Now I will just have to do what the package does, send a message asking for the next argument in this case an image. Then await a response for 30 seconds. Then store that for the final rich embed message. So just inconvenient.

dragonfire535 commented 3 years ago

You can use https://github.com/dragonfire535/xiao/blob/master/types/image.js, but due to issues with prompting the type hasn't been added to Commando yet.

dragonfire535 commented 3 years ago

Using #367, you should be able to accept an image argument perfectly fine if you write your own argument to do so. The above link to Xiao's should work perfectly.