sharlotte
sharlotte
DIAdiscord.js - Imagine an app
Created by sharlotte on 9/15/2023 in #djs-questions
Interaction Managing Duty
well, it works.
32 replies
DIAdiscord.js - Imagine an app
Created by sharlotte on 9/15/2023 in #djs-questions
Interaction Managing Duty
No description
32 replies
DIAdiscord.js - Imagine an app
Created by sharlotte on 9/15/2023 in #djs-questions
Interaction Managing Duty
i know user can delete the message but that makes user to be tired. so let it be deleted automatically
32 replies
DIAdiscord.js - Imagine an app
Created by sharlotte on 9/15/2023 in #djs-questions
Interaction Managing Duty
public async send(channel: Discord.TextBasedChannel | null = this.interaction.channel): Promise<Discord.Message> {
if (!channel) throw new Error("channel does not exist");
const options: Discord.MessageCreateOptions = {
content: this.content,
embeds: this.embeds,
components: this.components,
files: this.files,
};
// actually doesn't need to await.
(async () => {
if (this.interaction.isRepliable()) {
await this.interaction.deferReply({ ephemeral: true });
this.interaction.deleteReply();
}
})();
const sent = await channel.send(options);
this.message = sent;
return sent;
}
public async send(channel: Discord.TextBasedChannel | null = this.interaction.channel): Promise<Discord.Message> {
if (!channel) throw new Error("channel does not exist");
const options: Discord.MessageCreateOptions = {
content: this.content,
embeds: this.embeds,
components: this.components,
files: this.files,
};
// actually doesn't need to await.
(async () => {
if (this.interaction.isRepliable()) {
await this.interaction.deferReply({ ephemeral: true });
this.interaction.deleteReply();
}
})();
const sent = await channel.send(options);
this.message = sent;
return sent;
}
32 replies
DIAdiscord.js - Imagine an app
Created by sharlotte on 9/15/2023 in #djs-questions
Interaction Managing Duty
well, i tried (1 -> 2), 3 at the same time with ephemeral reply. this still require to send the message but feels better! thanks for your answers
32 replies
DIAdiscord.js - Imagine an app
Created by sharlotte on 9/15/2023 in #djs-questions
Interaction Managing Duty
ah, that was some steps! i thought that was choices
32 replies
DIAdiscord.js - Imagine an app
Created by sharlotte on 9/15/2023 in #djs-questions
Interaction Managing Duty
* deferReply is for reacting to message later, not for dismiss. isn't it? * deleteReply is out of the context. deleting reply is not wanted situation for every case. * Sending a message in another channel - yes, that's what i exact have done.
// ignore the interaction field - that's out of the context
public async send(channel: Discord.TextBasedChannel | null = this.interaction.channel): Promise<Discord.Message> {
if (!channel) throw new Error("channel does not exist");
const options: Discord.MessageCreateOptions = {
content: this.content,
embeds: this.embeds,
components: this.components,
files: this.files,
};
const sent = await channel.send(options);
this.message = sent;
return sent;
}
// ignore the interaction field - that's out of the context
public async send(channel: Discord.TextBasedChannel | null = this.interaction.channel): Promise<Discord.Message> {
if (!channel) throw new Error("channel does not exist");
const options: Discord.MessageCreateOptions = {
content: this.content,
embeds: this.embeds,
components: this.components,
files: this.files,
};
const sent = await channel.send(options);
this.message = sent;
return sent;
}
but as you see, this is not replying to interaction. this is just creating new message to given channel.
32 replies
DIAdiscord.js - Imagine an app
Created by sharlotte on 9/15/2023 in #djs-questions
Interaction Managing Duty
for an example, if a button is clicked, the discord bot will run some logic which depends on that button clicking. but sometimes the discord bot doesn't want to response anything to the message. or there are no way to response, for example in my case, i want to reply interaction in another thread channel - not exactly same channel where the message is in.
32 replies
DIAdiscord.js - Imagine an app
Created by sharlotte on 9/15/2023 in #djs-questions
Interaction Managing Duty
RealTimeRPG@ C:\Users\user\Documents\GitHub\RealTimeRPG
├─┬ @discordx/[email protected]
└── [email protected] deduped
├─┬ @discordx/[email protected]
└── [email protected] deduped
└── [email protected] deduped
RealTimeRPG@ C:\Users\user\Documents\GitHub\RealTimeRPG
├─┬ @discordx/[email protected]
└── [email protected] deduped
├─┬ @discordx/[email protected]
└── [email protected] deduped
└── [email protected] deduped
and node version is v18.13.0. but i think you don't need to know about these because this is about not to implementions - but just abstract solution about managing interaction.
32 replies