Skip to content

Commit 8c3cd7b

Browse files
committed
Fix long guide names preventing Discord autocomplete from working
1 parent 17ad0ff commit 8c3cd7b

File tree

13 files changed

+41
-35
lines changed

13 files changed

+41
-35
lines changed

src/commands/artifacts/artifact.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import config from "../../data/config.json"
44
import client from "../../main"
55
import Command from "../../utils/Command"
66
import { Artifact, CommandSource, SendMessage } from "../../utils/Types"
7-
import { Colors, createTable, findFuzzyBestCandidates, getLink, getLinkToGuide, sendMessage, simplePaginator, urlify } from "../../utils/Utils"
7+
import { Colors, createTable, findFuzzyBestCandidatesForAutocomplete, getLink, getLinkToGuide, sendMessage, simplePaginator, urlify } from "../../utils/Utils"
88

99
export default class ArtifactCommand extends Command {
1010
constructor(name: string) {
@@ -39,7 +39,7 @@ Note: this command supports fuzzy search.`,
3939
])
4040
}
4141

42-
await source.respond(findFuzzyBestCandidates(targetNames, search, 20).map(value => {
42+
await source.respond(findFuzzyBestCandidatesForAutocomplete(targetNames, search, 20).map(value => {
4343
return { name: value, value }
4444
}))
4545
}

src/commands/characters/character.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import config from "../../data/config.json"
33
import client from "../../main"
44
import Command from "../../utils/Command"
55
import { BotEmoji, Character, CharacterFull, CommandSource, SendMessage, Skill, TalentTable, TalentValue } from "../../utils/Types"
6-
import { addArg, Bookmarkable, Colors, createTable, findFuzzyBestCandidates, getLink, getLinkToGuide, PAD_END, PAD_START, paginator, sendMessage, simplePaginator, urlify } from "../../utils/Utils"
6+
import { addArg, Bookmarkable, Colors, createTable, findFuzzyBestCandidatesForAutocomplete, getLink, getLinkToGuide, PAD_END, PAD_START, paginator, sendMessage, simplePaginator, urlify } from "../../utils/Utils"
77

88

99
const elementTypes = client.data.getCharacters()
@@ -76,13 +76,13 @@ Note: this command supports fuzzy search.`,
7676
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
7777
targets = [...elementTypes.filter(elem => this.getElementIcons(client.data.getCharacterByName("Traveler")!).includes(elem)).map(x => `-${x.toLowerCase()}`), ...targets]
7878

79-
return await source.respond(findFuzzyBestCandidates(targets, lastWord, 20).map(value => {
79+
return await source.respond(findFuzzyBestCandidatesForAutocomplete(targets, lastWord, 20).map(value => {
8080
value = `${args.join(" ")} ${value}`
8181
return { name: value, value }
8282
}))
8383
}
8484

85-
await source.respond(findFuzzyBestCandidates(targetNames, search, 20).map(value => {
85+
await source.respond(findFuzzyBestCandidatesForAutocomplete(targetNames, search, 20).map(value => {
8686
return { name: value, value }
8787
}))
8888
}

src/commands/characters/charstats.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import config from "../../data/config.json"
44
import client from "../../main"
55
import Command from "../../utils/Command"
66
import { CharacterFull, CommandSource, SendMessage } from "../../utils/Types"
7-
import { createTable, findFuzzyBestCandidates, PAD_START, sendMessage } from "../../utils/Utils"
7+
import { createTable, findFuzzyBestCandidatesForAutocomplete, PAD_START, sendMessage } from "../../utils/Utils"
88

99
export default class CharacterStatsCommand extends Command {
1010
constructor(name: string) {
@@ -43,7 +43,7 @@ Note: this command supports fuzzy search.`,
4343
const targetNames = client.data.getReleasedCharacters().map(c => c.name)
4444
const search = source.options.getFocused().toString()
4545

46-
await source.respond(findFuzzyBestCandidates(targetNames, search, 20).map(value => {
46+
await source.respond(findFuzzyBestCandidatesForAutocomplete(targetNames, search, 20).map(value => {
4747
return { name: value, value }
4848
}))
4949
}

src/commands/meta/help.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import config from "../../data/config.json"
33
import client from "../../main"
44
import Command, { CommandCategory } from "../../utils/Command"
55
import { CommandSource, SendMessage } from "../../utils/Types"
6-
import { findFuzzyBestCandidates, getUserID, sendMessage } from "../../utils/Utils"
6+
import { findFuzzyBestCandidatesForAutocomplete, getUserID, sendMessage } from "../../utils/Utils"
77

88
const requiredPermissions: PermissionResolvable[] = [
99
PermissionFlagsBits.AttachFiles,
@@ -41,7 +41,7 @@ export default class Help extends Command {
4141
])
4242
}
4343

44-
await source.respond(findFuzzyBestCandidates(targetNames, search, 20).map(value => {
44+
await source.respond(findFuzzyBestCandidatesForAutocomplete(targetNames, search, 20).map(value => {
4545
return { name: value, value }
4646
}))
4747
}

src/commands/misc/abyss.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import config from "../../data/config.json"
44
import client from "../../main"
55
import Command from "../../utils/Command"
66
import { AbyssSchedule, CommandSource, SendMessage } from "../../utils/Types"
7-
import { Colors, findFuzzyBestCandidates, getDate, sendMessage, simplePaginator } from "../../utils/Utils"
7+
import { Colors, findFuzzyBestCandidatesForAutocomplete, getDate, sendMessage, simplePaginator } from "../../utils/Utils"
88

99
const names: Record<string, string> = {
1010
"1/1": "Enemies",
@@ -42,7 +42,7 @@ Old abyss floors/buffs can be accessed by giving the cycle (like \`${config.pref
4242
const targetNames = client.data.getAbyssSchedules().map(s => s.start.substring(0, 7)).flatMap((s, i, arr) => `${s}-${i - arr.indexOf(s) + 1}`).reverse()
4343
const search = source.options.getFocused().toString()
4444

45-
await source.respond(findFuzzyBestCandidates(targetNames, search, 20).map(value => {
45+
await source.respond(findFuzzyBestCandidatesForAutocomplete(targetNames, search, 20).map(value => {
4646
return { name: value, value }
4747
}))
4848
}
@@ -108,7 +108,7 @@ Old abyss floors/buffs can be accessed by giving the cycle (like \`${config.pref
108108
embed.setTitle(`Spiral Abyss: ${abyss.buff}`)
109109
.setDescription(abyss.buffDesc)
110110
.addFields(
111-
{ name: "Starts", value: abyss.start, inline: true },
111+
{ name: "Starts", value: abyss.start, inline: true },
112112
{ name: "Ends", value: abyss.end, inline: true }
113113
)
114114
return embed

src/commands/misc/banners.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import config from "../../data/config.json"
44
import client from "../../main"
55
import Command from "../../utils/Command"
66
import { CommandSource, SendMessage, StoredNews } from "../../utils/Types"
7-
import { Colors, findFuzzy, findFuzzyBestCandidates, getLink, parseNewsContent, sendMessage, simplePaginator } from "../../utils/Utils"
7+
import { Colors, findFuzzy, findFuzzyBestCandidatesForAutocomplete, getLink, parseNewsContent, sendMessage, simplePaginator } from "../../utils/Utils"
88

99

1010
const Logger = log4js.getLogger("main")
@@ -229,7 +229,7 @@ Note: this command supports fuzzy search.`,
229229
const targetNames = eventWishes.flatMap(w => [...w.other, ...w.main]).filter((v, i, arr) => arr.indexOf(v) == i)
230230
const search = source.options.getFocused().toString()
231231

232-
await source.respond(findFuzzyBestCandidates(targetNames, search, 20).map(value => {
232+
await source.respond(findFuzzyBestCandidatesForAutocomplete(targetNames, search, 20).map(value => {
233233
return { name: value, value }
234234
}))
235235
}

src/commands/misc/enemy.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import config from "../../data/config.json"
33
import client from "../../main"
44
import Command from "../../utils/Command"
55
import { CommandSource, Enemy, SendMessage } from "../../utils/Types"
6-
import { Bookmarkable, Colors, createTable, findFuzzyBestCandidates, getLink, getLinkToGuide, PAD_END, PAD_START, paginator, sendMessage, simplePaginator, urlify } from "../../utils/Utils"
6+
import { Bookmarkable, Colors, createTable, findFuzzyBestCandidatesForAutocomplete, getLink, getLinkToGuide, PAD_END, PAD_START, paginator, sendMessage, simplePaginator, urlify } from "../../utils/Utils"
77

88
export default class EnemyCommand extends Command {
99
constructor(name: string) {
@@ -38,7 +38,7 @@ Note: this command supports fuzzy search.`,
3838
])
3939
}
4040

41-
await source.respond(findFuzzyBestCandidates(targetNames, search, 20).map(value => {
41+
await source.respond(findFuzzyBestCandidatesForAutocomplete(targetNames, search, 20).map(value => {
4242
return { name: value, value }
4343
}))
4444
}

src/commands/misc/guide.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import config from "../../data/config.json"
33
import client from "../../main"
44
import Command from "../../utils/Command"
55
import { CommandSource, Guide, SendMessage } from "../../utils/Types"
6-
import { Colors, findFuzzy, findFuzzyBestCandidates, getLink, sendMessage, simplePaginator, urlify } from "../../utils/Utils"
6+
import { Colors, findFuzzy, findFuzzyBestCandidatesForAutocomplete, getLink, sendMessage, simplePaginator, urlify } from "../../utils/Utils"
77

88

99
export default class GuideCommand extends Command {
@@ -41,7 +41,7 @@ Note: this command supports fuzzy search.`,
4141
])
4242
}
4343

44-
await source.respond(findFuzzyBestCandidates(this.targetNames, search, 20).map(value => {
44+
await source.respond(findFuzzyBestCandidatesForAutocomplete(this.targetNames, search, 20).map(value => {
4545
return { name: value, value }
4646
}))
4747
}

src/commands/misc/material.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import config from "../../data/config.json"
33
import client from "../../main"
44
import Command from "../../utils/Command"
55
import { Character, CommandSource, Material, SendMessage, Weapon } from "../../utils/Types"
6-
import { Bookmarkable, Colors, findFuzzyBestCandidates, getLink, getLinkToGuide, joinMulti, paginator, sendMessage, simplePaginator, urlify } from "../../utils/Utils"
6+
import { Bookmarkable, Colors, findFuzzyBestCandidatesForAutocomplete, getLink, getLinkToGuide, joinMulti, paginator, sendMessage, simplePaginator, urlify } from "../../utils/Utils"
77

88
export default class MaterialCommand extends Command {
99
constructor(name: string) {
@@ -38,7 +38,7 @@ Note: this command supports fuzzy search.`,
3838
])
3939
}
4040

41-
await source.respond(findFuzzyBestCandidates(targetNames, search, 20).map(value => {
41+
await source.respond(findFuzzyBestCandidatesForAutocomplete(targetNames, search, 20).map(value => {
4242
return { name: value, value }
4343
}))
4444
}

src/commands/news/news.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import config from "../../data/config.json"
44
import client from "../../main"
55
import Command from "../../utils/Command"
66
import { CommandSource, NewsLang, SendMessage } from "../../utils/Types"
7-
import { Colors, findFuzzy, findFuzzyBestCandidates, getNewsEmbed, parseNewsContent, sendMessage, simplePaginator } from "../../utils/Utils"
7+
import { Colors, findFuzzy, findFuzzyBestCandidatesForAutocomplete, getNewsEmbed, parseNewsContent, sendMessage, simplePaginator } from "../../utils/Utils"
88

99
export default class News extends Command {
1010
constructor(name: string) {
@@ -44,7 +44,7 @@ Supported languages: ${client.newsManager.getLanguages().map(l => `\`${l}\``).jo
4444
])
4545
}
4646

47-
await source.respond(findFuzzyBestCandidates(targetNames, search, 20).map(value => {
47+
await source.respond(findFuzzyBestCandidatesForAutocomplete(targetNames, search, 20).map(value => {
4848
return { name: value, value }
4949
}))
5050
}

0 commit comments

Comments
 (0)