feat: Reminders #44
1 changed files with 144 additions and 0 deletions
144
src/commands/misc/reminder.ts
Normal file
144
src/commands/misc/reminder.ts
Normal file
|
@ -0,0 +1,144 @@
|
|||
import { SlashCommandBuilder } from '@discordjs/builders';
|
||||
import { Client, ChatInputCommandInteraction } from 'discord.js';
|
||||
import { getLocale, getLocalizations } from '../../utils/locales';
|
||||
import { getFilename } from '../../utils/misc';
|
||||
|
||||
export default {
|
||||
data: (client: Client) => {
|
||||
const filename = getFilename(__filename);
|
||||
const loc_default = client.locales.get(client.config.default_lang);
|
||||
if (!loc_default) {
|
||||
return;
|
||||
}
|
||||
|
||||
return new SlashCommandBuilder()
|
||||
// Command
|
||||
.setName(filename.toLowerCase())
|
||||
.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`) ?? ''
|
||||
).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`) ?? ''
|
||||
).setNameLocalizations(
|
||||
getLocalizations(
|
||||
client,
|
||||
`c_${filename}_sub1_opt1_name`,
|
||||
true
|
||||
)
|
||||
).setDescriptionLocalizations(
|
||||
getLocalizations(client, `c_${filename}_sub1_opt1_desc`)
|
||||
).setRequired(true)
|
||||
)
|
||||
|
||||
// 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`) ?? ''
|
||||
).setNameLocalizations(
|
||||
getLocalizations(
|
||||
client,
|
||||
`c_${filename}_sub1_opt2_name`,
|
||||
true
|
||||
)
|
||||
).setDescriptionLocalizations(
|
||||
getLocalizations(client, `c_${filename}_sub1_opt2_desc`)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
// List reminders
|
||||
.addSubcommand(subcommand => subcommand
|
||||
.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
|
||||
.addStringOption(option => option
|
||||
.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
|
||||
)
|
||||
).setDescriptionLocalizations(
|
||||
getLocalizations(client, `c_${filename}_sub2_opt1_desc`)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
// Delete a reminder
|
||||
.addSubcommand(subcommand => subcommand
|
||||
.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
|
||||
.addStringOption(option => option
|
||||
.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
|
||||
)
|
||||
).setDescriptionLocalizations(
|
||||
getLocalizations(client, `c_${filename}_sub3_opt1_desc`)
|
||||
).setRequired(true)
|
||||
),
|
||||
);
|
||||
},
|
||||
|
||||
interaction: async (interaction: ChatInputCommandInteraction, client: Client) => {
|
||||
const loc = getLocale(client, interaction.locale);
|
||||
|
||||
/* Votre code ici */
|
||||
},
|
||||
};
|
Loading…
Reference in a new issue