Skip to content

Commit

Permalink
Undo page lengths and add safety net
Browse files Browse the repository at this point in the history
  • Loading branch information
PapiOphidian committed Oct 16, 2023
1 parent 772cd0a commit 5f985c7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion packages/runtime-website/src/music/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -331,12 +331,13 @@ const common = {
}

function trackSelection<T>(cmd: ChatInputCommand, lang: import("@amanda/lang").Lang, trackss: Array<T>, label: (item: T) => string): Promise<T | null> {
if (trackss.length === 0) return Promise.resolve(null)
const component = new buttons.BetterComponent({
type: 3,
placeholder: lang.GLOBAL.HEADER_SONG_SELECTION,
min_values: 1,
max_values: 1,
options: trackss.slice(0, 23).map((s, index) => ({ label: label(s).slice(0, 98), value: String(index), description: `Track ${index + 1}`, default: false }))
options: trackss.slice(0, 24).map((s, index) => ({ label: label(s).slice(0, 98), value: String(index), description: `Track ${index + 1}`, default: false }))
} as import("discord-api-types/v10").APISelectMenuComponent, {})

return new Promise(res => {
Expand Down
2 changes: 1 addition & 1 deletion packages/shared-utils/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,7 @@ export function paginate(pageCount: number, callback: (page: number, component:
let page = 0
if (pageCount > 1) {
let menuExpires: NodeJS.Timeout
const options = Array(Math.min(pageCount, 24)).fill(null).map((_, i) => ({ label: `Page ${i + 1}`, value: String(i), default: false }))
const options = Array(Math.min(pageCount, 25)).fill(null).map((_, i) => ({ label: `Page ${i + 1}`, value: String(i), default: false }))
const component = new buttons.BetterComponent({
type: 3,
placeholder: "Select page",
Expand Down

0 comments on commit 5f985c7

Please sign in to comment.