SelectMenu -> StringSelectMenu

This commit is contained in:
Isaac 2023-01-02 12:23:14 +00:00
parent 5c2eed2d7b
commit a10a1663a3
No known key found for this signature in database
GPG Key ID: 0DE40AE37BBA5C33
4 changed files with 20 additions and 19 deletions

View File

@ -7,8 +7,8 @@ const {
ButtonStyle, ButtonStyle,
inlineCode, inlineCode,
ModalBuilder, ModalBuilder,
SelectMenuBuilder, StringSelectMenuBuilder,
SelectMenuOptionBuilder, StringSelectMenuOptionBuilder,
TextInputBuilder, TextInputBuilder,
TextInputStyle, TextInputStyle,
} = require('discord.js'); } = require('discord.js');
@ -16,8 +16,9 @@ const emoji = require('node-emoji');
const ms = require('ms'); const ms = require('ms');
const ExtendedEmbedBuilder = require('../embed'); const ExtendedEmbedBuilder = require('../embed');
const { logTicketEvent } = require('../logging'); const { logTicketEvent } = require('../logging');
const { Collection } = require('discord.js');
const Cryptr = require('cryptr'); const Cryptr = require('cryptr');
const cryptr = new Cryptr(process.env.ENCRYPTION_KEY); const { encrypt } = new Cryptr(process.env.ENCRYPTION_KEY);
/** /**
* @typedef {import('@prisma/client').Category & * @typedef {import('@prisma/client').Category &
@ -241,14 +242,14 @@ module.exports = class TicketManager {
} else if (q.type === 'MENU') { } else if (q.type === 'MENU') {
return new ActionRowBuilder() return new ActionRowBuilder()
.setComponents( .setComponents(
new SelectMenuBuilder() new StringSelectMenuBuilder()
.setCustomId(q.id) .setCustomId(q.id)
.setPlaceholder(q.placeholder || q.label) .setPlaceholder(q.placeholder || q.label)
.setMaxValues(q.maxLength) .setMaxValues(q.maxLength)
.setMinValues(q.minLength) .setMinValues(q.minLength)
.setOptions( .setOptions(
q.options.map((o, i) => { q.options.map((o, i) => {
const builder = new SelectMenuOptionBuilder() const builder = new StringSelectMenuOptionBuilder()
.setValue(String(i)) .setValue(String(i))
.setLabel(o.label); .setLabel(o.label);
if (o.description) builder.setDescription(o.description); if (o.description) builder.setDescription(o.description);

View File

@ -1,8 +1,8 @@
const { const {
ActionRowBuilder, ActionRowBuilder,
EmbedBuilder, EmbedBuilder,
SelectMenuBuilder, StringSelectMenuBuilder,
SelectMenuOptionBuilder, StringSelectMenuOptionBuilder,
} = require('discord.js'); } = require('discord.js');
const emoji = require('node-emoji'); const emoji = require('node-emoji');
@ -50,7 +50,7 @@ module.exports = {
components: [ components: [
new ActionRowBuilder() new ActionRowBuilder()
.setComponents( .setComponents(
new SelectMenuBuilder() new StringSelectMenuBuilder()
.setCustomId(JSON.stringify({ .setCustomId(JSON.stringify({
action: 'create', action: 'create',
referencesMessage, referencesMessage,
@ -60,7 +60,7 @@ module.exports = {
.setPlaceholder(getMessage('menus.category.placeholder')) .setPlaceholder(getMessage('menus.category.placeholder'))
.setOptions( .setOptions(
settings.categories.map(category => settings.categories.map(category =>
new SelectMenuOptionBuilder() new StringSelectMenuOptionBuilder()
.setValue(String(category.id)) .setValue(String(category.id))
.setLabel(category.name) .setLabel(category.name)
.setDescription(category.description) .setDescription(category.description)

View File

@ -6,8 +6,8 @@ const {
ChannelType, ChannelType,
ComponentType, ComponentType,
EmbedBuilder, EmbedBuilder,
SelectMenuBuilder, StringSelectMenuBuilder,
SelectMenuOptionBuilder, StringSelectMenuOptionBuilder,
} = require('discord.js'); } = require('discord.js');
const { const {
getCommonGuilds, getCommonGuilds,
@ -52,7 +52,7 @@ module.exports = class extends Listener {
components: [ components: [
new ActionRowBuilder() new ActionRowBuilder()
.setComponents( .setComponents(
new SelectMenuBuilder() new StringSelectMenuBuilder()
.setCustomId(JSON.stringify({ .setCustomId(JSON.stringify({
action: 'create', action: 'create',
topic, topic,
@ -60,7 +60,7 @@ module.exports = class extends Listener {
.setPlaceholder(getMessage('menus.category.placeholder')) .setPlaceholder(getMessage('menus.category.placeholder'))
.setOptions( .setOptions(
settings.categories.map(category => settings.categories.map(category =>
new SelectMenuOptionBuilder() new StringSelectMenuOptionBuilder()
.setValue(String(category.id)) .setValue(String(category.id))
.setLabel(category.name) .setLabel(category.name)
.setDescription(category.description) .setDescription(category.description)
@ -143,12 +143,12 @@ module.exports = class extends Listener {
components: [ components: [
new ActionRowBuilder() new ActionRowBuilder()
.setComponents( .setComponents(
new SelectMenuBuilder() new StringSelectMenuBuilder()
.setCustomId(message.id) .setCustomId(message.id)
.setPlaceholder(getMessage('menus.guild.placeholder')) .setPlaceholder(getMessage('menus.guild.placeholder'))
.setOptions( .setOptions(
commonGuilds.map(g => commonGuilds.map(g =>
new SelectMenuOptionBuilder() new StringSelectMenuOptionBuilder()
.setValue(String(g.id)) .setValue(String(g.id))
.setLabel(g.name), .setLabel(g.name),
), ),

View File

@ -7,8 +7,8 @@ const {
}, },
ChannelType: { GuildText }, ChannelType: { GuildText },
EmbedBuilder, EmbedBuilder,
SelectMenuBuilder, StringSelectMenuBuilder,
SelectMenuOptionBuilder, StringSelectMenuOptionBuilder,
} = require('discord.js'); } = require('discord.js');
const emoji = require('node-emoji'); const emoji = require('node-emoji');
const { logAdminEvent } = require('../../../../../lib/logging'); const { logAdminEvent } = require('../../../../../lib/logging');
@ -102,12 +102,12 @@ module.exports.post = fastify => ({
); );
} else { } else {
components.push( components.push(
new SelectMenuBuilder() new StringSelectMenuBuilder()
.setCustomId(JSON.stringify({ action: 'create' })) .setCustomId(JSON.stringify({ action: 'create' }))
.setPlaceholder(getMessage('menus.category.placeholder')) .setPlaceholder(getMessage('menus.category.placeholder'))
.setOptions( .setOptions(
categories.map(category => categories.map(category =>
new SelectMenuOptionBuilder() new StringSelectMenuOptionBuilder()
.setValue(String(category.id)) .setValue(String(category.id))
.setLabel(category.name) .setLabel(category.name)
.setDescription(category.description) .setDescription(category.description)