mirror of
https://github.com/JonnyBro/JaBa.git
synced 2024-11-21 20:54:58 +05:00
?
This commit is contained in:
parent
19ed241e76
commit
358253a4e3
1 changed files with 5 additions and 3 deletions
|
@ -16,7 +16,8 @@ const { ButtonBuilder, ActionRowBuilder, ButtonStyle, ComponentType } = require(
|
||||||
* @returns {Promise<import("discord.js").User>}
|
* @returns {Promise<import("discord.js").User>}
|
||||||
*/
|
*/
|
||||||
async function tictactoe(interaction, options = {}) {
|
async function tictactoe(interaction, options = {}) {
|
||||||
return new Promise(resolve => {
|
// eslint-disable-next-line no-async-promise-executor
|
||||||
|
return new Promise(async resolve => {
|
||||||
try {
|
try {
|
||||||
const { client } = interaction;
|
const { client } = interaction;
|
||||||
let opponent;
|
let opponent;
|
||||||
|
@ -81,19 +82,20 @@ async function tictactoe(interaction, options = {}) {
|
||||||
const decline = new ButtonBuilder().setLabel(interaction.translate("common:DECLINE")).setStyle(ButtonStyle.Danger).setCustomId("declinettt");
|
const decline = new ButtonBuilder().setLabel(interaction.translate("common:DECLINE")).setStyle(ButtonStyle.Danger).setCustomId("declinettt");
|
||||||
const accep = new ActionRowBuilder().addComponents([accept, decline]);
|
const accep = new ActionRowBuilder().addComponents([accept, decline]);
|
||||||
|
|
||||||
const m = interaction.reply({
|
const m = await interaction.reply({
|
||||||
content: interaction.translate("fun/tictactoe:INVITE_USER", {
|
content: interaction.translate("fun/tictactoe:INVITE_USER", {
|
||||||
opponent: opponent.id,
|
opponent: opponent.id,
|
||||||
}),
|
}),
|
||||||
embeds: [acceptEmbed],
|
embeds: [acceptEmbed],
|
||||||
components: [accep],
|
components: [accep],
|
||||||
fetchReply: true,
|
fetchReply: true,
|
||||||
}).then(m => m);
|
});
|
||||||
|
|
||||||
const collector = m.createMessageComponentCollector({
|
const collector = m.createMessageComponentCollector({
|
||||||
componentType: ComponentType.Button,
|
componentType: ComponentType.Button,
|
||||||
time: 30 * 1000,
|
time: 30 * 1000,
|
||||||
});
|
});
|
||||||
|
|
||||||
collector.on("collect", async button => {
|
collector.on("collect", async button => {
|
||||||
if (button.user.id !== opponent.id)
|
if (button.user.id !== opponent.id)
|
||||||
return button.reply({
|
return button.reply({
|
||||||
|
|
Loading…
Reference in a new issue