def shard_id(self):
        """Returns the shard ID for this guild if applicable."""
        count = self._state.shard_count
        if count is None:
            return None
        return (self.id >> 22) % count