functions across modules returning undefined

i have a function in another script (being imported):
(async () => {
const channel = client.channels.cache.get("1148814162273763418");
const msg = await channel.send(message);
console.log(msg + " from sendMainMessage");
return msg;
})();
(async () => {
const channel = client.channels.cache.get("1148814162273763418");
const msg = await channel.send(message);
console.log(msg + " from sendMainMessage");
return msg;
})();
being imported and ran from:
const msg = await action.sendMainMessage("test");
console.log(msg);
const msg = await action.sendMainMessage("test");
console.log(msg);
the log in the 1st one logs fine, the log in the 2nd one logs undefined before the bot asks nodejs v19.0.0 discord.js version 14.13.0
1 Reply
d.js toolkit
d.js toolkit15mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button! - Marked as resolved by OP
Want results from more Discord servers?
Add your server