2023-02-12 16:46:06 +00:00
const { SlashCommandBuilder } = require ( 'discord.js' ) ;
const fn = require ( '../modules/functions.js' ) ;
module . exports = {
data : new SlashCommandBuilder ( )
. setName ( 'rolemenu' )
. setDescription ( 'Send a self-assignable role selection menu' )
. addRoleOption ( o =>
o . setName ( 'waterrole' )
. setDescription ( 'The role for water reminder pings' )
. setRequired ( true ) )
. addRoleOption ( o =>
o . setName ( 'fruitrole' )
. setDescription ( 'The role for fruit alert pings' )
. setRequired ( false ) ) ,
async execute ( interaction ) {
await interaction . deferReply ( ) . catch ( err => console . error ( err ) ) ;
2023-02-12 20:29:38 +00:00
if ( interaction . client . guildInfos . has ( interaction . guildId ) ) {
let guildInfo = interaction . client . guildInfos . get ( interaction . guildId ) ;
guildInfo . setRoles ( interaction . options . getRole ( 'waterrole' ) . id , interaction . options . getRole ( 'fruitrole' ) . id ) ;
await interaction . editReply ( fn . builders . embeds . treeRoleMenu ( guildInfo ) ) . catch ( err => console . error ( err ) ) ;
} else {
await interaction . editReply ( fn . builders . errorEmbed ( "No information is known about your server yet, please run /setup or /compare" ) ) . catch ( err => console . error ( err ) ) ;
}
2023-02-12 16:46:06 +00:00
} ,
} ;