@@ -43,8 +43,8 @@ const command: Command = {
4343 ephemeral : true ,
4444 async execute ( interaction : ChatInputCommandInteraction , client : ExtendedClient , Discord : typeof import ( "discord.js" ) ) {
4545 try {
46- let time : number | string = interaction . options . get ( "time" ) . value as string ;
47- const reason = interaction . options . get ( "reason" ) . value as string ;
46+ let time : number | string = interaction . options . get ( "time" ) ? .value as string ;
47+ const reason = interaction . options . get ( "reason" ) ? .value as string ;
4848 const sendInChannel = interaction . options . get ( "send_in_channel" ) ?. value || false as boolean ;
4949
5050 const reminders = await Reminder . find ( { user : interaction . user . id } ) ;
@@ -103,7 +103,7 @@ const command: Command = {
103103 const reminder = await new Reminder ( {
104104 reminder_id : id ,
105105 user : interaction . user . id ,
106- channel : interaction . channel . id ? interaction . channel . id : null ,
106+ channel : interaction . channel ? .id ? interaction . channel ? .id : null ,
107107 set : Date . now ( ) ,
108108 due : Date . now ( ) + time ,
109109 delay : time ,
@@ -121,15 +121,15 @@ const command: Command = {
121121 . setTitle ( "Reminder" )
122122 . setDescription ( reason )
123123 . addFields (
124- { name : "Set" , value : `<t:${ reminder . set . toString ( ) . slice ( 0 , - 3 ) } :f> (<t:${ reminder . set . toString ( ) . slice ( 0 , - 3 ) } :R>)` }
124+ { name : "Set" , value : `<t:${ reminder . set ? .toString ( ) . slice ( 0 , - 3 ) } :f> (<t:${ reminder . set ? .toString ( ) . slice ( 0 , - 3 ) } :R>)` }
125125 )
126126 . setFooter ( { text : `ID: ${ reminder . reminder_id } ` } )
127127 . setTimestamp ( )
128128
129129
130- if ( sendInChannel && interaction . channel . id ) {
130+ if ( sendInChannel && interaction . channel ? .id ) {
131131 try {
132- const channel = client . channels . cache . get ( interaction . channel . id ) as TextChannel ;
132+ const channel = client . channels . cache . get ( interaction . channel ? .id ) as TextChannel ;
133133
134134 if ( ! channel ) throw "Channel not found." ;
135135
@@ -143,7 +143,7 @@ const command: Command = {
143143 try {
144144 await interaction . user . send ( { embeds : [ embed ] } ) ;
145145 } catch {
146- const channel = client . channels . cache . get ( interaction . channel . id ) as TextChannel ;
146+ const channel = client . channels . cache . get ( interaction . channel ? .id ) as TextChannel ;
147147
148148 if ( ! channel ) return ;
149149
@@ -155,7 +155,7 @@ const command: Command = {
155155
156156 const reminderSet = new Discord . EmbedBuilder ( )
157157 . setColor ( client . config . embeds . default )
158- . setDescription ( `${ emoji . tick } Your reminder has been set for <t:${ reminder . due . toString ( ) . slice ( 0 , - 3 ) } :f> with ID \`${ reminder . reminder_id } \`!` )
158+ . setDescription ( `${ emoji . tick } Your reminder has been set for <t:${ reminder . due ? .toString ( ) . slice ( 0 , - 3 ) } :f> with ID \`${ reminder . reminder_id } \`!` )
159159
160160 await interaction . editReply ( { embeds : [ reminderSet ] } ) ;
161161 } catch ( err ) {
0 commit comments