Serqeevich
Serqeevich
DIAdiscord.js - Imagine an app
Created by Serqeevich on 1/14/2025 in #djs-questions
How to properly use "fetchReply" in Discord.js Interaction API?
Thank you!!! :emoji_52:
43 replies
DIAdiscord.js - Imagine an app
Created by Serqeevich on 1/14/2025 in #djs-questions
How to properly use "fetchReply" in Discord.js Interaction API?
This is pointless advice
43 replies
DIAdiscord.js - Imagine an app
Created by Serqeevich on 1/14/2025 in #djs-questions
How to properly use "fetchReply" in Discord.js Interaction API?
?
43 replies
DIAdiscord.js - Imagine an app
Created by Serqeevich on 1/14/2025 in #djs-questions
How to properly use "fetchReply" in Discord.js Interaction API?
and if i use withResponse i get an error with method createMessageComponentCollector Property 'createMessageComponentCollector' does not exist on type 'InteractionCallbackResponse'
43 replies
DIAdiscord.js - Imagine an app
Created by Serqeevich on 1/14/2025 in #djs-questions
How to properly use "fetchReply" in Discord.js Interaction API?
ok when i use withResponse i get InteractionCallbackResponse and fetchReply return message
43 replies
DIAdiscord.js - Imagine an app
Created by Serqeevich on 1/14/2025 in #djs-questions
How to properly use "fetchReply" in Discord.js Interaction API?
no
43 replies
DIAdiscord.js - Imagine an app
Created by Serqeevich on 1/14/2025 in #djs-questions
How to properly use "fetchReply" in Discord.js Interaction API?
No description
43 replies
DIAdiscord.js - Imagine an app
Created by Serqeevich on 1/14/2025 in #djs-questions
How to properly use "fetchReply" in Discord.js Interaction API?
strange but yes, but it doesn't matter, the problem is not in the warning but in the fact that the code does not work
43 replies
DIAdiscord.js - Imagine an app
Created by Serqeevich on 1/14/2025 in #djs-questions
How to properly use "fetchReply" in Discord.js Interaction API?
it's without fetchREply
43 replies
DIAdiscord.js - Imagine an app
Created by Serqeevich on 1/14/2025 in #djs-questions
How to properly use "fetchReply" in Discord.js Interaction API?
sorry
43 replies
DIAdiscord.js - Imagine an app
Created by Serqeevich on 1/14/2025 in #djs-questions
How to properly use "fetchReply" in Discord.js Interaction API?
stop
43 replies
DIAdiscord.js - Imagine an app
Created by Serqeevich on 1/14/2025 in #djs-questions
How to properly use "fetchReply" in Discord.js Interaction API?
No description
43 replies
DIAdiscord.js - Imagine an app
Created by Serqeevich on 1/14/2025 in #djs-questions
How to properly use "fetchReply" in Discord.js Interaction API?
nothing
43 replies
DIAdiscord.js - Imagine an app
Created by Serqeevich on 1/14/2025 in #djs-questions
How to properly use "fetchReply" in Discord.js Interaction API?
if i change withResponse on fetchReply - i see id in console
43 replies
DIAdiscord.js - Imagine an app
Created by Serqeevich on 1/14/2025 in #djs-questions
How to properly use "fetchReply" in Discord.js Interaction API?
if i use withResponse: true - my collector doesn't work
43 replies
DIAdiscord.js - Imagine an app
Created by Serqeevich on 1/14/2025 in #djs-questions
How to properly use "fetchReply" in Discord.js Interaction API?
const response = await interaction.reply({
components: [row],
flags: MessageFlags.Ephemeral,
withResponse: true,
})

const collector = response.createMessageComponentCollector({
componentType: ComponentType.StringSelect,
time: 60_000,
filter: (i: AnySelectMenuInteraction) => i.user.id === interaction.user.id && i.customId === selectMenu.data.custom_id,
})


collector.on(`collect`, async (i: AnySelectMenuInteraction) => {

const memberIds = i.values;

for (const memberId of memberIds) {

console.log(memberId);

};

});
const response = await interaction.reply({
components: [row],
flags: MessageFlags.Ephemeral,
withResponse: true,
})

const collector = response.createMessageComponentCollector({
componentType: ComponentType.StringSelect,
time: 60_000,
filter: (i: AnySelectMenuInteraction) => i.user.id === interaction.user.id && i.customId === selectMenu.data.custom_id,
})


collector.on(`collect`, async (i: AnySelectMenuInteraction) => {

const memberIds = i.values;

for (const memberId of memberIds) {

console.log(memberId);

};

});
43 replies
DIAdiscord.js - Imagine an app
Created by Serqeevich on 1/14/2025 in #djs-questions
How to properly use "fetchReply" in Discord.js Interaction API?
No description
43 replies
DIAdiscord.js - Imagine an app
Created by Serqeevich on 1/14/2025 in #djs-questions
How to properly use "fetchReply" in Discord.js Interaction API?
have
43 replies
DIAdiscord.js - Imagine an app
Created by Serqeevich on 1/14/2025 in #djs-questions
How to properly use "fetchReply" in Discord.js Interaction API?
import { ActionRowBuilder, AnySelectMenuInteraction, ButtonInteraction, ComponentType, MessageFlags, PermissionFlagsBits, StringSelectMenuBuilder, StringSelectMenuOptionBuilder } from "discord.js";
import CustomClient from "../../../base/classes/Client";
import { ButtonIds } from "../../../base/enums/buttonsIds.enum";
import IComponent from "../../../base/interfaces/component.interface";
import { Emojis } from "../../../base/enums/emojis.enum";

