File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed
packages/discord.js/src/client/actions Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -6,14 +6,23 @@ const { createChannel } = require('../../util/Channels');
66class ChannelUpdateAction extends Action {
77 handle ( data ) {
88 const client = this . client ;
9-
109 let channel = client . channels . cache . get ( data . id ) ;
10+
1111 if ( channel ) {
1212 const old = channel . _update ( data ) ;
1313
1414 if ( channel . type !== data . type ) {
1515 const newChannel = createChannel ( this . client , data , channel . guild ) ;
16- for ( const [ id , message ] of channel . messages . cache ) newChannel . messages . cache . set ( id , message ) ;
16+
17+ if ( ! newChannel ) {
18+ this . client . channels . cache . delete ( channel . id ) ;
19+ return { } ;
20+ }
21+
22+ if ( channel . isTextBased ( ) && newChannel . isTextBased ( ) ) {
23+ for ( const [ id , message ] of channel . messages . cache ) newChannel . messages . cache . set ( id , message ) ;
24+ }
25+
1726 channel = newChannel ;
1827 this . client . channels . cache . set ( channel . id , channel ) ;
1928 }
You can’t perform that action at this time.
0 commit comments