test
This commit is contained in:
parent
f157a2caf3
commit
4cd60119d5
11
index.js
11
index.js
@ -52,15 +52,13 @@ client.once('clientReady', async () => {
|
|||||||
|
|
||||||
deploy(process.env.DISCORD_TOKEN);
|
deploy(process.env.DISCORD_TOKEN);
|
||||||
clean(client);
|
clean(client);
|
||||||
await update(client);
|
await update(client);
|
||||||
});
|
});
|
||||||
|
|
||||||
client.on(Events.InteractionCreate, async interaction => {
|
client.on(Events.InteractionCreate, async interaction => {
|
||||||
if (interaction.isStringSelectMenu() || interaction.isButton()) {
|
if (interaction.isStringSelectMenu()) {
|
||||||
const handled = await handlePinboardSelection(interaction);
|
await handlePinboardSelection(interaction);
|
||||||
if (handled) {
|
return;
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!interaction.isChatInputCommand()) return;
|
if (!interaction.isChatInputCommand()) return;
|
||||||
@ -97,5 +95,4 @@ client.on(Events.InteractionCreate, async interaction => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
client.login(process.env.DISCORD_TOKEN);
|
client.login(process.env.DISCORD_TOKEN);
|
||||||
|
|
||||||
setInterval(() => { update(client); }, 120000);
|
setInterval(() => { update(client); }, 120000);
|
||||||
@ -6,8 +6,6 @@ const PINBOARD_SELECT_CUSTOM_ID = 'pinboard-image-select';
|
|||||||
const PINBOARD_PREV_CUSTOM_ID = 'pinboard-image-prev';
|
const PINBOARD_PREV_CUSTOM_ID = 'pinboard-image-prev';
|
||||||
const PINBOARD_NEXT_CUSTOM_ID = 'pinboard-image-next';
|
const PINBOARD_NEXT_CUSTOM_ID = 'pinboard-image-next';
|
||||||
const PINBOARD_INDEX_CUSTOM_ID = 'pinboard-image-index';
|
const PINBOARD_INDEX_CUSTOM_ID = 'pinboard-image-index';
|
||||||
const PINBOARD_SPACER_LEFT_CUSTOM_ID = 'pinboard-image-spacer-left';
|
|
||||||
const PINBOARD_SPACER_RIGHT_CUSTOM_ID = 'pinboard-image-spacer-right';
|
|
||||||
const selectedImageIndexByMessage = new Map();
|
const selectedImageIndexByMessage = new Map();
|
||||||
const preloadedImagesByUrl = new Map();
|
const preloadedImagesByUrl = new Map();
|
||||||
const warmedMessageIds = new Set();
|
const warmedMessageIds = new Set();
|
||||||
@ -241,7 +239,7 @@ const buildImageSelectorRow = (items, selectedIndex) => {
|
|||||||
|
|
||||||
const selectMenu = new StringSelectMenuBuilder()
|
const selectMenu = new StringSelectMenuBuilder()
|
||||||
.setCustomId(PINBOARD_SELECT_CUSTOM_ID)
|
.setCustomId(PINBOARD_SELECT_CUSTOM_ID)
|
||||||
.setPlaceholder('Image')
|
.setPlaceholder('Choisis une image')
|
||||||
.addOptions(options);
|
.addOptions(options);
|
||||||
|
|
||||||
return new ActionRowBuilder().addComponents(selectMenu);
|
return new ActionRowBuilder().addComponents(selectMenu);
|
||||||
@ -253,7 +251,7 @@ const buildImageNavigationRow = (items, selectedIndex) => {
|
|||||||
|
|
||||||
const previousButton = new ButtonBuilder()
|
const previousButton = new ButtonBuilder()
|
||||||
.setCustomId(PINBOARD_PREV_CUSTOM_ID)
|
.setCustomId(PINBOARD_PREV_CUSTOM_ID)
|
||||||
.setLabel('<<')
|
.setLabel(' << ')
|
||||||
.setStyle(ButtonStyle.Primary)
|
.setStyle(ButtonStyle.Primary)
|
||||||
.setDisabled(!hasItems);
|
.setDisabled(!hasItems);
|
||||||
|
|
||||||
@ -265,23 +263,11 @@ const buildImageNavigationRow = (items, selectedIndex) => {
|
|||||||
|
|
||||||
const nextButton = new ButtonBuilder()
|
const nextButton = new ButtonBuilder()
|
||||||
.setCustomId(PINBOARD_NEXT_CUSTOM_ID)
|
.setCustomId(PINBOARD_NEXT_CUSTOM_ID)
|
||||||
.setLabel('>>')
|
.setLabel(' >> ')
|
||||||
.setStyle(ButtonStyle.Primary)
|
.setStyle(ButtonStyle.Primary)
|
||||||
.setDisabled(!hasItems);
|
.setDisabled(!hasItems);
|
||||||
|
|
||||||
const leftSpacer = new ButtonBuilder()
|
return new ActionRowBuilder().addComponents(previousButton, indexButton, nextButton);
|
||||||
.setCustomId(PINBOARD_SPACER_LEFT_CUSTOM_ID)
|
|
||||||
.setLabel('-')
|
|
||||||
.setStyle(ButtonStyle.Secondary)
|
|
||||||
.setDisabled(true);
|
|
||||||
|
|
||||||
const rightSpacer = new ButtonBuilder()
|
|
||||||
.setCustomId(PINBOARD_SPACER_RIGHT_CUSTOM_ID)
|
|
||||||
.setLabel('-')
|
|
||||||
.setStyle(ButtonStyle.Secondary)
|
|
||||||
.setDisabled(true);
|
|
||||||
|
|
||||||
return new ActionRowBuilder().addComponents(leftSpacer, previousButton, indexButton, nextButton, rightSpacer);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const getMinecraftStatus = async () => {
|
const getMinecraftStatus = async () => {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user