{ author: message.author, content: message.content },
client.on("message", async message => { if (message.author && message.author.bot) { return; } try { const myMessage = new Discord.Message( client, { author: { id: "myID" }, content: "My new Message" }, message.channel ); console.log(myMessage);
{ author: message.author, content: message.content },
but to no avail. The error was the same. So what am I doing wrong here?
After hacking the source code of discord.js I discovered the culprit in the Message.js file. It is this line:
this.createdTimestamp = SnowflakeUtil.deconstruct(this.id).timestamp;
The problem is that I never passed any id
to the constructor function in my data
object. Just passing a fake id (a string of random numbers) did the trick.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.