diff --git a/src/commands/nowplaying.ts b/src/commands/nowplaying.ts index c9765f5..7bb36c2 100644 --- a/src/commands/nowplaying.ts +++ b/src/commands/nowplaying.ts @@ -10,7 +10,7 @@ import { SlashCommandBuilder } from "discord.js"; -import {getSongOnPreferredProvider} from "../helper.ts" +import {getSongOnPreferredProvider, kyzaify} from "../helper.ts" import {Config} from "../config.ts"; function keepV(url: string): string { @@ -70,7 +70,7 @@ export default class PingCommand extends Command { currentRow.addComponents( new ButtonBuilder() .setURL(songlink.linksByPlatform[meowi].url) - .setLabel(meowi) + .setLabel(kyzaify(meowi)) .setStyle(ButtonStyle.Link) ); } diff --git a/src/helper.ts b/src/helper.ts index 5f5799d..509f4aa 100644 --- a/src/helper.ts +++ b/src/helper.ts @@ -56,3 +56,32 @@ export function getSongOnPreferredProvider(json: any, link: string): Song | null } return null } + + +export function kyzaify(input: string): string { + //im gonna write this as shittily as possible just because. + if (input === "youtube") { + return "YouTube"; + } else if (input === "youtubeMusic") { + return "YouTube Music"; + } else if (input === "itunes") { + return "iTunes"; + } else if (input === "soundcloud") { + return "SoundCloud"; + } + if (input.length === 0) return input; + + let result = input.charAt(0).toUpperCase(); + + for (let i = 1; i < input.length; i++) { + const char = input.charAt(i); + + if (char === char.toUpperCase()) { + result += ' ' + char; + } else { + result += char; + } + } + + return result; +}