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');
6
6
class ChannelUpdateAction extends Action {
7
7
handle ( data ) {
8
8
const client = this . client ;
9
-
10
9
let channel = client . channels . cache . get ( data . id ) ;
10
+
11
11
if ( channel ) {
12
12
const old = channel . _update ( data ) ;
13
13
14
14
if ( channel . type !== data . type ) {
15
15
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
+
17
26
channel = newChannel ;
18
27
this . client . channels . cache . set ( channel . id , channel ) ;
19
28
}
You can’t perform that action at this time.
0 commit comments