export default class Kick implements IComponent {

client: CustomClient;

constructor(client: CustomClient) {
this.client = client;
}

id = ButtonIds.Kick;

async execute(interaction: ButtonInteraction, client: CustomClient) {

const validation = await client.voiceMasterHelper.validation(interaction, this.id);

if (!validation.success) {

if (validation.message) {

interaction.reply({
content: validation.message,
flags: MessageFlags.Ephemeral
});

};

return;

};

const data = validation.data;
const channel = validation.channel!;
const membersSize = channel?.members.size;

const options: StringSelectMenuOptionBuilder[] = channel.members
.filter((m) => m.id !== data?.owner_id)
.filter((m) => !m.permissions.has(PermissionFlagsBits.Administrator || PermissionFlagsBits.ModerateMembers))
.map((m) => {
return new StringSelectMenuOptionBuilder()
.setLabel(`${m.user.username}`)
.setValue(`${m.user.id}`)
});


if (options.length === 0) {

await interaction.reply({
content: `<:warn:${Emojis.Warn}> _Вам некого исключать из канала._`,
flags: MessageFlags.Ephemeral
});

return

};

const selectMenu = new StringSelectMenuBuilder()
.setCustomId(`kick_members`)
.setMinValues(1)
.setMaxValues(membersSize - 1)
.setOptions(options)


const row = new ActionRowBuilder<StringSelectMenuBuilder>()
.setComponents(selectMenu)

const response = await interaction.reply({
components: [row],
flags: MessageFlags.Ephemeral,
// withResponse: true,
})

const collector = response.createMessageComponentCollector({
componentType: ComponentType.StringSelect,
time: 60_000,
filter: (i: AnySelectMenuInteraction) => i.user.id === interaction.user.id && i.customId === selectMenu.data.custom_id,
})


collector.on(`collect`, async (i: AnySelectMenuInteraction) => {

const memberIds = i.values;

for (const memberId of memberIds) {

console.log(memberId);

};

});


};

};
import { ActionRowBuilder, AnySelectMenuInteraction, ButtonInteraction, ComponentType, MessageFlags, PermissionFlagsBits, StringSelectMenuBuilder, StringSelectMenuOptionBuilder } from "discord.js";
import CustomClient from "../../../base/classes/Client";
import { ButtonIds } from "../../../base/enums/buttonsIds.enum";
import IComponent from "../../../base/interfaces/component.interface";
import { Emojis } from "../../../base/enums/emojis.enum";

export default class Kick implements IComponent {

client: CustomClient;

constructor(client: CustomClient) {
this.client = client;
}

id = ButtonIds.Kick;

async execute(interaction: ButtonInteraction, client: CustomClient) {

const validation = await client.voiceMasterHelper.validation(interaction, this.id);

if (!validation.success) {

if (validation.message) {

interaction.reply({
content: validation.message,
flags: MessageFlags.Ephemeral
});

};

return;

};

const data = validation.data;
const channel = validation.channel!;
const membersSize = channel?.members.size;

const options: StringSelectMenuOptionBuilder[] = channel.members
.filter((m) => m.id !== data?.owner_id)
.filter((m) => !m.permissions.has(PermissionFlagsBits.Administrator || PermissionFlagsBits.ModerateMembers))
.map((m) => {
return new StringSelectMenuOptionBuilder()
.setLabel(`${m.user.username}`)
.setValue(`${m.user.id}`)
});


if (options.length === 0) {

await interaction.reply({
content: `<:warn:${Emojis.Warn}> _Вам некого исключать из канала._`,
flags: MessageFlags.Ephemeral
});

return

};

const selectMenu = new StringSelectMenuBuilder()
.setCustomId(`kick_members`)
.setMinValues(1)
.setMaxValues(membersSize - 1)
.setOptions(options)


const row = new ActionRowBuilder<StringSelectMenuBuilder>()
.setComponents(selectMenu)

const response = await interaction.reply({
components: [row],
flags: MessageFlags.Ephemeral,
// withResponse: true,
})

const collector = response.createMessageComponentCollector({
componentType: ComponentType.StringSelect,
time: 60_000,
filter: (i: AnySelectMenuInteraction) => i.user.id === interaction.user.id && i.customId === selectMenu.data.custom_id,
})


collector.on(`collect`, async (i: AnySelectMenuInteraction) => {

const memberIds = i.values;

for (const memberId of memberIds) {

console.log(memberId);

};

});


};

};
43 replies
DIAdiscord.js - Imagine an app
Created by Serqeevich on 1/14/2025 in #djs-questions
How to properly use "fetchReply" in Discord.js Interaction API?
sure
43 replies