@@ -435,7 +435,7 @@ module.exports = {
435435 const c = this . client ;
436436 const guild = data . guild_id ? getOrCreateGuild ( c , data . guild_id , data . shardId ) : void 0 ;
437437 const channel = getOrCreateChannel ( c , data . channel_id , guild ) ;
438- if ( ! channel ) { return { } ; }
438+ if ( ! channel || ! channel . messages ) { return { } ; }
439439 channel . lastMessageId = data . id ;
440440 const message = channel . messages . _add ( data ) ;
441441 return { message } ;
@@ -446,7 +446,7 @@ module.exports = {
446446 const c = this . client ;
447447 const guild = data . guild_id ? getOrCreateGuild ( c , data . guild_id , data . shardId ) : void 0 ;
448448 const channel = getOrCreateChannel ( c , data . channel_id , guild ) ;
449- if ( ! channel ) { return { } ; }
449+ if ( ! channel || ! channel . messages ) { return { } ; }
450450 const message = getOrCreateMessage ( channel , data . id ) ;
451451 channel . messages . cache . delete ( message . id ) ;
452452 message . deleted = true ;
@@ -457,7 +457,7 @@ module.exports = {
457457 const c = this . client ;
458458 const guild = data . guild_id ? getOrCreateGuild ( c , data . guild_id , data . shardId ) : void 0 ;
459459 const channel = getOrCreateChannel ( c , data . channel_id , guild ) ;
460- if ( ! channel ) { return { } ; }
460+ if ( ! channel || ! channel . messages ) { return { } ; }
461461 const deleted = new Collection ( ) ;
462462 for ( const id of data . ids ) {
463463 const message = getOrCreateMessage ( channel , id ) ;
@@ -472,7 +472,7 @@ module.exports = {
472472 const c = this . client ;
473473 const guild = data . guild_id ? getOrCreateGuild ( c , data . guild_id , data . shardId ) : void 0 ;
474474 const channel = getOrCreateChannel ( c , data . channel_id , guild ) ;
475- if ( ! channel ) { return { } ; }
475+ if ( ! channel || ! channel . messages ) { return { } ; }
476476 let message = channel . messages . cache . get ( data . id ) ;
477477 let old ;
478478 if ( message ) {
@@ -494,7 +494,7 @@ module.exports = {
494494 if ( ! channel ) {
495495 const guild = data . guild_id ? getOrCreateGuild ( c , data . guild_id , data . shardId ) : void 0 ;
496496 channel = getOrCreateChannel ( c , data . channel_id , guild ) ;
497- if ( ! channel ) { return { } ; }
497+ if ( ! channel || ! channel . messages ) { return { } ; }
498498 }
499499 let user = data . user || c . users . cache . get ( data . user_id ) ;
500500 if ( ! user ) {
@@ -522,7 +522,7 @@ module.exports = {
522522 const c = this . client ;
523523 const guild = data . guild_id ? getOrCreateGuild ( c , data . guild_id , data . shardId ) : void 0 ;
524524 const channel = getOrCreateChannel ( c , data . channel_id , guild ) ;
525- if ( ! channel ) { return { } ; }
525+ if ( ! channel || ! channel . messages ) { return { } ; }
526526 let user = c . users . cache . get ( data . user_id ) ;
527527 if ( ! user ) {
528528 user = c . users . _add ( { id : data . user_id } , false ) ; // has built in partial
@@ -548,7 +548,7 @@ module.exports = {
548548 const c = this . client ;
549549 const guild = data . guild_id ? getOrCreateGuild ( c , data . guild_id , data . shardId ) : void 0 ;
550550 const channel = getOrCreateChannel ( c , data . channel_id , guild ) ;
551- if ( ! channel ) { return { } ; }
551+ if ( ! channel || ! channel . messages ) { return { } ; }
552552 const message = getOrCreateMessage ( channel , data . message_id ) ;
553553 const removed = message . reactions . cache . clone ( ) ;
554554 message . reactions . cache . clear ( ) ;
@@ -559,7 +559,7 @@ module.exports = {
559559 const c = this . client ;
560560 const guild = data . guild_id ? getOrCreateGuild ( c , data . guild_id , data . shardId ) : void 0 ;
561561 const channel = getOrCreateChannel ( c , data . channel_id , guild ) ;
562- if ( ! channel ) { return { } ; }
562+ if ( ! channel || ! channel . messages ) { return { } ; }
563563 const message = getOrCreateMessage ( channel , data . message_id ) ;
564564 let reaction = message . reactions . cache . get ( data . emoji . id ?? decodeURIComponent ( data . emoji . name ) ) ;
565565 if ( ! reaction ) {
@@ -662,7 +662,7 @@ module.exports = {
662662 if ( ! channel ) {
663663 const guild = getOrCreateGuild ( c , data . guild_id , data . shardId ) ;
664664 channel = c . channels . _add ( data , guild , { cache : false , allowUnknownGuild : true } ) ;
665- if ( ! channel ) {
665+ if ( ! channel || ! channel . messages ) {
666666 return { } ;
667667 }
668668 makePartial ( channel ) ;
@@ -752,7 +752,7 @@ module.exports = {
752752 const c = this . client ;
753753 const guild = data . guild_id ? getOrCreateGuild ( c , data . guild_id , data . shardId ) : void 0 ;
754754 const channel = getOrCreateChannel ( c , data . channel_id , guild ) ;
755- if ( ! channel ) { return ; }
755+ if ( ! channel || ! channel . messages ) { return ; }
756756 let user = c . users . cache . get ( data . user_id ) ;
757757 if ( ! user ) {
758758 if ( data . member ?. user ) {
0 commit comments