fix: don't use default bad value, assert instead #166
17 changed files with 97 additions and 109 deletions
|
@ -124,9 +124,7 @@ export default {
|
|||
const filename = getFilename(__filename);
|
||||
return new SlashCommandBuilder()
|
||||
.setName(filename.toLowerCase())
|
||||
.setDescription(
|
||||
client.locales.get(client.config.default_lang)?.get(`c_${filename}_desc`) ?? ""
|
||||
)
|
||||
.setDescription(client.locales.get(client.config.default_lang)!.get(`c_${filename}_desc`)!)
|
||||
.setNameLocalizations(getLocalizations(client, `c_${filename}_name`, true))
|
||||
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_desc`));
|
||||
},
|
||||
|
|
|
@ -31,7 +31,7 @@ export default {
|
|||
}
|
||||
|
||||
// Get queue
|
||||
const queue = useQueue(interaction.guildId ?? "");
|
||||
const queue = useQueue(interaction.guildId!);
|
||||
|
||||
const embed = new EmbedBuilder();
|
||||
const rows = [];
|
||||
|
|
|
@ -31,7 +31,7 @@ export default {
|
|||
}
|
||||
|
||||
// Get queue
|
||||
const queue = useQueue(interaction.guildId ?? "");
|
||||
const queue = useQueue(interaction.guildId!);
|
||||
|
||||
const embed = new EmbedBuilder();
|
||||
const rows = [];
|
||||
|
|
|
@ -6,7 +6,7 @@ import { removeExtension } from "../utils/misc";
|
|||
|
||||
/** Load all the commands */
|
||||
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(
|
||||
(element) => !element.endsWith(".js") && !element.endsWith(".ts"),
|
||||
|
|
|
@ -19,9 +19,7 @@ export default {
|
|||
return (
|
||||
new SlashCommandBuilder()
|
||||
.setName(filename.toLowerCase())
|
||||
.setDescription(
|
||||
client.locales.get(client.config.default_lang)?.get(`c_${filename}_desc`) ?? "",
|
||||
)
|
||||
.setDescription(client.locales.get(client.config.default_lang)!.get(`c_${filename}_desc`)!)
|
||||
.setNameLocalizations(getLocalizations(client, `c_${filename}_name`, true))
|
||||
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_desc`))
|
||||
|
||||
|
@ -29,10 +27,10 @@ export default {
|
|||
.addStringOption((option) =>
|
||||
option
|
||||
.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(
|
||||
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))
|
||||
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_opt1_desc`)),
|
||||
|
@ -44,8 +42,8 @@ export default {
|
|||
const loc = getLocale(client, interaction.locale);
|
||||
const desiredCat = interaction.options.get(
|
||||
client.locales
|
||||
.get(client.config.default_lang)
|
||||
?.get(`c_${getFilename(__filename)}_opt1_name`) ?? "",
|
||||
.get(client.config.default_lang)!
|
||||
.get(`c_${getFilename(__filename)}_opt1_name`)!,
|
||||
)?.value as string;
|
||||
|
||||
// If a category isn't specified
|
||||
|
|
|
@ -13,9 +13,7 @@ export default {
|
|||
return (
|
||||
new SlashCommandBuilder()
|
||||
.setName(filename.toLowerCase())
|
||||
.setDescription(
|
||||
client.locales.get(client.config.default_lang)?.get(`c_${filename}_desc`) ?? "",
|
||||
)
|
||||
.setDescription(client.locales.get(client.config.default_lang)!.get(`c_${filename}_desc`)!)
|
||||
.setNameLocalizations(getLocalizations(client, `c_${filename}_name`, true))
|
||||
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_desc`))
|
||||
|
||||
|
@ -23,10 +21,10 @@ export default {
|
|||
.addStringOption((option) =>
|
||||
option
|
||||
.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(
|
||||
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))
|
||||
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_opt1_desc`)),
|
||||
|
@ -38,8 +36,8 @@ export default {
|
|||
const loc = getLocale(client, interaction.locale);
|
||||
const desired_command = interaction.options.getString(
|
||||
client.locales
|
||||
.get(client.config.default_lang)
|
||||
?.get(`c_${getFilename(__filename)}_opt1_name`) ?? "",
|
||||
.get(client.config.default_lang)!
|
||||
.get(`c_${getFilename(__filename)}_opt1_name`)!,
|
||||
);
|
||||
|
||||
// If a command isn't specified
|
||||
|
|
|
@ -10,9 +10,7 @@ export default {
|
|||
const filename = getFilename(__filename);
|
||||
return new SlashCommandBuilder()
|
||||
.setName(filename.toLowerCase())
|
||||
.setDescription(
|
||||
client.locales.get(client.config.default_lang)?.get(`c_${filename}_desc`) ?? "",
|
||||
)
|
||||
.setDescription(client.locales.get(client.config.default_lang)!.get(`c_${filename}_desc`)!)
|
||||
.setNameLocalizations(getLocalizations(client, `c_${filename}_name`, true))
|
||||
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_desc`));
|
||||
},
|
||||
|
|
|
@ -12,9 +12,7 @@ export default {
|
|||
return (
|
||||
new SlashCommandBuilder()
|
||||
.setName(filename.toLowerCase())
|
||||
.setDescription(
|
||||
client.locales.get(client.config.default_lang)?.get(`c_${filename}_desc`) ?? "",
|
||||
)
|
||||
.setDescription(client.locales.get(client.config.default_lang)!.get(`c_${filename}_desc`)!)
|
||||
.setNameLocalizations(getLocalizations(client, `c_${filename}_name`, true))
|
||||
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_desc`))
|
||||
|
||||
|
@ -22,10 +20,10 @@ export default {
|
|||
.addStringOption((option) =>
|
||||
option
|
||||
.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(
|
||||
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))
|
||||
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_opt1_desc`)),
|
||||
|
@ -37,8 +35,8 @@ export default {
|
|||
const loc = getLocale(client, interaction.locale);
|
||||
const desired_cat = interaction.options.get(
|
||||
client.locales
|
||||
.get(client.config.default_lang)
|
||||
?.get(`c_${getFilename(__filename)}_opt1_name`) ?? "",
|
||||
.get(client.config.default_lang)!
|
||||
.get(`c_${getFilename(__filename)}_opt1_name`)!,
|
||||
)?.value as string;
|
||||
|
||||
// If a category isn't specified
|
||||
|
|
|
@ -35,23 +35,23 @@ export default {
|
|||
new SlashCommandBuilder()
|
||||
// Command
|
||||
.setName(filename.toLowerCase())
|
||||
.setDescription(loc_default.get(`c_${filename}_desc`) ?? "")
|
||||
.setDescription(loc_default.get(`c_${filename}_desc`)!)
|
||||
.setNameLocalizations(getLocalizations(client, `c_${filename}_name`, true))
|
||||
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_desc`))
|
||||
|
||||
// New reminder
|
||||
.addSubcommand((subcommand) =>
|
||||
subcommand
|
||||
.setName(loc_default.get(`c_${filename}_sub1_name`)?.toLowerCase() ?? "")
|
||||
.setDescription(loc_default.get(`c_${filename}_sub1_desc`) ?? "")
|
||||
.setName(loc_default.get(`c_${filename}_sub1_name`)!.toLowerCase())
|
||||
.setDescription(loc_default.get(`c_${filename}_sub1_desc`)!)
|
||||
.setNameLocalizations(getLocalizations(client, `c_${filename}_sub1_name`, true))
|
||||
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_sub1_desc`))
|
||||
|
||||
// Specified Time
|
||||
.addStringOption((option) =>
|
||||
option
|
||||
.setName(loc_default.get(`c_${filename}_sub1_opt1_name`)?.toLowerCase() ?? "")
|
||||
.setDescription(loc_default.get(`c_${filename}_sub1_opt1_desc`) ?? "")
|
||||
.setName(loc_default.get(`c_${filename}_sub1_opt1_name`)!.toLowerCase())
|
||||
.setDescription(loc_default.get(`c_${filename}_sub1_opt1_desc`)!)
|
||||
.setNameLocalizations(
|
||||
getLocalizations(client, `c_${filename}_sub1_opt1_name`, true),
|
||||
)
|
||||
|
@ -63,8 +63,8 @@ export default {
|
|||
// Specified message (not required)
|
||||
.addStringOption((option) =>
|
||||
option
|
||||
.setName(loc_default.get(`c_${filename}_sub1_opt2_name`)?.toLowerCase() ?? "")
|
||||
.setDescription(loc_default.get(`c_${filename}_sub1_opt2_desc`) ?? "")
|
||||
.setName(loc_default.get(`c_${filename}_sub1_opt2_name`)!.toLowerCase())
|
||||
.setDescription(loc_default.get(`c_${filename}_sub1_opt2_desc`)!)
|
||||
.setNameLocalizations(
|
||||
getLocalizations(client, `c_${filename}_sub1_opt2_name`, true),
|
||||
)
|
||||
|
@ -77,16 +77,16 @@ export default {
|
|||
// List reminders
|
||||
.addSubcommand((subcommand) =>
|
||||
subcommand
|
||||
.setName(loc_default.get(`c_${filename}_sub2_name`)?.toLowerCase() ?? "")
|
||||
.setDescription(loc_default.get(`c_${filename}_sub2_desc`) ?? "")
|
||||
.setName(loc_default.get(`c_${filename}_sub2_name`)!.toLowerCase())
|
||||
.setDescription(loc_default.get(`c_${filename}_sub2_desc`)!)
|
||||
.setNameLocalizations(getLocalizations(client, `c_${filename}_sub2_name`, true))
|
||||
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_sub2_desc`))
|
||||
|
||||
// User
|
||||
.addUserOption((option) =>
|
||||
option
|
||||
.setName(loc_default.get(`c_${filename}_sub2_opt1_name`)?.toLowerCase() ?? "")
|
||||
.setDescription(loc_default.get(`c_${filename}_sub2_opt1_desc`) ?? "")
|
||||
.setName(loc_default.get(`c_${filename}_sub2_opt1_name`)!.toLowerCase())
|
||||
.setDescription(loc_default.get(`c_${filename}_sub2_opt1_desc`)!)
|
||||
.setNameLocalizations(
|
||||
getLocalizations(client, `c_${filename}_sub2_opt1_name`, true),
|
||||
)
|
||||
|
@ -98,8 +98,8 @@ export default {
|
|||
// Page
|
||||
.addIntegerOption((option) =>
|
||||
option
|
||||
.setName(loc_default.get(`c_${filename}_sub2_opt2_name`)?.toLowerCase() ?? "")
|
||||
.setDescription(loc_default.get(`c_${filename}_sub2_opt2_desc`) ?? "")
|
||||
.setName(loc_default.get(`c_${filename}_sub2_opt2_name`)!.toLowerCase())
|
||||
.setDescription(loc_default.get(`c_${filename}_sub2_opt2_desc`)!)
|
||||
.setNameLocalizations(
|
||||
getLocalizations(client, `c_${filename}_sub2_opt2_name`, true),
|
||||
)
|
||||
|
@ -112,16 +112,16 @@ export default {
|
|||
// Delete a reminder
|
||||
.addSubcommand((subcommand) =>
|
||||
subcommand
|
||||
.setName(loc_default.get(`c_${filename}_sub3_name`)?.toLowerCase() ?? "")
|
||||
.setDescription(loc_default.get(`c_${filename}_sub3_desc`) ?? "")
|
||||
.setName(loc_default.get(`c_${filename}_sub3_name`)!.toLowerCase())
|
||||
.setDescription(loc_default.get(`c_${filename}_sub3_desc`)!)
|
||||
.setNameLocalizations(getLocalizations(client, `c_${filename}_sub3_name`, true))
|
||||
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_sub3_desc`))
|
||||
|
||||
// ID
|
||||
.addIntegerOption((option) =>
|
||||
option
|
||||
.setName(loc_default.get(`c_${filename}_sub3_opt1_name`)?.toLowerCase() ?? "")
|
||||
.setDescription(loc_default.get(`c_${filename}_sub3_opt1_desc`) ?? "")
|
||||
.setName(loc_default.get(`c_${filename}_sub3_opt1_name`)!.toLowerCase())
|
||||
.setDescription(loc_default.get(`c_${filename}_sub3_opt1_desc`)!)
|
||||
.setNameLocalizations(
|
||||
getLocalizations(client, `c_${filename}_sub3_opt1_name`, true),
|
||||
)
|
||||
|
@ -142,7 +142,7 @@ export default {
|
|||
const subcommand = interaction.options.getSubcommand();
|
||||
switch (subcommand) {
|
||||
// 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
|
||||
const time = interaction.options.getString(
|
||||
loc_default?.get(`c_${filename}_sub1_opt1_name`) as string,
|
||||
|
@ -193,7 +193,7 @@ export default {
|
|||
}
|
||||
}
|
||||
// List reminders
|
||||
case loc_default?.get(`c_${filename}_sub2_name`)?.toLowerCase() ?? "": {
|
||||
case loc_default?.get(`c_${filename}_sub2_name`)?.toLowerCase(): {
|
||||
// Which user to show
|
||||
let user = interaction.options.getUser(
|
||||
loc_default?.get(`c_${filename}_sub2_opt1_name`) as string,
|
||||
|
@ -244,7 +244,7 @@ export default {
|
|||
return;
|
||||
}
|
||||
// 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(
|
||||
loc_default?.get(`c_${filename}_sub3_opt1_name`) as string,
|
||||
);
|
||||
|
|
|
@ -17,23 +17,23 @@ export default {
|
|||
return (
|
||||
new SlashCommandBuilder()
|
||||
.setName(filename.toLowerCase())
|
||||
.setDescription(loc_default.get(`c_${filename}_desc`) ?? "")
|
||||
.setDescription(loc_default.get(`c_${filename}_desc`)!)
|
||||
.setNameLocalizations(getLocalizations(client, `c_${filename}_name`, true))
|
||||
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_desc`))
|
||||
|
||||
// Normal
|
||||
.addSubcommand((subcommand) =>
|
||||
subcommand
|
||||
.setName(loc_default.get(`c_${filename}_sub1_name`)?.toLowerCase() ?? "")
|
||||
.setDescription(loc_default.get(`c_${filename}_sub1_desc`) ?? "")
|
||||
.setName(loc_default.get(`c_${filename}_sub1_name`)!.toLowerCase())
|
||||
.setDescription(loc_default.get(`c_${filename}_sub1_desc`)!)
|
||||
.setNameLocalizations(getLocalizations(client, `c_${filename}_sub1_name`, true))
|
||||
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_sub1_desc`))
|
||||
|
||||
// Command option
|
||||
.addStringOption((option) =>
|
||||
option
|
||||
.setName(loc_default.get(`c_${filename}_opt1_name`)?.toLowerCase() ?? "")
|
||||
.setDescription(loc_default.get(`c_${filename}_opt1_desc`) ?? "")
|
||||
.setName(loc_default.get(`c_${filename}_opt1_name`)!.toLowerCase())
|
||||
.setDescription(loc_default.get(`c_${filename}_opt1_desc`)!)
|
||||
.setNameLocalizations(getLocalizations(client, `c_${filename}_opt1_name`, true))
|
||||
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_opt1_desc`)),
|
||||
),
|
||||
|
@ -42,16 +42,16 @@ export default {
|
|||
// Romanized
|
||||
.addSubcommand((subcommand) =>
|
||||
subcommand
|
||||
.setName(loc_default.get(`c_${filename}_sub2_name`)?.toLowerCase() ?? "")
|
||||
.setDescription(loc_default.get(`c_${filename}_sub2_desc`) ?? "")
|
||||
.setName(loc_default.get(`c_${filename}_sub2_name`)!.toLowerCase())
|
||||
.setDescription(loc_default.get(`c_${filename}_sub2_desc`)!)
|
||||
.setNameLocalizations(getLocalizations(client, `c_${filename}_sub2_name`, true))
|
||||
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_sub2_desc`))
|
||||
|
||||
// Command option
|
||||
.addStringOption((option) =>
|
||||
option
|
||||
.setName(loc_default.get(`c_${filename}_opt1_name`)?.toLowerCase() ?? "")
|
||||
.setDescription(loc_default.get(`c_${filename}_opt1_desc`) ?? "")
|
||||
.setName(loc_default.get(`c_${filename}_opt1_name`)!.toLowerCase())
|
||||
.setDescription(loc_default.get(`c_${filename}_opt1_desc`)!)
|
||||
.setNameLocalizations(getLocalizations(client, `c_${filename}_opt1_name`, true))
|
||||
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_opt1_desc`)),
|
||||
),
|
||||
|
@ -60,8 +60,8 @@ export default {
|
|||
// Synced
|
||||
.addSubcommand((subcommand) =>
|
||||
subcommand
|
||||
.setName(loc_default.get(`c_${filename}_sub3_name`)?.toLowerCase() ?? "")
|
||||
.setDescription(loc_default.get(`c_${filename}_sub3_desc`) ?? "")
|
||||
.setName(loc_default.get(`c_${filename}_sub3_name`)!.toLowerCase())
|
||||
.setDescription(loc_default.get(`c_${filename}_sub3_desc`)!)
|
||||
.setNameLocalizations(getLocalizations(client, `c_${filename}_sub3_name`, true))
|
||||
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_sub3_desc`)),
|
||||
)
|
||||
|
@ -82,12 +82,11 @@ export default {
|
|||
await interaction.deferReply();
|
||||
|
||||
const player = useMainPlayer() as Player;
|
||||
const queue = useQueue(interaction.guildId ?? "");
|
||||
const queue = useQueue(interaction.guildId!);
|
||||
if (request) {
|
||||
if (
|
||||
interaction.options.getSubcommand() ==
|
||||
loc_default?.get(`c_${filename}_sub2_name`)?.toLowerCase() ??
|
||||
""
|
||||
loc_default?.get(`c_${filename}_sub2_name`)?.toLowerCase()
|
||||
) {
|
||||
// Romanized
|
||||
request += " romanized";
|
||||
|
@ -113,8 +112,7 @@ export default {
|
|||
|
||||
if (
|
||||
interaction.options.getSubcommand() ==
|
||||
loc_default?.get(`c_${filename}_sub3_name`)?.toLowerCase() ??
|
||||
""
|
||||
loc_default?.get(`c_${filename}_sub3_name`)?.toLowerCase()
|
||||
) {
|
||||
if (queue === null) {
|
||||
return await interaction.followUp(`❌ | ${loc.get("c_lyrics1")}`);
|
||||
|
|
|
@ -16,14 +16,14 @@ export default {
|
|||
|
||||
return new SlashCommandBuilder()
|
||||
.setName(filename.toLowerCase())
|
||||
.setDescription(loc_default.get(`c_${filename}_desc`) ?? "")
|
||||
.setDescription(loc_default.get(`c_${filename}_desc`)!)
|
||||
.setNameLocalizations(getLocalizations(client, `c_${filename}_name`, true))
|
||||
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_desc`));
|
||||
},
|
||||
|
||||
interaction: async (interaction: ChatInputCommandInteraction, client: Client) => {
|
||||
const loc = getLocale(client, interaction.locale);
|
||||
const queue = useQueue(interaction.guildId ?? "");
|
||||
const queue = useQueue(interaction.guildId!);
|
||||
|
||||
if (queue) {
|
||||
const embed = new EmbedBuilder();
|
||||
|
|
|
@ -25,15 +25,15 @@ export default {
|
|||
return (
|
||||
new SlashCommandBuilder()
|
||||
.setName(filename.toLowerCase())
|
||||
.setDescription(loc_default.get(`c_${filename}_desc`) ?? "")
|
||||
.setDescription(loc_default.get(`c_${filename}_desc`)!)
|
||||
.setNameLocalizations(getLocalizations(client, `c_${filename}_name`, true))
|
||||
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_desc`))
|
||||
|
||||
// Command option
|
||||
.addStringOption((option) =>
|
||||
option
|
||||
.setName(loc_default.get(`c_${filename}_opt1_name`)?.toLowerCase() ?? "")
|
||||
.setDescription(loc_default.get(`c_${filename}_opt1_desc`) ?? "")
|
||||
.setName(loc_default.get(`c_${filename}_opt1_name`)!.toLowerCase())
|
||||
.setDescription(loc_default.get(`c_${filename}_opt1_desc`)!)
|
||||
.setNameLocalizations(getLocalizations(client, `c_${filename}_opt1_name`, true))
|
||||
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_opt1_desc`))
|
||||
.setAutocomplete(true),
|
||||
|
@ -47,8 +47,8 @@ export default {
|
|||
const filename = getFilename(__filename);
|
||||
|
||||
const member = client.guilds.cache
|
||||
.get(interaction.guildId ?? "")
|
||||
?.members.cache.get(interaction.member?.user.id ?? "");
|
||||
.get(interaction.guildId!)
|
||||
?.members.cache.get(interaction.member!.user.id);
|
||||
|
||||
if (!member?.voice.channelId) {
|
||||
return await interaction.reply({
|
||||
|
@ -75,7 +75,7 @@ export default {
|
|||
if (!query) {
|
||||
// Now playing
|
||||
|
||||
const queue = useQueue(interaction.guildId ?? "");
|
||||
const queue = useQueue(interaction.guildId!);
|
||||
|
||||
if (queue) {
|
||||
const track = queue.history.currentTrack;
|
||||
|
|
|
@ -27,23 +27,23 @@ export default {
|
|||
return (
|
||||
new SlashCommandBuilder()
|
||||
.setName(filename.toLowerCase())
|
||||
.setDescription(loc_default.get(`c_${filename}_desc`) ?? "")
|
||||
.setDescription(loc_default.get(`c_${filename}_desc`)!)
|
||||
.setNameLocalizations(getLocalizations(client, `c_${filename}_name`, true))
|
||||
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_desc`))
|
||||
|
||||
// Show the queue
|
||||
.addSubcommand((subcommand) =>
|
||||
subcommand
|
||||
.setName(loc_default.get(`c_${filename}_sub1_name`)?.toLowerCase() ?? "")
|
||||
.setDescription(loc_default.get(`c_${filename}_sub1_desc`) ?? "")
|
||||
.setName(loc_default.get(`c_${filename}_sub1_name`)!.toLowerCase())
|
||||
.setDescription(loc_default.get(`c_${filename}_sub1_desc`)!)
|
||||
.setNameLocalizations(getLocalizations(client, `c_${filename}_sub1_name`, true))
|
||||
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_sub1_desc`))
|
||||
|
||||
// Specified Page
|
||||
.addNumberOption((option) =>
|
||||
option
|
||||
.setName(loc_default.get(`c_${filename}_sub1_opt1_name`)?.toLowerCase() ?? "")
|
||||
.setDescription(loc_default.get(`c_${filename}_sub1_opt1_desc`) ?? "")
|
||||
.setName(loc_default.get(`c_${filename}_sub1_opt1_name`)!.toLowerCase())
|
||||
.setDescription(loc_default.get(`c_${filename}_sub1_opt1_desc`)!)
|
||||
.setNameLocalizations(
|
||||
getLocalizations(client, `c_${filename}_sub1_opt1_name`, true),
|
||||
)
|
||||
|
@ -56,8 +56,8 @@ export default {
|
|||
// Shuffle Queue
|
||||
.addSubcommand((subcommand) =>
|
||||
subcommand
|
||||
.setName(loc_default.get(`c_${filename}_sub2_name`)?.toLowerCase() ?? "")
|
||||
.setDescription(loc_default.get(`c_${filename}_sub2_desc`) ?? "")
|
||||
.setName(loc_default.get(`c_${filename}_sub2_name`)!.toLowerCase())
|
||||
.setDescription(loc_default.get(`c_${filename}_sub2_desc`)!)
|
||||
.setNameLocalizations(getLocalizations(client, `c_${filename}_sub2_name`, true))
|
||||
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_sub2_desc`)),
|
||||
)
|
||||
|
@ -65,8 +65,8 @@ export default {
|
|||
// Remove <ID>
|
||||
.addSubcommand((subcommand) =>
|
||||
subcommand
|
||||
.setName(loc_default.get(`c_${filename}_sub3_name`)?.toLowerCase() ?? "")
|
||||
.setDescription(loc_default.get(`c_${filename}_sub3_desc`) ?? "")
|
||||
.setName(loc_default.get(`c_${filename}_sub3_name`)!.toLowerCase())
|
||||
.setDescription(loc_default.get(`c_${filename}_sub3_desc`)!)
|
||||
.setNameLocalizations(getLocalizations(client, `c_${filename}_sub3_name`, true))
|
||||
.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
|
||||
.addNumberOption((option) =>
|
||||
option
|
||||
.setName(loc_default.get(`c_${filename}_sub3_opt1_name`)?.toLowerCase() ?? "")
|
||||
.setDescription(loc_default.get(`c_${filename}_sub3_opt1_desc`) ?? "")
|
||||
.setName(loc_default.get(`c_${filename}_sub3_opt1_name`)!.toLowerCase())
|
||||
.setDescription(loc_default.get(`c_${filename}_sub3_opt1_desc`)!)
|
||||
.setNameLocalizations(
|
||||
getLocalizations(client, `c_${filename}_sub3_opt1_name`, true),
|
||||
)
|
||||
|
@ -93,7 +93,7 @@ export default {
|
|||
const filename = getFilename(__filename);
|
||||
|
||||
const loc = getLocale(client, interaction.locale);
|
||||
const queue = useQueue(interaction.guildId ?? "");
|
||||
const queue = useQueue(interaction.guildId!);
|
||||
|
||||
const embed = new EmbedBuilder();
|
||||
|
||||
|
@ -101,7 +101,7 @@ export default {
|
|||
const subcommand = interaction.options.getSubcommand();
|
||||
switch (subcommand) {
|
||||
// Show the queue
|
||||
case loc_default?.get(`c_${filename}_sub1_name`)?.toLowerCase() ?? "": {
|
||||
case loc_default?.get(`c_${filename}_sub1_name`)?.toLowerCase(): {
|
||||
const page =
|
||||
interaction.options.getNumber(
|
||||
loc_default?.get(`c_${filename}_sub1_opt1_name`) as string,
|
||||
|
@ -142,7 +142,7 @@ export default {
|
|||
}
|
||||
|
||||
// Shuffle Queue
|
||||
case loc_default?.get(`c_${filename}_sub2_name`)?.toLowerCase() ?? "": {
|
||||
case loc_default?.get(`c_${filename}_sub2_name`)?.toLowerCase(): {
|
||||
queue.tracks.shuffle();
|
||||
|
||||
embed.setDescription(loc.get("c_queue3"));
|
||||
|
@ -150,7 +150,7 @@ export default {
|
|||
}
|
||||
|
||||
// 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(
|
||||
loc_default?.get(`c_${filename}_sub3_opt1_name`) as string,
|
||||
) as number;
|
||||
|
|
|
@ -17,15 +17,15 @@ export default {
|
|||
return (
|
||||
new SlashCommandBuilder()
|
||||
.setName(filename.toLowerCase())
|
||||
.setDescription(loc_default.get(`c_${filename}_desc`) ?? "")
|
||||
.setDescription(loc_default.get(`c_${filename}_desc`)!)
|
||||
.setNameLocalizations(getLocalizations(client, `c_${filename}_name`, true))
|
||||
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_desc`))
|
||||
|
||||
// Disable repeat
|
||||
.addSubcommand((subcommand) =>
|
||||
subcommand
|
||||
.setName(loc_default.get(`c_${filename}_sub1_name`)?.toLowerCase() ?? "")
|
||||
.setDescription(loc_default.get(`c_${filename}_sub1_desc`) ?? "")
|
||||
.setName(loc_default.get(`c_${filename}_sub1_name`)!.toLowerCase())
|
||||
.setDescription(loc_default.get(`c_${filename}_sub1_desc`)!)
|
||||
.setNameLocalizations(getLocalizations(client, `c_${filename}_sub1_name`, true))
|
||||
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_sub1_desc`)),
|
||||
)
|
||||
|
@ -33,8 +33,8 @@ export default {
|
|||
// Repeat current track
|
||||
.addSubcommand((subcommand) =>
|
||||
subcommand
|
||||
.setName(loc_default.get(`c_${filename}_sub2_name`)?.toLowerCase() ?? "")
|
||||
.setDescription(loc_default.get(`c_${filename}_sub2_desc`) ?? "")
|
||||
.setName(loc_default.get(`c_${filename}_sub2_name`)!.toLowerCase())
|
||||
.setDescription(loc_default.get(`c_${filename}_sub2_desc`)!)
|
||||
.setNameLocalizations(getLocalizations(client, `c_${filename}_sub2_name`, true))
|
||||
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_sub2_desc`)),
|
||||
)
|
||||
|
@ -42,8 +42,8 @@ export default {
|
|||
// Repeat queue
|
||||
.addSubcommand((subcommand) =>
|
||||
subcommand
|
||||
.setName(loc_default.get(`c_${filename}_sub3_name`)?.toLowerCase() ?? "")
|
||||
.setDescription(loc_default.get(`c_${filename}_sub3_desc`) ?? "")
|
||||
.setName(loc_default.get(`c_${filename}_sub3_name`)!.toLowerCase())
|
||||
.setDescription(loc_default.get(`c_${filename}_sub3_desc`)!)
|
||||
.setNameLocalizations(getLocalizations(client, `c_${filename}_sub3_name`, true))
|
||||
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_sub3_desc`)),
|
||||
)
|
||||
|
@ -51,8 +51,8 @@ export default {
|
|||
// Enable autoplay
|
||||
.addSubcommand((subcommand) =>
|
||||
subcommand
|
||||
.setName(loc_default.get(`c_${filename}_sub4_name`)?.toLowerCase() ?? "")
|
||||
.setDescription(loc_default.get(`c_${filename}_sub4_desc`) ?? "")
|
||||
.setName(loc_default.get(`c_${filename}_sub4_name`)!.toLowerCase())
|
||||
.setDescription(loc_default.get(`c_${filename}_sub4_desc`)!)
|
||||
.setNameLocalizations(getLocalizations(client, `c_${filename}_sub4_name`, true))
|
||||
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_sub4_desc`)),
|
||||
)
|
||||
|
@ -64,31 +64,31 @@ export default {
|
|||
const filename = getFilename(__filename);
|
||||
|
||||
const loc = getLocale(client, interaction.locale);
|
||||
const queue = useQueue(interaction.guildId ?? "");
|
||||
const queue = useQueue(interaction.guildId!);
|
||||
|
||||
if (queue) {
|
||||
const subcommand = interaction.options.getSubcommand();
|
||||
switch (subcommand) {
|
||||
// Disable
|
||||
case loc_default?.get(`c_${filename}_sub1_name`)?.toLowerCase() ?? "": {
|
||||
case loc_default?.get(`c_${filename}_sub1_name`)?.toLowerCase(): {
|
||||
queue.setRepeatMode(QueueRepeatMode.OFF);
|
||||
return interaction.reply(loc.get("c_repeat2") + ".");
|
||||
}
|
||||
|
||||
// Queue Repeat
|
||||
case loc_default?.get(`c_${filename}_sub3_name`)?.toLowerCase() ?? "": {
|
||||
case loc_default?.get(`c_${filename}_sub3_name`)?.toLowerCase(): {
|
||||
queue.setRepeatMode(QueueRepeatMode.QUEUE);
|
||||
return interaction.reply(`${loc.get("c_repeat3")} ${loc.get("c_repeat6")}.`);
|
||||
}
|
||||
|
||||
// Autoplay
|
||||
case loc_default?.get(`c_${filename}_sub4_name`)?.toLowerCase() ?? "": {
|
||||
case loc_default?.get(`c_${filename}_sub4_name`)?.toLowerCase(): {
|
||||
queue.setRepeatMode(QueueRepeatMode.AUTOPLAY);
|
||||
return interaction.reply(`${loc.get("c_repeat4")} ${loc.get("c_repeat6")}.`);
|
||||
}
|
||||
|
||||
// Track repeat
|
||||
case loc_default?.get(`c_${filename}_sub2_name`)?.toLowerCase() ?? "": {
|
||||
case loc_default?.get(`c_${filename}_sub2_name`)?.toLowerCase(): {
|
||||
queue.setRepeatMode(QueueRepeatMode.TRACK);
|
||||
return interaction.reply(
|
||||
`${loc.get("c_repeat5")} ${queue.history.currentTrack?.title} ${loc.get("c_repeat6")}.`,
|
||||
|
|
|
@ -17,15 +17,15 @@ export default {
|
|||
return (
|
||||
new SlashCommandBuilder()
|
||||
.setName(filename.toLowerCase())
|
||||
.setDescription(loc_default.get(`c_${filename}_desc`) ?? "")
|
||||
.setDescription(loc_default.get(`c_${filename}_desc`)!)
|
||||
.setNameLocalizations(getLocalizations(client, `c_${filename}_name`, true))
|
||||
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_desc`))
|
||||
|
||||
// Command option
|
||||
.addNumberOption((option) =>
|
||||
option
|
||||
.setName(loc_default.get(`c_${filename}_opt1_name`)?.toLowerCase() ?? "")
|
||||
.setDescription(loc_default.get(`c_${filename}_opt1_desc`) ?? "")
|
||||
.setName(loc_default.get(`c_${filename}_opt1_name`)!.toLowerCase())
|
||||
.setDescription(loc_default.get(`c_${filename}_opt1_desc`)!)
|
||||
.setNameLocalizations(getLocalizations(client, `c_${filename}_opt1_name`, true))
|
||||
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_opt1_desc`)),
|
||||
)
|
||||
|
@ -37,7 +37,7 @@ export default {
|
|||
const filename = getFilename(__filename);
|
||||
|
||||
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);
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ export default {
|
|||
|
||||
return new SlashCommandBuilder()
|
||||
.setName(filename.toLowerCase())
|
||||
.setDescription(loc_default.get(`c_${filename}_desc`) ?? "")
|
||||
.setDescription(loc_default.get(`c_${filename}_desc`)!)
|
||||
.setNameLocalizations(getLocalizations(client, `c_${filename}_name`, true))
|
||||
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_desc`));
|
||||
},
|
||||
|
|
|
@ -168,7 +168,7 @@ export const sendReminder = (client: Client, info: infoReminder, option: OptionR
|
|||
}
|
||||
} else {
|
||||
// Channel
|
||||
client.channels.fetch(info.channelId ?? "").then((channel) => {
|
||||
client.channels.fetch(info.channelId!).then((channel) => {
|
||||
if (channel?.isSendable()) {
|
||||
let content = `<@${info.userId}>`;
|
||||
embed.setFooter({
|
||||
|
|
Loading…
Reference in a new issue