javascript - Make Discord bot send picture with message with NodeJS -
i have few pictures, on imgur direct image link (format: https://i.imgur.com/xxxxxx.jpg), , discord bot made nodejs.
i send messages this:
bot.sendmessage({ to: channelid, message: "my bot's message" });
i have tried this:
bot.sendmessage({ to: channelid, message: "my bot's message", file: "https://i.imgur.com/xxxxxxx.jpg" });
but text. have looked up, , this question 1 come close saying need do, , didn't work.
so how supposed this?
here how bot created:
var bot = new discord.client({ token: auth.token, autorun: true }); bot.on('ready', function (evt) { logger.info('connected'); logger.info('logged in as: '); logger.info(bot.username + ' - (' + bot.id + ')'); }); bot.on('message', function (user, userid, channelid, message, evt) { // code }
clientuser.sendmessage
deprecated, file
parameter in options. should using channel.send(message, options)
, files
array of strings or fileoptions.
bot.on('message' message => { message.channel.send("my bot's message", {files: ["https://i.imgur.com/xxxxxxx.jpg"]}); });
if want stick deprecated methods, clientuser.sendfile
might of interest you, though recommend move on stuff that's more current.
Comments
Post a Comment