File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -227,18 +227,27 @@ export class BotUtilities {
227227
228228 async get_channel ( id : string ) {
229229 const channel = await this . wheatley . client . channels . fetch ( id ) ;
230+ if ( ! channel ) {
231+ throw Error ( `Channel ${ id } not found` ) ;
232+ }
230233 assert ( channel instanceof Discord . TextChannel , `Channel ${ channel } (${ id } ) not of the expected type` ) ;
231234 return channel ;
232235 }
233236
234237 async get_forum_channel ( id : string ) {
235238 const channel = await this . wheatley . client . channels . fetch ( id ) ;
239+ if ( ! channel ) {
240+ throw Error ( `Forum channel ${ id } not found` ) ;
241+ }
236242 assert ( channel instanceof Discord . ForumChannel , `Channel ${ channel } (${ id } ) not of the expected type` ) ;
237243 return channel ;
238244 }
239245
240246 async get_thread_channel ( id : string ) {
241247 const channel = await this . wheatley . client . channels . fetch ( id ) ;
248+ if ( ! channel ) {
249+ throw Error ( `Thread channel ${ id } not found` ) ;
250+ }
242251 assert ( channel instanceof Discord . ThreadChannel , `Channel ${ channel } (${ id } ) not of the expected type` ) ;
243252 return channel ;
244253 }
You can’t perform that action at this time.
0 commit comments