Closed Conmmander closed 7 years ago
This is not Discord.JS support.
I know, but I am assuming that this is some sort of format issue with whatever inbox.messages returns.
There is an existing problem with getMessages
as outlined in my most recent reply in #34. However I believe this does not affect getting all messages without pages, the reason your messages are outputting [object Object] is because you are printing the entire message object and not just the content of it (because it contains other metadata such as author, date, etc.) You can either stringify everything with JSON.stringify(inbox.messages)
or just print the content of the messages by iterating through each one and getting its content.
for (var i = 0; i < inbox.messages.length; i++) {
console.log(inbox.messages[i].content);
}
Alright, Thank you. I appreciate it!
I've recently begun trying to use discord to manage a roblox bot, and I've been building a command to grab all the messages in the inbox.
My code is:
bot.on('message', (message) => { if(message.content.toLowerCase() == ".getmessages") { const man = bot.channels.get(Management_channelID); rbxlogin() .then(function () { var msgs = robloxjs.getMessages(); robloxjs.getMessages() .then(function (inbox) { //man.send(inbox.messages.sender.name + " " + inbox.messages.subject + " " + inbox.messages.body); console.log(inbox.messages.message); }); }); }; });
The bot also does log in at the very bottom, but whenever I attempt to log a message in the console it will either work (with console.log(inbox.messages);) or not work and return undefined. I've also attempted to send messages to the management channel using just inbox.messages and it ends up returning a whole lot of [object Object]. Is there anything I can do to have discord properly post messages with a sender subject and body, or even just the entire message itself?