gimantha
gimantha
DIAdiscord.js - Imagine an app
Created by gimantha on 8/14/2023 in #djs-questions
`fetchStarterMessage()` doesnt give me the first message of the thread
I am trying to get the first message associated with the thread. But the message object returned from the fetchStarterMessage is not giving me that. Below is the code I used to capture the thread creation.
module.exports = {
name: Events.ThreadCreate,
async execute(thread, newlyCreated) {
if (!newlyCreated) return;
if (!thread.isThread()) return;
thread.awaitMessages().then(v => console.log(v)); // not printing anything
var msg = await thread.fetchStarterMessage();
console.log("msg: ", msg); // the message object has the content, but it is the title of the thread
}
};
module.exports = {
name: Events.ThreadCreate,
async execute(thread, newlyCreated) {
if (!newlyCreated) return;
if (!thread.isThread()) return;
thread.awaitMessages().then(v => console.log(v)); // not printing anything
var msg = await thread.fetchStarterMessage();
console.log("msg: ", msg); // the message object has the content, but it is the title of the thread
}
};
Can you please help me get the first message of the thread?
4 replies
DIAdiscord.js - Imagine an app
Created by gimantha on 8/8/2023 in #djs-questions
How to capture Mouse clicks on Channels in the Channel list in the left-side Panel?
Hi all, I am trying out the discord js guide and have tried out everything till https://discordjs.guide/creating-your-bot/event-handling.html#individual-event-files I would like to know which enum value of Events can be used to identify if an user has clicked on a Channel name. What I want to do is, when an user clicks on a channel on the channel list from the left side panel, give a modal window with a notice for a particular channel only. Not once, every time he clicks on it, the notice must pop up. Can this be done with Events?
5 replies