feat: Implement guild_join event
@@ -322,6 +322,7 @@ class WebSocketClient:
self.ready.set()
self._dispatch.dispatch("on_ready")
self._ready = data
+ self.__unavailable_guilds = [i["id"] for i in data["guilds"]]
self.session_id = data["session_id"]
self.resume_url = data["resume_gateway_url"]
if not self.__started:
@@ -488,6 +489,12 @@ class WebSocketClient:
ids = self.__get_object_ids(obj, model)
if "_create" in name or "_add" in name:
+ if name == "guild_create":
+ if id and str(id) in self.__unavailable_guilds:
+ self.__unavailable_guilds.remove(str(id))
+ else:
+ self._dispatch.dispatch("on_guild_join", obj)
+
self._dispatch.dispatch(f"on_{name}", obj)
if id:
