#[SOLVED] Having Issue with getting ID of a message out of a .then to use it later

8 messages · Page 1 of 1 (latest)

waxen glacier
#

show code

gentle oak
#

All I have to say, without seeing the code only from the title. Is that you cannot use a variable assigned in a .then outside of the .then, the function in it is called after and not directly which makes this impossible. If you need it outside, make it so your code uses it inside instead or use await to simplify your code

#

@lament igloo I saw you did post your code but one of the bot thinks there is a link in it. I unmuted you and please send your code using pastebin or hastebin or anything you like to share code

waxen glacier
#

const messageID = await channel.send({ content: 'Some message' }).then(m => m.id)
possibly

lament igloo
lament igloo
#

[SOLVED] Having Issue with getting ID of a message out of a .then to use it later

#

Okay, for thoses who's asking how I solved it, simply by using

global.idoftest = msg.id