5ef905449d
* Add 24h growth indicator * Fix float math * Fix some bugs * Trim decimals * Add 24 hour observed growth * Add beginning height option * Changed startup message to ping me * Add a ping reminder and setup command for it * Setup automatic water reminders * Improved workflows * New water readiness system * Documentation Time * Fix slash command link * Fix linebreaks * Readability improvements * Forgot to allow checking in prod * Switch to ephemeral reply * Restructuring and new help messages * Not meant to be uploaded * Documentation update * Changing the way reminders are deleted * Tweak timings * Adjust readiness detection system * moar tweekz * fix reminders * Updates to water reminders
31 lines
1.2 KiB
JavaScript
31 lines
1.2 KiB
JavaScript
const { SlashCommandBuilder, PermissionFlagsBits } = require('discord.js');
|
|
const dbfn = require('../modules/dbfn.js');
|
|
const fn = require('../modules/functions.js');
|
|
|
|
module.exports = {
|
|
data: new SlashCommandBuilder()
|
|
.setName('setping')
|
|
.setDescription('Opt-in to automatic water reminders')
|
|
.addStringOption(o =>
|
|
o.setName('pingmsg')
|
|
.setDescription('The message to send for a water reminder')
|
|
.setRequired(true))
|
|
.addChannelOption(o =>
|
|
o.setName('pingchannel')
|
|
.setDescription('The channel to send the water reminder in')
|
|
.setRequired(true))
|
|
.setDefaultMemberPermissions(PermissionFlagsBits.ManageRoles),
|
|
async execute(interaction) {
|
|
try {
|
|
await interaction.deferReply({ ephemeral: true });
|
|
const reminderMessage = interaction.options.getString('pingmsg');
|
|
const reminderChannel = interaction.options.getChannel('pingchannel');
|
|
const setPingRoleResponse = await dbfn.setReminderInfo(interaction.guildId, reminderMessage, reminderChannel.id);
|
|
await dbfn.setReminderOptIn(interaction.guildId, 1);
|
|
interaction.editReply(setPingRoleResponse.status);
|
|
} catch(err) {
|
|
console.error(err);
|
|
await interaction.editReply(fn.builders.errorEmbed(err));
|
|
}
|
|
},
|
|
}; |