@@ -2243,57 +2243,37 @@ private async Task ProcessMessageAsync(GatewayOpCode opCode, int? seq, string ty
2243
2243
channel = State . GetDMChannel ( data . User . Value . Id ) ;
2244
2244
}
2245
2245
2246
- if ( channel == null )
2246
+ var guild = ( channel as SocketGuildChannel ) ? . Guild ;
2247
+ if ( guild != null && ! guild . IsSynced )
2247
2248
{
2248
- var channelModel = await Rest . ApiClient . GetChannelAsync ( data . ChannelId . Value ) ;
2249
-
2250
- if ( data . GuildId . IsSpecified )
2251
- channel = SocketTextChannel . Create ( State . GetGuild ( data . GuildId . Value ) , State , channelModel ) ;
2252
- else
2253
- channel = ( SocketChannel ) SocketChannel . CreatePrivate ( this , State , channelModel ) ;
2254
-
2255
- State . AddChannel ( channel ) ;
2249
+ await UnsyncedGuildAsync ( type , guild . Id ) . ConfigureAwait ( false ) ;
2250
+ return ;
2256
2251
}
2257
2252
2258
- if ( channel is ISocketMessageChannel textChannel )
2259
- {
2260
- var guild = ( channel as SocketGuildChannel ) ? . Guild ;
2261
- if ( guild != null && ! guild . IsSynced )
2262
- {
2263
- await UnsyncedGuildAsync ( type , guild . Id ) . ConfigureAwait ( false ) ;
2264
- return ;
2265
- }
2266
-
2267
- var interaction = SocketInteraction . Create ( this , data , channel as ISocketMessageChannel ) ;
2253
+ var interaction = SocketInteraction . Create ( this , data , channel as ISocketMessageChannel ) ;
2268
2254
2269
- await TimedInvokeAsync ( _interactionCreatedEvent , nameof ( InteractionCreated ) , interaction ) . ConfigureAwait ( false ) ;
2255
+ await TimedInvokeAsync ( _interactionCreatedEvent , nameof ( InteractionCreated ) , interaction ) . ConfigureAwait ( false ) ;
2270
2256
2271
- switch ( interaction )
2272
- {
2273
- case SocketSlashCommand slashCommand :
2274
- await TimedInvokeAsync ( _slashCommandExecuted , nameof ( SlashCommandExecuted ) , slashCommand ) . ConfigureAwait ( false ) ;
2275
- break ;
2276
- case SocketMessageComponent messageComponent :
2277
- if ( messageComponent . Data . Type == ComponentType . SelectMenu )
2278
- await TimedInvokeAsync ( _selectMenuExecuted , nameof ( SelectMenuExecuted ) , messageComponent ) . ConfigureAwait ( false ) ;
2279
- if ( messageComponent . Data . Type == ComponentType . Button )
2280
- await TimedInvokeAsync ( _buttonExecuted , nameof ( ButtonExecuted ) , messageComponent ) . ConfigureAwait ( false ) ;
2281
- break ;
2282
- case SocketUserCommand userCommand :
2283
- await TimedInvokeAsync ( _userCommandExecuted , nameof ( UserCommandExecuted ) , userCommand ) . ConfigureAwait ( false ) ;
2284
- break ;
2285
- case SocketMessageCommand messageCommand :
2286
- await TimedInvokeAsync ( _messageCommandExecuted , nameof ( MessageCommandExecuted ) , messageCommand ) . ConfigureAwait ( false ) ;
2287
- break ;
2288
- case SocketAutocompleteInteraction autocomplete :
2289
- await TimedInvokeAsync ( _autocompleteExecuted , nameof ( AutocompleteExecuted ) , autocomplete ) . ConfigureAwait ( false ) ;
2290
- break ;
2291
- }
2292
- }
2293
- else
2257
+ switch ( interaction )
2294
2258
{
2295
- await UnknownChannelAsync ( type , data . ChannelId . Value ) . ConfigureAwait ( false ) ;
2296
- return ;
2259
+ case SocketSlashCommand slashCommand :
2260
+ await TimedInvokeAsync ( _slashCommandExecuted , nameof ( SlashCommandExecuted ) , slashCommand ) . ConfigureAwait ( false ) ;
2261
+ break ;
2262
+ case SocketMessageComponent messageComponent :
2263
+ if ( messageComponent . Data . Type == ComponentType . SelectMenu )
2264
+ await TimedInvokeAsync ( _selectMenuExecuted , nameof ( SelectMenuExecuted ) , messageComponent ) . ConfigureAwait ( false ) ;
2265
+ if ( messageComponent . Data . Type == ComponentType . Button )
2266
+ await TimedInvokeAsync ( _buttonExecuted , nameof ( ButtonExecuted ) , messageComponent ) . ConfigureAwait ( false ) ;
2267
+ break ;
2268
+ case SocketUserCommand userCommand :
2269
+ await TimedInvokeAsync ( _userCommandExecuted , nameof ( UserCommandExecuted ) , userCommand ) . ConfigureAwait ( false ) ;
2270
+ break ;
2271
+ case SocketMessageCommand messageCommand :
2272
+ await TimedInvokeAsync ( _messageCommandExecuted , nameof ( MessageCommandExecuted ) , messageCommand ) . ConfigureAwait ( false ) ;
2273
+ break ;
2274
+ case SocketAutocompleteInteraction autocomplete :
2275
+ await TimedInvokeAsync ( _autocompleteExecuted , nameof ( AutocompleteExecuted ) , autocomplete ) . ConfigureAwait ( false ) ;
2276
+ break ;
2297
2277
}
2298
2278
}
2299
2279
break ;
0 commit comments