@@ -106,7 +106,7 @@ class Discord
106106 /**
107107 * An array of loggers for voice clients.
108108 *
109- * @var array Loggers.
109+ * @var ?LoggerInterface[] Loggers.
110110 */
111111 protected $ voiceLoggers = [];
112112
@@ -379,13 +379,6 @@ public function __construct(array $options = [])
379379 $ this ->handlers ->removeHandler ($ event );
380380 }
381381
382- $ function = function () use (&$ function ) {
383- $ this ->emittedInit = true ;
384- $ this ->removeListener ('ready ' , $ function );
385- };
386-
387- $ this ->on ('ready ' , $ function );
388-
389382 $ this ->http = new Http (
390383 'Bot ' .$ this ->token ,
391384 $ this ->loop ,
@@ -1130,17 +1123,14 @@ protected function ready()
11301123 if ($ this ->emittedInit ) {
11311124 return false ;
11321125 }
1126+ $ this ->emittedInit = true ;
11331127
11341128 $ this ->logger ->info ('client is ready ' );
11351129 $ this ->emit ('init ' , [$ this ]);
11361130
1137- /* deprecated */
1138- if ($ this ->listeners ['ready ' ]) {
1139- if (count ($ this ->listeners ['ready ' ] ?? []) > 1 || count ($ this ->onceListeners ['ready ' ] ?? []) > 1 ) {
1140- $ this ->logger ->info ('The \'ready \' event is deprecated and will be removed in a future version of DiscordPHP. Please use \'init \' instead. ' );
1141- }
1142-
1143- $ this ->emit ('ready ' , [$ this ]);
1131+ if (count ($ this ->listeners ('ready ' ))) {
1132+ $ this ->logger ->info ("The 'ready' event is deprecated and will be removed in a future version of DiscordPHP. Please use 'init' instead. " );
1133+ $ this ->emit ('ready ' , [$ this ]); // deprecated
11441134 }
11451135
11461136 foreach ($ this ->unparsedPackets as $ parser ) {
0 commit comments