fix: don't use default bad value, assert instead #166

Merged
Anri merged 1 commit from no-fallback into main 2024-09-17 11:36:24 +02:00
17 changed files with 97 additions and 109 deletions

View file

@ -124,9 +124,7 @@ export default {
const filename = getFilename(__filename); const filename = getFilename(__filename);
return new SlashCommandBuilder() return new SlashCommandBuilder()
.setName(filename.toLowerCase()) .setName(filename.toLowerCase())
.setDescription( .setDescription(client.locales.get(client.config.default_lang)!.get(`c_${filename}_desc`)!)
client.locales.get(client.config.default_lang)?.get(`c_${filename}_desc`) ?? ""
)
.setNameLocalizations(getLocalizations(client, `c_${filename}_name`, true)) .setNameLocalizations(getLocalizations(client, `c_${filename}_name`, true))
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_desc`)); .setDescriptionLocalizations(getLocalizations(client, `c_${filename}_desc`));
}, },

View file

@ -31,7 +31,7 @@ export default {
} }
// Get queue // Get queue
const queue = useQueue(interaction.guildId ?? ""); const queue = useQueue(interaction.guildId!);
const embed = new EmbedBuilder(); const embed = new EmbedBuilder();
const rows = []; const rows = [];

View file

@ -31,7 +31,7 @@ export default {
} }
// Get queue // Get queue
const queue = useQueue(interaction.guildId ?? ""); const queue = useQueue(interaction.guildId!);
const embed = new EmbedBuilder(); const embed = new EmbedBuilder();
const rows = []; const rows = [];

View file

@ -6,7 +6,7 @@ import { removeExtension } from "../utils/misc";
/** Load all the commands */ /** Load all the commands */
export default async (client: Client) => { export default async (client: Client) => {
const rest = new REST({ version: "10" }).setToken(client.token ?? ""); const rest = new REST({ version: "10" }).setToken(client.token!);
const command_categories = (await readdir(__dirname)).filter( const command_categories = (await readdir(__dirname)).filter(
(element) => !element.endsWith(".js") && !element.endsWith(".ts"), (element) => !element.endsWith(".js") && !element.endsWith(".ts"),

View file

@ -19,9 +19,7 @@ export default {
return ( return (
new SlashCommandBuilder() new SlashCommandBuilder()
.setName(filename.toLowerCase()) .setName(filename.toLowerCase())
.setDescription( .setDescription(client.locales.get(client.config.default_lang)!.get(`c_${filename}_desc`)!)
client.locales.get(client.config.default_lang)?.get(`c_${filename}_desc`) ?? "",
)
.setNameLocalizations(getLocalizations(client, `c_${filename}_name`, true)) .setNameLocalizations(getLocalizations(client, `c_${filename}_name`, true))
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_desc`)) .setDescriptionLocalizations(getLocalizations(client, `c_${filename}_desc`))
@ -29,10 +27,10 @@ export default {
.addStringOption((option) => .addStringOption((option) =>
option option
.setName( .setName(
client.locales.get(client.config.default_lang)?.get(`c_${filename}_opt1_name`) ?? "", client.locales.get(client.config.default_lang)!.get(`c_${filename}_opt1_name`)!,
) )
.setDescription( .setDescription(
client.locales.get(client.config.default_lang)?.get(`c_${filename}_opt1_desc`) ?? "", client.locales.get(client.config.default_lang)!.get(`c_${filename}_opt1_desc`)!,
) )
.setNameLocalizations(getLocalizations(client, `c_${filename}_opt1_name`, true)) .setNameLocalizations(getLocalizations(client, `c_${filename}_opt1_name`, true))
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_opt1_desc`)), .setDescriptionLocalizations(getLocalizations(client, `c_${filename}_opt1_desc`)),
@ -44,8 +42,8 @@ export default {
const loc = getLocale(client, interaction.locale); const loc = getLocale(client, interaction.locale);
const desiredCat = interaction.options.get( const desiredCat = interaction.options.get(
client.locales client.locales
.get(client.config.default_lang) .get(client.config.default_lang)!
?.get(`c_${getFilename(__filename)}_opt1_name`) ?? "", .get(`c_${getFilename(__filename)}_opt1_name`)!,
)?.value as string; )?.value as string;
// If a category isn't specified // If a category isn't specified

View file

@ -13,9 +13,7 @@ export default {
return ( return (
new SlashCommandBuilder() new SlashCommandBuilder()
.setName(filename.toLowerCase()) .setName(filename.toLowerCase())
.setDescription( .setDescription(client.locales.get(client.config.default_lang)!.get(`c_${filename}_desc`)!)
client.locales.get(client.config.default_lang)?.get(`c_${filename}_desc`) ?? "",
)
.setNameLocalizations(getLocalizations(client, `c_${filename}_name`, true)) .setNameLocalizations(getLocalizations(client, `c_${filename}_name`, true))
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_desc`)) .setDescriptionLocalizations(getLocalizations(client, `c_${filename}_desc`))
@ -23,10 +21,10 @@ export default {
.addStringOption((option) => .addStringOption((option) =>
option option
.setName( .setName(
client.locales.get(client.config.default_lang)?.get(`c_${filename}_opt1_name`) ?? "", client.locales.get(client.config.default_lang)!.get(`c_${filename}_opt1_name`)!,
) )
.setDescription( .setDescription(
client.locales.get(client.config.default_lang)?.get(`c_${filename}_opt1_desc`) ?? "", client.locales.get(client.config.default_lang)!.get(`c_${filename}_opt1_desc`)!,
) )
.setNameLocalizations(getLocalizations(client, `c_${filename}_opt1_name`, true)) .setNameLocalizations(getLocalizations(client, `c_${filename}_opt1_name`, true))
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_opt1_desc`)), .setDescriptionLocalizations(getLocalizations(client, `c_${filename}_opt1_desc`)),
@ -38,8 +36,8 @@ export default {
const loc = getLocale(client, interaction.locale); const loc = getLocale(client, interaction.locale);
const desired_command = interaction.options.getString( const desired_command = interaction.options.getString(
client.locales client.locales
.get(client.config.default_lang) .get(client.config.default_lang)!
?.get(`c_${getFilename(__filename)}_opt1_name`) ?? "", .get(`c_${getFilename(__filename)}_opt1_name`)!,
); );
// If a command isn't specified // If a command isn't specified

View file

@ -10,9 +10,7 @@ export default {
const filename = getFilename(__filename); const filename = getFilename(__filename);
return new SlashCommandBuilder() return new SlashCommandBuilder()
.setName(filename.toLowerCase()) .setName(filename.toLowerCase())
.setDescription( .setDescription(client.locales.get(client.config.default_lang)!.get(`c_${filename}_desc`)!)
client.locales.get(client.config.default_lang)?.get(`c_${filename}_desc`) ?? "",
)
.setNameLocalizations(getLocalizations(client, `c_${filename}_name`, true)) .setNameLocalizations(getLocalizations(client, `c_${filename}_name`, true))
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_desc`)); .setDescriptionLocalizations(getLocalizations(client, `c_${filename}_desc`));
}, },

View file

@ -12,9 +12,7 @@ export default {
return ( return (
new SlashCommandBuilder() new SlashCommandBuilder()
.setName(filename.toLowerCase()) .setName(filename.toLowerCase())
.setDescription( .setDescription(client.locales.get(client.config.default_lang)!.get(`c_${filename}_desc`)!)
client.locales.get(client.config.default_lang)?.get(`c_${filename}_desc`) ?? "",
)
.setNameLocalizations(getLocalizations(client, `c_${filename}_name`, true)) .setNameLocalizations(getLocalizations(client, `c_${filename}_name`, true))
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_desc`)) .setDescriptionLocalizations(getLocalizations(client, `c_${filename}_desc`))
@ -22,10 +20,10 @@ export default {
.addStringOption((option) => .addStringOption((option) =>
option option
.setName( .setName(
client.locales.get(client.config.default_lang)?.get(`c_${filename}_opt1_name`) ?? "", client.locales.get(client.config.default_lang)!.get(`c_${filename}_opt1_name`)!,
) )
.setDescription( .setDescription(
client.locales.get(client.config.default_lang)?.get(`c_${filename}_opt1_desc`) ?? "", client.locales.get(client.config.default_lang)!.get(`c_${filename}_opt1_desc`)!,
) )
.setNameLocalizations(getLocalizations(client, `c_${filename}_opt1_name`, true)) .setNameLocalizations(getLocalizations(client, `c_${filename}_opt1_name`, true))
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_opt1_desc`)), .setDescriptionLocalizations(getLocalizations(client, `c_${filename}_opt1_desc`)),
@ -37,8 +35,8 @@ export default {
const loc = getLocale(client, interaction.locale); const loc = getLocale(client, interaction.locale);
const desired_cat = interaction.options.get( const desired_cat = interaction.options.get(
client.locales client.locales
.get(client.config.default_lang) .get(client.config.default_lang)!
?.get(`c_${getFilename(__filename)}_opt1_name`) ?? "", .get(`c_${getFilename(__filename)}_opt1_name`)!,
)?.value as string; )?.value as string;
// If a category isn't specified // If a category isn't specified

View file

@ -35,23 +35,23 @@ export default {
new SlashCommandBuilder() new SlashCommandBuilder()
// Command // Command
.setName(filename.toLowerCase()) .setName(filename.toLowerCase())
.setDescription(loc_default.get(`c_${filename}_desc`) ?? "") .setDescription(loc_default.get(`c_${filename}_desc`)!)
.setNameLocalizations(getLocalizations(client, `c_${filename}_name`, true)) .setNameLocalizations(getLocalizations(client, `c_${filename}_name`, true))
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_desc`)) .setDescriptionLocalizations(getLocalizations(client, `c_${filename}_desc`))
// New reminder // New reminder
.addSubcommand((subcommand) => .addSubcommand((subcommand) =>
subcommand subcommand
.setName(loc_default.get(`c_${filename}_sub1_name`)?.toLowerCase() ?? "") .setName(loc_default.get(`c_${filename}_sub1_name`)!.toLowerCase())
.setDescription(loc_default.get(`c_${filename}_sub1_desc`) ?? "") .setDescription(loc_default.get(`c_${filename}_sub1_desc`)!)
.setNameLocalizations(getLocalizations(client, `c_${filename}_sub1_name`, true)) .setNameLocalizations(getLocalizations(client, `c_${filename}_sub1_name`, true))
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_sub1_desc`)) .setDescriptionLocalizations(getLocalizations(client, `c_${filename}_sub1_desc`))
// Specified Time // Specified Time
.addStringOption((option) => .addStringOption((option) =>
option option
.setName(loc_default.get(`c_${filename}_sub1_opt1_name`)?.toLowerCase() ?? "") .setName(loc_default.get(`c_${filename}_sub1_opt1_name`)!.toLowerCase())
.setDescription(loc_default.get(`c_${filename}_sub1_opt1_desc`) ?? "") .setDescription(loc_default.get(`c_${filename}_sub1_opt1_desc`)!)
.setNameLocalizations( .setNameLocalizations(
getLocalizations(client, `c_${filename}_sub1_opt1_name`, true), getLocalizations(client, `c_${filename}_sub1_opt1_name`, true),
) )
@ -63,8 +63,8 @@ export default {
// Specified message (not required) // Specified message (not required)
.addStringOption((option) => .addStringOption((option) =>
option option
.setName(loc_default.get(`c_${filename}_sub1_opt2_name`)?.toLowerCase() ?? "") .setName(loc_default.get(`c_${filename}_sub1_opt2_name`)!.toLowerCase())
.setDescription(loc_default.get(`c_${filename}_sub1_opt2_desc`) ?? "") .setDescription(loc_default.get(`c_${filename}_sub1_opt2_desc`)!)
.setNameLocalizations( .setNameLocalizations(
getLocalizations(client, `c_${filename}_sub1_opt2_name`, true), getLocalizations(client, `c_${filename}_sub1_opt2_name`, true),
) )
@ -77,16 +77,16 @@ export default {
// List reminders // List reminders
.addSubcommand((subcommand) => .addSubcommand((subcommand) =>
subcommand subcommand
.setName(loc_default.get(`c_${filename}_sub2_name`)?.toLowerCase() ?? "") .setName(loc_default.get(`c_${filename}_sub2_name`)!.toLowerCase())
.setDescription(loc_default.get(`c_${filename}_sub2_desc`) ?? "") .setDescription(loc_default.get(`c_${filename}_sub2_desc`)!)
.setNameLocalizations(getLocalizations(client, `c_${filename}_sub2_name`, true)) .setNameLocalizations(getLocalizations(client, `c_${filename}_sub2_name`, true))
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_sub2_desc`)) .setDescriptionLocalizations(getLocalizations(client, `c_${filename}_sub2_desc`))
// User // User
.addUserOption((option) => .addUserOption((option) =>
option option
.setName(loc_default.get(`c_${filename}_sub2_opt1_name`)?.toLowerCase() ?? "") .setName(loc_default.get(`c_${filename}_sub2_opt1_name`)!.toLowerCase())
.setDescription(loc_default.get(`c_${filename}_sub2_opt1_desc`) ?? "") .setDescription(loc_default.get(`c_${filename}_sub2_opt1_desc`)!)
.setNameLocalizations( .setNameLocalizations(
getLocalizations(client, `c_${filename}_sub2_opt1_name`, true), getLocalizations(client, `c_${filename}_sub2_opt1_name`, true),
) )
@ -98,8 +98,8 @@ export default {
// Page // Page
.addIntegerOption((option) => .addIntegerOption((option) =>
option option
.setName(loc_default.get(`c_${filename}_sub2_opt2_name`)?.toLowerCase() ?? "") .setName(loc_default.get(`c_${filename}_sub2_opt2_name`)!.toLowerCase())
.setDescription(loc_default.get(`c_${filename}_sub2_opt2_desc`) ?? "") .setDescription(loc_default.get(`c_${filename}_sub2_opt2_desc`)!)
.setNameLocalizations( .setNameLocalizations(
getLocalizations(client, `c_${filename}_sub2_opt2_name`, true), getLocalizations(client, `c_${filename}_sub2_opt2_name`, true),
) )
@ -112,16 +112,16 @@ export default {
// Delete a reminder // Delete a reminder
.addSubcommand((subcommand) => .addSubcommand((subcommand) =>
subcommand subcommand
.setName(loc_default.get(`c_${filename}_sub3_name`)?.toLowerCase() ?? "") .setName(loc_default.get(`c_${filename}_sub3_name`)!.toLowerCase())
.setDescription(loc_default.get(`c_${filename}_sub3_desc`) ?? "") .setDescription(loc_default.get(`c_${filename}_sub3_desc`)!)
.setNameLocalizations(getLocalizations(client, `c_${filename}_sub3_name`, true)) .setNameLocalizations(getLocalizations(client, `c_${filename}_sub3_name`, true))
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_sub3_desc`)) .setDescriptionLocalizations(getLocalizations(client, `c_${filename}_sub3_desc`))
// ID // ID
.addIntegerOption((option) => .addIntegerOption((option) =>
option option
.setName(loc_default.get(`c_${filename}_sub3_opt1_name`)?.toLowerCase() ?? "") .setName(loc_default.get(`c_${filename}_sub3_opt1_name`)!.toLowerCase())
.setDescription(loc_default.get(`c_${filename}_sub3_opt1_desc`) ?? "") .setDescription(loc_default.get(`c_${filename}_sub3_opt1_desc`)!)
.setNameLocalizations( .setNameLocalizations(
getLocalizations(client, `c_${filename}_sub3_opt1_name`, true), getLocalizations(client, `c_${filename}_sub3_opt1_name`, true),
) )
@ -142,7 +142,7 @@ export default {
const subcommand = interaction.options.getSubcommand(); const subcommand = interaction.options.getSubcommand();
switch (subcommand) { switch (subcommand) {
// New reminder // New reminder
case loc_default?.get(`c_${filename}_sub1_name`)?.toLowerCase() ?? "": { case loc_default?.get(`c_${filename}_sub1_name`)?.toLowerCase(): {
// If time is already renseigned // If time is already renseigned
const time = interaction.options.getString( const time = interaction.options.getString(
loc_default?.get(`c_${filename}_sub1_opt1_name`) as string, loc_default?.get(`c_${filename}_sub1_opt1_name`) as string,
@ -193,7 +193,7 @@ export default {
} }
} }
// List reminders // List reminders
case loc_default?.get(`c_${filename}_sub2_name`)?.toLowerCase() ?? "": { case loc_default?.get(`c_${filename}_sub2_name`)?.toLowerCase(): {
// Which user to show // Which user to show
let user = interaction.options.getUser( let user = interaction.options.getUser(
loc_default?.get(`c_${filename}_sub2_opt1_name`) as string, loc_default?.get(`c_${filename}_sub2_opt1_name`) as string,
@ -244,7 +244,7 @@ export default {
return; return;
} }
// Delete a reminder // Delete a reminder
case loc_default?.get(`c_${filename}_sub3_name`)?.toLowerCase() ?? "": { case loc_default?.get(`c_${filename}_sub3_name`)?.toLowerCase(): {
const id = interaction.options.getInteger( const id = interaction.options.getInteger(
loc_default?.get(`c_${filename}_sub3_opt1_name`) as string, loc_default?.get(`c_${filename}_sub3_opt1_name`) as string,
); );

View file

@ -17,23 +17,23 @@ export default {
return ( return (
new SlashCommandBuilder() new SlashCommandBuilder()
.setName(filename.toLowerCase()) .setName(filename.toLowerCase())
.setDescription(loc_default.get(`c_${filename}_desc`) ?? "") .setDescription(loc_default.get(`c_${filename}_desc`)!)
.setNameLocalizations(getLocalizations(client, `c_${filename}_name`, true)) .setNameLocalizations(getLocalizations(client, `c_${filename}_name`, true))
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_desc`)) .setDescriptionLocalizations(getLocalizations(client, `c_${filename}_desc`))
// Normal // Normal
.addSubcommand((subcommand) => .addSubcommand((subcommand) =>
subcommand subcommand
.setName(loc_default.get(`c_${filename}_sub1_name`)?.toLowerCase() ?? "") .setName(loc_default.get(`c_${filename}_sub1_name`)!.toLowerCase())
.setDescription(loc_default.get(`c_${filename}_sub1_desc`) ?? "") .setDescription(loc_default.get(`c_${filename}_sub1_desc`)!)
.setNameLocalizations(getLocalizations(client, `c_${filename}_sub1_name`, true)) .setNameLocalizations(getLocalizations(client, `c_${filename}_sub1_name`, true))
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_sub1_desc`)) .setDescriptionLocalizations(getLocalizations(client, `c_${filename}_sub1_desc`))
// Command option // Command option
.addStringOption((option) => .addStringOption((option) =>
option option
.setName(loc_default.get(`c_${filename}_opt1_name`)?.toLowerCase() ?? "") .setName(loc_default.get(`c_${filename}_opt1_name`)!.toLowerCase())
.setDescription(loc_default.get(`c_${filename}_opt1_desc`) ?? "") .setDescription(loc_default.get(`c_${filename}_opt1_desc`)!)
.setNameLocalizations(getLocalizations(client, `c_${filename}_opt1_name`, true)) .setNameLocalizations(getLocalizations(client, `c_${filename}_opt1_name`, true))
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_opt1_desc`)), .setDescriptionLocalizations(getLocalizations(client, `c_${filename}_opt1_desc`)),
), ),
@ -42,16 +42,16 @@ export default {
// Romanized // Romanized
.addSubcommand((subcommand) => .addSubcommand((subcommand) =>
subcommand subcommand
.setName(loc_default.get(`c_${filename}_sub2_name`)?.toLowerCase() ?? "") .setName(loc_default.get(`c_${filename}_sub2_name`)!.toLowerCase())
.setDescription(loc_default.get(`c_${filename}_sub2_desc`) ?? "") .setDescription(loc_default.get(`c_${filename}_sub2_desc`)!)
.setNameLocalizations(getLocalizations(client, `c_${filename}_sub2_name`, true)) .setNameLocalizations(getLocalizations(client, `c_${filename}_sub2_name`, true))
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_sub2_desc`)) .setDescriptionLocalizations(getLocalizations(client, `c_${filename}_sub2_desc`))
// Command option // Command option
.addStringOption((option) => .addStringOption((option) =>
option option
.setName(loc_default.get(`c_${filename}_opt1_name`)?.toLowerCase() ?? "") .setName(loc_default.get(`c_${filename}_opt1_name`)!.toLowerCase())
.setDescription(loc_default.get(`c_${filename}_opt1_desc`) ?? "") .setDescription(loc_default.get(`c_${filename}_opt1_desc`)!)
.setNameLocalizations(getLocalizations(client, `c_${filename}_opt1_name`, true)) .setNameLocalizations(getLocalizations(client, `c_${filename}_opt1_name`, true))
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_opt1_desc`)), .setDescriptionLocalizations(getLocalizations(client, `c_${filename}_opt1_desc`)),
), ),
@ -60,8 +60,8 @@ export default {
// Synced // Synced
.addSubcommand((subcommand) => .addSubcommand((subcommand) =>
subcommand subcommand
.setName(loc_default.get(`c_${filename}_sub3_name`)?.toLowerCase() ?? "") .setName(loc_default.get(`c_${filename}_sub3_name`)!.toLowerCase())
.setDescription(loc_default.get(`c_${filename}_sub3_desc`) ?? "") .setDescription(loc_default.get(`c_${filename}_sub3_desc`)!)
.setNameLocalizations(getLocalizations(client, `c_${filename}_sub3_name`, true)) .setNameLocalizations(getLocalizations(client, `c_${filename}_sub3_name`, true))
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_sub3_desc`)), .setDescriptionLocalizations(getLocalizations(client, `c_${filename}_sub3_desc`)),
) )
@ -82,12 +82,11 @@ export default {
await interaction.deferReply(); await interaction.deferReply();
const player = useMainPlayer() as Player; const player = useMainPlayer() as Player;
const queue = useQueue(interaction.guildId ?? ""); const queue = useQueue(interaction.guildId!);
if (request) { if (request) {
if ( if (
interaction.options.getSubcommand() == interaction.options.getSubcommand() ==
loc_default?.get(`c_${filename}_sub2_name`)?.toLowerCase() ?? loc_default?.get(`c_${filename}_sub2_name`)?.toLowerCase()
""
) { ) {
// Romanized // Romanized
request += " romanized"; request += " romanized";
@ -113,8 +112,7 @@ export default {
if ( if (
interaction.options.getSubcommand() == interaction.options.getSubcommand() ==
loc_default?.get(`c_${filename}_sub3_name`)?.toLowerCase() ?? loc_default?.get(`c_${filename}_sub3_name`)?.toLowerCase()
""
) { ) {
if (queue === null) { if (queue === null) {
return await interaction.followUp(`❌ | ${loc.get("c_lyrics1")}`); return await interaction.followUp(`❌ | ${loc.get("c_lyrics1")}`);

View file

@ -16,14 +16,14 @@ export default {
return new SlashCommandBuilder() return new SlashCommandBuilder()
.setName(filename.toLowerCase()) .setName(filename.toLowerCase())
.setDescription(loc_default.get(`c_${filename}_desc`) ?? "") .setDescription(loc_default.get(`c_${filename}_desc`)!)
.setNameLocalizations(getLocalizations(client, `c_${filename}_name`, true)) .setNameLocalizations(getLocalizations(client, `c_${filename}_name`, true))
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_desc`)); .setDescriptionLocalizations(getLocalizations(client, `c_${filename}_desc`));
}, },
interaction: async (interaction: ChatInputCommandInteraction, client: Client) => { interaction: async (interaction: ChatInputCommandInteraction, client: Client) => {
const loc = getLocale(client, interaction.locale); const loc = getLocale(client, interaction.locale);
const queue = useQueue(interaction.guildId ?? ""); const queue = useQueue(interaction.guildId!);
if (queue) { if (queue) {
const embed = new EmbedBuilder(); const embed = new EmbedBuilder();

View file

@ -25,15 +25,15 @@ export default {
return ( return (
new SlashCommandBuilder() new SlashCommandBuilder()
.setName(filename.toLowerCase()) .setName(filename.toLowerCase())
.setDescription(loc_default.get(`c_${filename}_desc`) ?? "") .setDescription(loc_default.get(`c_${filename}_desc`)!)
.setNameLocalizations(getLocalizations(client, `c_${filename}_name`, true)) .setNameLocalizations(getLocalizations(client, `c_${filename}_name`, true))
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_desc`)) .setDescriptionLocalizations(getLocalizations(client, `c_${filename}_desc`))
// Command option // Command option
.addStringOption((option) => .addStringOption((option) =>
option option
.setName(loc_default.get(`c_${filename}_opt1_name`)?.toLowerCase() ?? "") .setName(loc_default.get(`c_${filename}_opt1_name`)!.toLowerCase())
.setDescription(loc_default.get(`c_${filename}_opt1_desc`) ?? "") .setDescription(loc_default.get(`c_${filename}_opt1_desc`)!)
.setNameLocalizations(getLocalizations(client, `c_${filename}_opt1_name`, true)) .setNameLocalizations(getLocalizations(client, `c_${filename}_opt1_name`, true))
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_opt1_desc`)) .setDescriptionLocalizations(getLocalizations(client, `c_${filename}_opt1_desc`))
.setAutocomplete(true), .setAutocomplete(true),
@ -47,8 +47,8 @@ export default {
const filename = getFilename(__filename); const filename = getFilename(__filename);
const member = client.guilds.cache const member = client.guilds.cache
.get(interaction.guildId ?? "") .get(interaction.guildId!)
?.members.cache.get(interaction.member?.user.id ?? ""); ?.members.cache.get(interaction.member!.user.id);
if (!member?.voice.channelId) { if (!member?.voice.channelId) {
return await interaction.reply({ return await interaction.reply({
@ -75,7 +75,7 @@ export default {
if (!query) { if (!query) {
// Now playing // Now playing
const queue = useQueue(interaction.guildId ?? ""); const queue = useQueue(interaction.guildId!);
if (queue) { if (queue) {
const track = queue.history.currentTrack; const track = queue.history.currentTrack;

View file

@ -27,23 +27,23 @@ export default {
return ( return (
new SlashCommandBuilder() new SlashCommandBuilder()
.setName(filename.toLowerCase()) .setName(filename.toLowerCase())
.setDescription(loc_default.get(`c_${filename}_desc`) ?? "") .setDescription(loc_default.get(`c_${filename}_desc`)!)
.setNameLocalizations(getLocalizations(client, `c_${filename}_name`, true)) .setNameLocalizations(getLocalizations(client, `c_${filename}_name`, true))
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_desc`)) .setDescriptionLocalizations(getLocalizations(client, `c_${filename}_desc`))
// Show the queue // Show the queue
.addSubcommand((subcommand) => .addSubcommand((subcommand) =>
subcommand subcommand
.setName(loc_default.get(`c_${filename}_sub1_name`)?.toLowerCase() ?? "") .setName(loc_default.get(`c_${filename}_sub1_name`)!.toLowerCase())
.setDescription(loc_default.get(`c_${filename}_sub1_desc`) ?? "") .setDescription(loc_default.get(`c_${filename}_sub1_desc`)!)
.setNameLocalizations(getLocalizations(client, `c_${filename}_sub1_name`, true)) .setNameLocalizations(getLocalizations(client, `c_${filename}_sub1_name`, true))
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_sub1_desc`)) .setDescriptionLocalizations(getLocalizations(client, `c_${filename}_sub1_desc`))
// Specified Page // Specified Page
.addNumberOption((option) => .addNumberOption((option) =>
option option
.setName(loc_default.get(`c_${filename}_sub1_opt1_name`)?.toLowerCase() ?? "") .setName(loc_default.get(`c_${filename}_sub1_opt1_name`)!.toLowerCase())
.setDescription(loc_default.get(`c_${filename}_sub1_opt1_desc`) ?? "") .setDescription(loc_default.get(`c_${filename}_sub1_opt1_desc`)!)
.setNameLocalizations( .setNameLocalizations(
getLocalizations(client, `c_${filename}_sub1_opt1_name`, true), getLocalizations(client, `c_${filename}_sub1_opt1_name`, true),
) )
@ -56,8 +56,8 @@ export default {
// Shuffle Queue // Shuffle Queue
.addSubcommand((subcommand) => .addSubcommand((subcommand) =>
subcommand subcommand
.setName(loc_default.get(`c_${filename}_sub2_name`)?.toLowerCase() ?? "") .setName(loc_default.get(`c_${filename}_sub2_name`)!.toLowerCase())
.setDescription(loc_default.get(`c_${filename}_sub2_desc`) ?? "") .setDescription(loc_default.get(`c_${filename}_sub2_desc`)!)
.setNameLocalizations(getLocalizations(client, `c_${filename}_sub2_name`, true)) .setNameLocalizations(getLocalizations(client, `c_${filename}_sub2_name`, true))
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_sub2_desc`)), .setDescriptionLocalizations(getLocalizations(client, `c_${filename}_sub2_desc`)),
) )
@ -65,8 +65,8 @@ export default {
// Remove <ID> // Remove <ID>
.addSubcommand((subcommand) => .addSubcommand((subcommand) =>
subcommand subcommand
.setName(loc_default.get(`c_${filename}_sub3_name`)?.toLowerCase() ?? "") .setName(loc_default.get(`c_${filename}_sub3_name`)!.toLowerCase())
.setDescription(loc_default.get(`c_${filename}_sub3_desc`) ?? "") .setDescription(loc_default.get(`c_${filename}_sub3_desc`)!)
.setNameLocalizations(getLocalizations(client, `c_${filename}_sub3_name`, true)) .setNameLocalizations(getLocalizations(client, `c_${filename}_sub3_name`, true))
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_sub3_desc`)) .setDescriptionLocalizations(getLocalizations(client, `c_${filename}_sub3_desc`))
@ -74,8 +74,8 @@ export default {
// TODO?: ID range -> as a string: 5-8 remove 5, 6, 7, 8 // TODO?: ID range -> as a string: 5-8 remove 5, 6, 7, 8
.addNumberOption((option) => .addNumberOption((option) =>
option option
.setName(loc_default.get(`c_${filename}_sub3_opt1_name`)?.toLowerCase() ?? "") .setName(loc_default.get(`c_${filename}_sub3_opt1_name`)!.toLowerCase())
.setDescription(loc_default.get(`c_${filename}_sub3_opt1_desc`) ?? "") .setDescription(loc_default.get(`c_${filename}_sub3_opt1_desc`)!)
.setNameLocalizations( .setNameLocalizations(
getLocalizations(client, `c_${filename}_sub3_opt1_name`, true), getLocalizations(client, `c_${filename}_sub3_opt1_name`, true),
) )
@ -93,7 +93,7 @@ export default {
const filename = getFilename(__filename); const filename = getFilename(__filename);
const loc = getLocale(client, interaction.locale); const loc = getLocale(client, interaction.locale);
const queue = useQueue(interaction.guildId ?? ""); const queue = useQueue(interaction.guildId!);
const embed = new EmbedBuilder(); const embed = new EmbedBuilder();
@ -101,7 +101,7 @@ export default {
const subcommand = interaction.options.getSubcommand(); const subcommand = interaction.options.getSubcommand();
switch (subcommand) { switch (subcommand) {
// Show the queue // Show the queue
case loc_default?.get(`c_${filename}_sub1_name`)?.toLowerCase() ?? "": { case loc_default?.get(`c_${filename}_sub1_name`)?.toLowerCase(): {
const page = const page =
interaction.options.getNumber( interaction.options.getNumber(
loc_default?.get(`c_${filename}_sub1_opt1_name`) as string, loc_default?.get(`c_${filename}_sub1_opt1_name`) as string,
@ -142,7 +142,7 @@ export default {
} }
// Shuffle Queue // Shuffle Queue
case loc_default?.get(`c_${filename}_sub2_name`)?.toLowerCase() ?? "": { case loc_default?.get(`c_${filename}_sub2_name`)?.toLowerCase(): {
queue.tracks.shuffle(); queue.tracks.shuffle();
embed.setDescription(loc.get("c_queue3")); embed.setDescription(loc.get("c_queue3"));
@ -150,7 +150,7 @@ export default {
} }
// Remove <ID> // Remove <ID>
case loc_default?.get(`c_${filename}_sub3_name`)?.toLowerCase() ?? "": { case loc_default?.get(`c_${filename}_sub3_name`)?.toLowerCase(): {
const id = interaction.options.getNumber( const id = interaction.options.getNumber(
loc_default?.get(`c_${filename}_sub3_opt1_name`) as string, loc_default?.get(`c_${filename}_sub3_opt1_name`) as string,
) as number; ) as number;

View file

@ -17,15 +17,15 @@ export default {
return ( return (
new SlashCommandBuilder() new SlashCommandBuilder()
.setName(filename.toLowerCase()) .setName(filename.toLowerCase())
.setDescription(loc_default.get(`c_${filename}_desc`) ?? "") .setDescription(loc_default.get(`c_${filename}_desc`)!)
.setNameLocalizations(getLocalizations(client, `c_${filename}_name`, true)) .setNameLocalizations(getLocalizations(client, `c_${filename}_name`, true))
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_desc`)) .setDescriptionLocalizations(getLocalizations(client, `c_${filename}_desc`))
// Disable repeat // Disable repeat
.addSubcommand((subcommand) => .addSubcommand((subcommand) =>
subcommand subcommand
.setName(loc_default.get(`c_${filename}_sub1_name`)?.toLowerCase() ?? "") .setName(loc_default.get(`c_${filename}_sub1_name`)!.toLowerCase())
.setDescription(loc_default.get(`c_${filename}_sub1_desc`) ?? "") .setDescription(loc_default.get(`c_${filename}_sub1_desc`)!)
.setNameLocalizations(getLocalizations(client, `c_${filename}_sub1_name`, true)) .setNameLocalizations(getLocalizations(client, `c_${filename}_sub1_name`, true))
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_sub1_desc`)), .setDescriptionLocalizations(getLocalizations(client, `c_${filename}_sub1_desc`)),
) )
@ -33,8 +33,8 @@ export default {
// Repeat current track // Repeat current track
.addSubcommand((subcommand) => .addSubcommand((subcommand) =>
subcommand subcommand
.setName(loc_default.get(`c_${filename}_sub2_name`)?.toLowerCase() ?? "") .setName(loc_default.get(`c_${filename}_sub2_name`)!.toLowerCase())
.setDescription(loc_default.get(`c_${filename}_sub2_desc`) ?? "") .setDescription(loc_default.get(`c_${filename}_sub2_desc`)!)
.setNameLocalizations(getLocalizations(client, `c_${filename}_sub2_name`, true)) .setNameLocalizations(getLocalizations(client, `c_${filename}_sub2_name`, true))
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_sub2_desc`)), .setDescriptionLocalizations(getLocalizations(client, `c_${filename}_sub2_desc`)),
) )
@ -42,8 +42,8 @@ export default {
// Repeat queue // Repeat queue
.addSubcommand((subcommand) => .addSubcommand((subcommand) =>
subcommand subcommand
.setName(loc_default.get(`c_${filename}_sub3_name`)?.toLowerCase() ?? "") .setName(loc_default.get(`c_${filename}_sub3_name`)!.toLowerCase())
.setDescription(loc_default.get(`c_${filename}_sub3_desc`) ?? "") .setDescription(loc_default.get(`c_${filename}_sub3_desc`)!)
.setNameLocalizations(getLocalizations(client, `c_${filename}_sub3_name`, true)) .setNameLocalizations(getLocalizations(client, `c_${filename}_sub3_name`, true))
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_sub3_desc`)), .setDescriptionLocalizations(getLocalizations(client, `c_${filename}_sub3_desc`)),
) )
@ -51,8 +51,8 @@ export default {
// Enable autoplay // Enable autoplay
.addSubcommand((subcommand) => .addSubcommand((subcommand) =>
subcommand subcommand
.setName(loc_default.get(`c_${filename}_sub4_name`)?.toLowerCase() ?? "") .setName(loc_default.get(`c_${filename}_sub4_name`)!.toLowerCase())
.setDescription(loc_default.get(`c_${filename}_sub4_desc`) ?? "") .setDescription(loc_default.get(`c_${filename}_sub4_desc`)!)
.setNameLocalizations(getLocalizations(client, `c_${filename}_sub4_name`, true)) .setNameLocalizations(getLocalizations(client, `c_${filename}_sub4_name`, true))
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_sub4_desc`)), .setDescriptionLocalizations(getLocalizations(client, `c_${filename}_sub4_desc`)),
) )
@ -64,31 +64,31 @@ export default {
const filename = getFilename(__filename); const filename = getFilename(__filename);
const loc = getLocale(client, interaction.locale); const loc = getLocale(client, interaction.locale);
const queue = useQueue(interaction.guildId ?? ""); const queue = useQueue(interaction.guildId!);
if (queue) { if (queue) {
const subcommand = interaction.options.getSubcommand(); const subcommand = interaction.options.getSubcommand();
switch (subcommand) { switch (subcommand) {
// Disable // Disable
case loc_default?.get(`c_${filename}_sub1_name`)?.toLowerCase() ?? "": { case loc_default?.get(`c_${filename}_sub1_name`)?.toLowerCase(): {
queue.setRepeatMode(QueueRepeatMode.OFF); queue.setRepeatMode(QueueRepeatMode.OFF);
return interaction.reply(loc.get("c_repeat2") + "."); return interaction.reply(loc.get("c_repeat2") + ".");
} }
// Queue Repeat // Queue Repeat
case loc_default?.get(`c_${filename}_sub3_name`)?.toLowerCase() ?? "": { case loc_default?.get(`c_${filename}_sub3_name`)?.toLowerCase(): {
queue.setRepeatMode(QueueRepeatMode.QUEUE); queue.setRepeatMode(QueueRepeatMode.QUEUE);
return interaction.reply(`${loc.get("c_repeat3")} ${loc.get("c_repeat6")}.`); return interaction.reply(`${loc.get("c_repeat3")} ${loc.get("c_repeat6")}.`);
} }
// Autoplay // Autoplay
case loc_default?.get(`c_${filename}_sub4_name`)?.toLowerCase() ?? "": { case loc_default?.get(`c_${filename}_sub4_name`)?.toLowerCase(): {
queue.setRepeatMode(QueueRepeatMode.AUTOPLAY); queue.setRepeatMode(QueueRepeatMode.AUTOPLAY);
return interaction.reply(`${loc.get("c_repeat4")} ${loc.get("c_repeat6")}.`); return interaction.reply(`${loc.get("c_repeat4")} ${loc.get("c_repeat6")}.`);
} }
// Track repeat // Track repeat
case loc_default?.get(`c_${filename}_sub2_name`)?.toLowerCase() ?? "": { case loc_default?.get(`c_${filename}_sub2_name`)?.toLowerCase(): {
queue.setRepeatMode(QueueRepeatMode.TRACK); queue.setRepeatMode(QueueRepeatMode.TRACK);
return interaction.reply( return interaction.reply(
`${loc.get("c_repeat5")} ${queue.history.currentTrack?.title} ${loc.get("c_repeat6")}.`, `${loc.get("c_repeat5")} ${queue.history.currentTrack?.title} ${loc.get("c_repeat6")}.`,

View file

@ -17,15 +17,15 @@ export default {
return ( return (
new SlashCommandBuilder() new SlashCommandBuilder()
.setName(filename.toLowerCase()) .setName(filename.toLowerCase())
.setDescription(loc_default.get(`c_${filename}_desc`) ?? "") .setDescription(loc_default.get(`c_${filename}_desc`)!)
.setNameLocalizations(getLocalizations(client, `c_${filename}_name`, true)) .setNameLocalizations(getLocalizations(client, `c_${filename}_name`, true))
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_desc`)) .setDescriptionLocalizations(getLocalizations(client, `c_${filename}_desc`))
// Command option // Command option
.addNumberOption((option) => .addNumberOption((option) =>
option option
.setName(loc_default.get(`c_${filename}_opt1_name`)?.toLowerCase() ?? "") .setName(loc_default.get(`c_${filename}_opt1_name`)!.toLowerCase())
.setDescription(loc_default.get(`c_${filename}_opt1_desc`) ?? "") .setDescription(loc_default.get(`c_${filename}_opt1_desc`)!)
.setNameLocalizations(getLocalizations(client, `c_${filename}_opt1_name`, true)) .setNameLocalizations(getLocalizations(client, `c_${filename}_opt1_name`, true))
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_opt1_desc`)), .setDescriptionLocalizations(getLocalizations(client, `c_${filename}_opt1_desc`)),
) )
@ -37,7 +37,7 @@ export default {
const filename = getFilename(__filename); const filename = getFilename(__filename);
const loc = getLocale(client, interaction.locale); const loc = getLocale(client, interaction.locale);
const queue = useQueue(interaction.guildId ?? ""); const queue = useQueue(interaction.guildId!);
const id = interaction.options.getNumber(loc_default?.get(`c_${filename}_opt1_name`) as string); const id = interaction.options.getNumber(loc_default?.get(`c_${filename}_opt1_name`) as string);

View file

@ -17,7 +17,7 @@ export default {
return new SlashCommandBuilder() return new SlashCommandBuilder()
.setName(filename.toLowerCase()) .setName(filename.toLowerCase())
.setDescription(loc_default.get(`c_${filename}_desc`) ?? "") .setDescription(loc_default.get(`c_${filename}_desc`)!)
.setNameLocalizations(getLocalizations(client, `c_${filename}_name`, true)) .setNameLocalizations(getLocalizations(client, `c_${filename}_name`, true))
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_desc`)); .setDescriptionLocalizations(getLocalizations(client, `c_${filename}_desc`));
}, },

View file

@ -168,7 +168,7 @@ export const sendReminder = (client: Client, info: infoReminder, option: OptionR
} }
} else { } else {
// Channel // Channel
client.channels.fetch(info.channelId ?? "").then((channel) => { client.channels.fetch(info.channelId!).then((channel) => {
if (channel?.isSendable()) { if (channel?.isSendable()) {
let content = `<@${info.userId}>`; let content = `<@${info.userId}>`;
embed.setFooter({ embed.setFooter({