@@ -411,6 +411,7 @@ module.exports = {
411411 if ( ! data . guild_id ) { return ; }
412412 const guild = getOrCreateGuild ( c , data . guild_id , data . shardId ) ;
413413 const channel = getOrCreateChannel ( c , data . channel_id , guild ) ;
414+ if ( ! channel ) { return { } ; }
414415 const invite = guild . invites . _add ( Object . assign ( data , { channel, guild } ) ) ;
415416 return { invite } ;
416417 } ,
@@ -422,6 +423,7 @@ module.exports = {
422423 let invite = guild . invites . cache . get ( data . code ) ;
423424 if ( ! invite ) {
424425 const channel = getOrCreateChannel ( c , data . channel_id , guild ) ;
426+ if ( ! channel ) { return { } ; }
425427 invite = guild . invites . _add ( Object . assign ( data , { channel, guild } ) , false ) ;
426428 invite . partial = true ;
427429 }
@@ -433,6 +435,7 @@ module.exports = {
433435 const c = this . client ;
434436 const guild = data . guild_id ? getOrCreateGuild ( c , data . guild_id , data . shardId ) : void 0 ;
435437 const channel = getOrCreateChannel ( c , data . channel_id , guild ) ;
438+ if ( ! channel ) { return { } ; }
436439 channel . lastMessageId = data . id ;
437440 const message = channel . messages . _add ( data ) ;
438441 return { message } ;
@@ -443,6 +446,7 @@ module.exports = {
443446 const c = this . client ;
444447 const guild = data . guild_id ? getOrCreateGuild ( c , data . guild_id , data . shardId ) : void 0 ;
445448 const channel = getOrCreateChannel ( c , data . channel_id , guild ) ;
449+ if ( ! channel ) { return { } ; }
446450 const message = getOrCreateMessage ( channel , data . id ) ;
447451 channel . messages . cache . delete ( message . id ) ;
448452 message . deleted = true ;
@@ -453,6 +457,7 @@ module.exports = {
453457 const c = this . client ;
454458 const guild = data . guild_id ? getOrCreateGuild ( c , data . guild_id , data . shardId ) : void 0 ;
455459 const channel = getOrCreateChannel ( c , data . channel_id , guild ) ;
460+ if ( ! channel ) { return { } ; }
456461 const deleted = new Collection ( ) ;
457462 for ( const id of data . ids ) {
458463 const message = getOrCreateMessage ( channel , id ) ;
@@ -467,6 +472,7 @@ module.exports = {
467472 const c = this . client ;
468473 const guild = data . guild_id ? getOrCreateGuild ( c , data . guild_id , data . shardId ) : void 0 ;
469474 const channel = getOrCreateChannel ( c , data . channel_id , guild ) ;
475+ if ( ! channel ) { return { } ; }
470476 let message = channel . messages . cache . get ( data . id ) ;
471477 let old ;
472478 if ( message ) {
@@ -488,6 +494,7 @@ module.exports = {
488494 if ( ! channel ) {
489495 const guild = data . guild_id ? getOrCreateGuild ( c , data . guild_id , data . shardId ) : void 0 ;
490496 channel = getOrCreateChannel ( c , data . channel_id , guild ) ;
497+ if ( ! channel ) { return { } ; }
491498 }
492499 let user = data . user || c . users . cache . get ( data . user_id ) ;
493500 if ( ! user ) {
@@ -515,6 +522,7 @@ module.exports = {
515522 const c = this . client ;
516523 const guild = data . guild_id ? getOrCreateGuild ( c , data . guild_id , data . shardId ) : void 0 ;
517524 const channel = getOrCreateChannel ( c , data . channel_id , guild ) ;
525+ if ( ! channel ) { return { } ; }
518526 let user = c . users . cache . get ( data . user_id ) ;
519527 if ( ! user ) {
520528 user = c . users . _add ( { id : data . user_id } , false ) ; // has built in partial
@@ -540,6 +548,7 @@ module.exports = {
540548 const c = this . client ;
541549 const guild = data . guild_id ? getOrCreateGuild ( c , data . guild_id , data . shardId ) : void 0 ;
542550 const channel = getOrCreateChannel ( c , data . channel_id , guild ) ;
551+ if ( ! channel ) { return { } ; }
543552 const message = getOrCreateMessage ( channel , data . message_id ) ;
544553 const removed = message . reactions . cache . clone ( ) ;
545554 message . reactions . cache . clear ( ) ;
@@ -550,6 +559,7 @@ module.exports = {
550559 const c = this . client ;
551560 const guild = data . guild_id ? getOrCreateGuild ( c , data . guild_id , data . shardId ) : void 0 ;
552561 const channel = getOrCreateChannel ( c , data . channel_id , guild ) ;
562+ if ( ! channel ) { return { } ; }
553563 const message = getOrCreateMessage ( channel , data . message_id ) ;
554564 let reaction = message . reactions . cache . get ( data . emoji . id ?? decodeURIComponent ( data . emoji . name ) ) ;
555565 if ( ! reaction ) {
@@ -596,6 +606,7 @@ module.exports = {
596606 const c = this . client ;
597607 const guild = getOrCreateGuild ( c , data . guild_id , data . shardId ) ;
598608 const channel = getOrCreateChannel ( c , data . channel_id , guild ) ;
609+ if ( ! channel ) { return { } ; }
599610 const stageInstance = channel . guild . stageInstances . _add ( data ) ;
600611 c . emit ( Constants . Events . STAGE_INSTANCE_CREATE , stageInstance ) ;
601612 return { stageInstance } ;
@@ -605,6 +616,7 @@ module.exports = {
605616 const c = this . client ;
606617 const guild = getOrCreateGuild ( c , data . guild_id , data . shardId ) ;
607618 const channel = getOrCreateChannel ( c , data . channel_id , guild ) ;
619+ if ( ! channel ) { return { } ; }
608620 const stageInstance = channel . guild . stageInstances . _add ( data ) ;
609621 if ( stageInstance ) {
610622 channel . guild . stageInstances . cache . delete ( stageInstance . id ) ;
@@ -618,6 +630,7 @@ module.exports = {
618630 const c = this . client ;
619631 const guild = getOrCreateGuild ( c , data . guild_id , data . shardId ) ;
620632 const channel = getOrCreateChannel ( c , data . channel_id , guild ) ;
633+ if ( ! channel ) { return { } ; }
621634 let oldStageInstance = channel . guild . stageInstances . cache . get ( data . id ) ?. _clone ( ) ;
622635 if ( ! oldStageInstance ) {
623636 oldStageInstance = channel . guild . stageInstances . _add ( { id : data . id } , false ) ;
@@ -739,6 +752,7 @@ module.exports = {
739752 const c = this . client ;
740753 const guild = data . guild_id ? getOrCreateGuild ( c , data . guild_id , data . shardId ) : void 0 ;
741754 const channel = getOrCreateChannel ( c , data . channel_id , guild ) ;
755+ if ( ! channel ) { return ; }
742756 let user = c . users . cache . get ( data . user_id ) ;
743757 if ( ! user ) {
744758 if ( data . member ?. user ) {
@@ -796,6 +810,7 @@ module.exports = {
796810 const c = this . client ;
797811 const guild = getOrCreateGuild ( c , data . guild_id , data . shardId ) ;
798812 const channel = getOrCreateChannel ( c , data . channel_id , guild ) ;
813+ if ( ! channel ) { return ; }
799814 c . emit ( Constants . Events . WEBHOOKS_UPDATE , channel ) ;
800815 }
801816
0 commit comments