Exemplo n.º 1
0
 async def parse_guild_delete(self, data, old):
     if old:
         old = Guild(state=self, data=old)
         if data.get("unavailable", False):
             new = Guild(state=self, data=data)
             self.dispatch("guild_unavailable", new)
         else:
             self.dispatch("guild_remove", old)
Exemplo n.º 2
0
    async def _get_guild(self, guild_id):
        result = await self.get(f"guild:{guild_id}")

        if result:
            guild = Guild(state=self, data=result)
            if not guild.unavailable:
                return guild

        return None
Exemplo n.º 3
0
 def _add_guild_from_data(self, guild):
     return Guild(state=self, data=guild)
Exemplo n.º 4
0
 async def _get_guild(self, guild_id):
     result = await self._get(f"guild:{guild_id}")
     if result:
         result = Guild(state=self, data=result)
     return result
Exemplo n.º 5
0
 async def _guilds(self):
     return [
         Guild(state=self, data=x)
         for x in await self._members_get_all("guild")
     ]
Exemplo n.º 6
0
 async def _guilds(self):
     guilds = [
         Guild(state=self, data=x)
         for x in await self._members_get_all("guild")
     ]
     return [x for x in guilds if not x.unavailable]