Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

how to make a discord js bot get its own message id

// with async/await:
async function replyAndLog() {
  let sent = await message.reply("Your stuff..."); // this returns the message you just sent
  let id = sent.id; // you can get its ID with <Message>.id, as usually
  console.log(id);
}

// with <Promise>.then():
message.reply("Your stuff").then(sent => { // 'sent' is that message you just sent
  let id = sent.id;
  console.log(id);
});
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #discord #js #bot #message #id
ADD COMMENT
Topic
Name
5+3 =